Other great resources: Official JS API docs, Scripting Forum
setDroidLimit()
Define the maximum number of droids a player can create.
Syntax
setDroidLimit(player, limit[, droidType]);Parameters
Parameter | Type | Mandatory | Notes | Warzone Version |
|---|---|---|---|---|
player | Number | Which player(s) should the droids be counted for? Specify the player id for which the limit will be applied. | 3.2 | |
limit | Number | Specify the maximum number of droids of the given droidType that the player can produce. | 3.2 | |
droidType | Constant | If specified, the limit will be applied to the specific type of droid. Currently, the following types of droids can be limited:
If not specified, defaults to DROID_ANY which limits the overall number of droids, irrespective of type, that the player can produce. | 3.2 |
Return value
Value | Type | Notes | Warzone Version |
|---|---|---|---|
| Undefined | The function does not return anything if sucessful. | 3.2 |
<error> | Error | An error occurred, most likely the player did not exist or there was an issue with the limit specified. | 3.2 |
Notes
The standard game limits for droids are as follows:
Droid Type | Limit according to standard game rules |
|---|---|
100 – for campaign games 150 – for skirmish/challenge/mp games See: | |
15 – limit applies to trucks and combat engineers cumulatively | |
10 – a COMMAND_CONTROL is also required before commanders can be produced |
Example
setDroidLimit(me, 150); // I can produce up to 150 droids in total
setDroidLimit(2, 5, DROID_COMMAND); // Player 2 can only make 5 commanders
// ... if they have a Command Relay Centre