UnitsMove¶
Ask owned units to move to a map position.
UnitsMove(units, position, append?) · UnitsMoveTracked(units, position, append?)
Inputs: units is one owned Object or a dense array. position is
Vector2(x, y) or { x = x, y = y }; adjacent x, y numbers also work.
Optional append is a boolean: true adds to existing game orders; omitted or
false gives an immediate order.
Output: UnitsMove returns true for queue admission, otherwise false.
UnitsMoveTracked returns accepted, receipt. Neither confirms arrival.
Errors: Wrong argument types, including a non-boolean append, raise a Lua
argument error. Invalid actors, non-finite coordinates, unavailable native layout,
or an inactive session can reject admission. A tracked receipt reports the specific
rejection reason, including failures after admission.
Example:
local player = GetAssignedPlayer()
local selected = player and player:GetSelectedObject()
if selected then
local accepted = UnitsMove(selected, Vector2(42, 42))
if not accepted then LogWarn("Move request was not queued") end
end
See Append movement orders for game-order queue behavior. Read fresh unit positions later to confirm movement.