Other great resources: Official JS API docs, Scripting Forum
DORDER_HELPBUILD
Overview
Instruct a construction droid to help with an existing structure building site.Availability
Warzone 3.1 Beta 1 and above.
Example
// function that will identify part-built structures: var toPartiallyBuilt = function(struct) { return struct.status == BEING_BUILT; } Â // function that will find free trucks: var busyOrders = [ DORDER_BUILD, // building DORDER_HELPBUILD, // building DORDER_LINEBUILD, // building DORDER_DEMOLISH, // demolishing DORDER_REPAIR, // repairing a building DORDER_RTR, // getting repaired DORDER_RECYCLE, // getting recycled (not sure about this one) DORDER_SCOUT // scouting ]; var toFreeTrucks = function(droid) { var order = droid.order; return !busyOrders.some( function(busy) {return order==busy;} ); } // get list of part-built structures: var buildingSites = enumStruct().filter(toPartiallyBuilt); Â // get list of free builders: var freeBuilders = enumDroid(me,DROID_CONSTRUCT).filter(toFreeTrucks); // Note: Should probably check that there are buildingSites before doing a costly enumDroid() Â // get our free builders to help out where needed: if (buildingSites.length && freeBuilders.length) { buildingSites.forEach( function(site) { if (freeBuilders.length) orderDroidObj(freeBuilders.shift(),DORDER_HELPBUILD,site); } ) }
Notes
The droid's current order can be determined from it's .order
 property. For more information see Droid object.
There's currently no easy way to determine how many builders are helping at a building site. A side effect of this is that you can end up with way too many construction droids working on one site.
See also
- BEING_BUILT – structures being built
- BUILT – structures that are fully built
- BEING_DEMOLISHED – structures being demolished
- DORDER_BUILD – used with orderDroidBiuld()
- DORDER_LINEBUILD – indicates a droid is building a row of structures
- Droids – quick reference of all JS API features relating to droids
- Droid object – describes a droid object
- orderDroidBuild() – make a droid build a somewhere
- orderDroidObj() – tell a droid to do something with something
- Structure object – describes a structure object