Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Set limits on how many structures of a specific type a player can build. |
Syntax
You must wrap this function call with hackNetOff() and hackNetOn() functions.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
hackNetOff(); setStructureLimits(structure,limit[,player]); applyLimitSet(); // need to call this to apply the limits hackNetOn(); |
Parameters
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
structureId | String | The ID of the structure, taken from structures.txt | 3.1 Beta 1 | |
limit | Number | The maximum number of the structure the player can build. | 3.1 Beta 1 | |
player | Number | The player ID to apply the limits to. Defaults to me. | 3.1 Beta 1 |
Return value
Value | Type | Description | Game version |
---|---|---|---|
undefined | Undefined | The function always returns undefined | 3.1 Beta 1 |
<error> | Error | Invalid structure or the limit value was too high (too many buildings) | 3.1 Beta 1 |
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
hackNetOff(); for (var playnum=0; playnum<maxPlayers; playnum++) { setStructureLimits("A0LightFactory", 5, playnum); setStructureLimits("A0PowerGenerator", 8, playnum); setStructureLimits("A0ResearchFacility", 5, playnum); setStructureLimits("A0CommandCentre", 1, playnum); setStructureLimits("A0ComDroidControl", 1, playnum); setStructureLimits("A0CyborgFactory", 5, playnum); setStructureLimits("A0VTolFactory1", 5, playnum); } applyLimitSet(); hackNetOn(); |
Div | ||
---|---|---|
| ||
You must wrap this function with hackNetOff() and hackNetOn() functions. |
Div | ||
---|---|---|
| ||
The setStructureLimits() function is primarily used when applying |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
ContentsAvailability
| Contents | |||||
Div | ||||||
| ||||||
AvailabilityThis function is compatible with
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoThe following JS API features relate to this functionRelated articles:
|