Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Warzone 3.1 and above.

Example

Code Block
themeEclipse
languagejavascript
linenumberstrue
// Assuming "truckDroid" contains a DROID_CONSTRUCT object...
 
// Structure to be built (you need its ID):
var struct = "A0LightFactory"; // Light Factory (for building tanks)
 
// Check we can build this structure
if (!isStructureAvailable(struct,me)) {
  // Pick a suitable location to build it:
  var pos = pickStructLocation(truckDroid,struct,truckDroid.x,truckDroid.y);
  if (!!pos) {
    // Build the structure:
    orderDroidBuild(droid,struct,pos.x,pos.y);
  } else {
    // unable to find suitable building site :(
  }
}

...

The droid's current order can be determined from it's .order property. For more infomration information see Droid object.

You can get structure IDs from the online user guide: Base structures and Defences. Click on any of the structures listed there to get their details page, and the ID is shown near the top.

...