(info) 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

ParameterTypeMandatoryNotesWarzone Version
player

Number

(tick)

Which player(s) should the droids be counted for?

Specify the player id for which the limit will be applied.

3.2
limitNumber(tick)Specify the maximum number of droids of the given droidType that the player can produce.3.2
droidTypeConstant(error)

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

ValueTypeNotesWarzone Version
undefinedUndefinedThe function does not return anything if sucessful.3.2
<error>ErrorAn 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 TypeLimit according to standard game rules
DROID_ANY

100 – for campaign games

150 – for skirmish/challenge/mp games

See:

DROID_CONSTRUCT15 – limit applies to trucks and combat engineers cumulatively
DROID_COMMAND10 – 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