Other great resources: Official JS API docs, Scripting Forum
setDroidLimit()
- Aubergine
Owned by Aubergine
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 | 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 |
---|---|
DROID_ANY | 100 – for campaign games 150 – for skirmish/challenge/mp games See: |
DROID_CONSTRUCT | 15 – limit applies to trucks and combat engineers cumulatively |
DROID_COMMAND | 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
This function should only be used during Player Initialisation or single player games.
Availability 3.2+
Requires:
- Warzone 3.2 or above
Contents
Jump to:
See also
Related articles:
- getDroidLimit() – find out what current limits are set for droid production
- Droids – quick reference to JS API features relating to droids
- countDroid() – determine how many droids a player currently has
- Droid object – lots of useful information on droids