Other great resources: Official JS API docs, Scripting Forum
DORDER_RECOVER
- Aubergine
Example
if (someDroid.order == DORDER_RECOVER) { // it's picking up an artefact or oil barrel } // get one of my droids to pick something up orderDroidObj(myDroid, DORDER_RECOVER, itemObj);
Notes
Recoverable items are always FEATURE obejcts and are always owned by player 21.
The droid's current order can be determined from it's .order
property. For more infomration see Droid object.
It's not possible (by design) for AI players to pick up items by moving on to a tile that contains one. The droid has to be specifically ordered to pick up the item using DORDER_RECOVER.
Droids owned by human players will automatically pick up items when they are within 1.5 tiles of the item, regardless of their current order or action. Their droid's order will only be set to DORDER_RECOVER if the human player has specifically told a droid to pick something up.
How do I know it's been recovered?
When an item is picked up, eventDestroyed() will be triggered (but the object's .player property will always == me, regardless of which player picked it up). See Enhanced SitRep Mod for an example of taking advantage of this effect.
Warzone 3.2 adds eventPickup() which is triggered as soon as your droid has picked something up. A backport is available that adds this event to the 3.1 branch.
In all versions, the droid will become idle after picking something up, causing eventDroidIdle() to be triggered. However, if a human player has queued additional actions, their droid will do those actions first before it is considered "idle".
The sequence of events, where applicable, is: eventDestroyed(feature) → eventPickup(feature,droid) → eventDroidIdle(droid). need to double check this
Availability
This constant will hopefully be implemented in the Warzone 3.1 branch.
It's definitely in the Warzone 3.2 branch.
Backport the constant using backport.dorder.js.
Note:
The JS API will ignore the order if given to an AI droid prior to version 3.1 Beta 5.
See also
Related articles:
- Droids – quick reference of API features relating to droids
- enumFeature() – get a list of features (trees, barrels, artefacts, etc.) on the map
- eventPickup() – triggered when you pick up an item.
- Features – quick reference of API features relating to... features.