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

DORDER_RETREAT

Overview

Instruct a droid to retreat to a pre-defined retreat point. Does not retreat to HQ! Read docs before using!

Availability

Warzone 3.1 Beta 1 and above.

Example

Attack an enemy object
// this will always work (assuming the droid can get to the location):
orderDroidLoc(myDroid,DORDER_RETREAT,startPositions[me].x,startPositions[me].y);
// if it can't get to the location it will stop moving.
 
// this will work only if a special retreat point has been defined (no idea how to do that):
orderDroid(myDroid,DORDER_RETREAT);
// if no retreat point is defined, it will try moving to 0,0 (or possibly just stop moving).

Notes

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

This order likely won't do what you expect it to do. As Per explained, DORDER_RETREAT seems to be mainly used in campaign missions that define a specific retreat point.

Specifically, if you don't specify a location when issuing the DORDER_RETREAT order, Warzone will look to see if there's a pre-defined retreat point. If it finds one, the droid will move towards it. If it doesn't find one, it will try moving to 0,0 which on most maps will be inaccessible so it will stop moving. It appears that in most games the pre-defined retreat point is the player's starting position.

In addition, it looks like DORDER_RETREAT is treated as a "morale failure" state or possibly prevents morale failure from happening.

I suggest you use DORDER_RTB (return to base), DORDER_RTR (return to repair) or DORDER_REARM (return to rearming pad - VTOLs only) instead of DORDER_RETREAT. You could even use DORDER_MOVE in conjunction with your start position.

See also

  • Droids – quick reference of API features relating to droids
  • DORDER_REARM – make a VTOL droid return to a rearming pad
  • DORDER_RTB – make a droid return to base
  • DORDER_RTR – make a droid return to a repair station
  • orderDroidObj() – tell a droid to do something to something