Versions Compared

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

Code Block
themeRDark
languagejavascript
linenumberstrue
hackNetOff();
setStructureLimits(structure,limit[,player]);
applyLimitSet(); // need to call this to apply the limits
hackNetOn();

Parameters

ParameterTypeMandatoryDescriptionGame version
structureIdString(tick)The ID of the structure, taken from structures.txt3.1 Beta 1
limitNumber(tick)The maximum number of the structure the player can build.3.1 Beta 1
playerNumber(error)

The player ID to apply the limits to.

Defaults to me.

3.1 Beta 1

Return value

ValueTypeDescriptionGame version
undefinedUndefinedThe function always returns undefined3.1 Beta 1
<error>ErrorInvalid structure or the limit value was too high (too many buildings)3.1 Beta 1

Example

Code Block
themeRDark
languagejavascript
linenumberstrue
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
classnotice box ping

You must wrap this function with with hackNetOff() and  and hackNetOn() functions functions

Div
classbox suggest

The setStructureLimits() function is primarily used when applying
Player Initialisation.

Div
classbox
Availability
Status
colourGreen
title3.1 b1+

Requires:

  • Warzone 3.1 Beta 1 and above
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles:

  • applyLimitSet() – must be called to make setStructureLimits() take effect
  • isStructureAvailable() – check if you can build the specified structure (eg. not reached structure limits)