Movement and orders¶
Move units, choose targets, patrol, attack ground, and append orders.
Find a movement command¶
| Task | Call |
|---|---|
| Move or stop | UnitsMove, UnitsStop |
| Act on an object | UnitsTargetObject, DropResources, SetUnitStanceFollow, SetUnitStanceGuard |
| Patrol or attack-move | SetUnitStancePatrol, SetUnitStanceAttackMove, UnitsPatrolRoute, UnitsAttackMoveRoute, UnitsAttackGround |
| Scout or shelter | SetUnitStanceAutoScout, EnableScouting, SetUnitStanceSeekShelter, SetUnitStanceGarrison, SetUnitStanceUngarrison, GatherInside |
| Combat configuration | SetUnitCombatStance, SetUnitFormation |
Each ordinary call linked below returns true only for queue admission. A listed
Tracked form takes the same arguments and returns accepted, receipt for
later transport evidence. See Command receipts for cleanup
and the extra tracked group-validation rules.
Safe order pattern¶
Read fresh objects when your script's action triggers, make one bounded request, and check game state later.
function MoveSelectedToPoint()
local player = GetAssignedPlayer()
local selected = player and player:GetSelectedObject()
if selected == nil or selected:IsAlive() ~= true then
return false
end
return UnitsMove(selected, Vector2(42, 42))
end
Call this from a deliberate script action. Use Write reliable scripts before you automate repeated commands.
Append movement orders¶
UnitsMove(units, position, true) and UnitsMoveTracked(units, position, true)
set the native movement queue flag. This requests insertion at the end of the
units' native orders, preserving earlier orders. Omit the third argument, pass
nil, or pass false for the existing immediate-order behavior. Other third
argument types raise an argument error. The existing numeric-coordinate form
is also supported: UnitsMove(units, x, y, append?).
This is the game's order queue, distinct from the API's deferred submission queue. The existing session, actor and human-override safeguards still apply before submission. A submitted receipt does not prove that movement started, finished or reached the destination. Native unit eligibility and pathfinding still apply. This option currently applies to movement; other command families do not acquire append behavior implicitly.
Append an object-target order¶
UnitsTargetObject(units, target, true) and its tracked variant accept the same
optional boolean append flag as movement. Omitted, nil or false preserves the
existing immediate behavior. The game chooses the default action from the actors
and target, such as attacking or gathering; this is not an explicit action-type
selector. Native action eligibility still applies.
The deferred command retains the target ID and re-resolves its live position
before submission. A missing target rejects with invalid-target. After
submission, the game's own order lifecycle handles targets that move or disappear.
A submitted receipt does not confirm that the eventual action was performed.
Patrol and attack-move waypoint routes currently submit immediate native orders. Their packet flag is not the movement append flag; passing an extra boolean does not enable queued routes. Follow and guard likewise have no public append option. Use only the documented append parameters on movement and default object-target orders. A multi-waypoint route and appending to an existing order queue are separate capabilities.