(info) Other great resources: Official JS API docs, Scripting Forum

DORDER_BUILD

Overview

Instruct a construction droid to build a Structure object at a specific location.

Availability

Warzone 3.1 and above.

Example

// 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 :(
  }
}

Notes

The droid's current order can be determined from it's .order property. For more 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.

See also