User Tools

Site Tools


4rpl:commands:getunitposition

This is an old revision of the document!


Index

GetUnitPosition

GetUnitPosition(<-UID) ->pos

Description

Get the 3D position of a unit. A vector is returned. The X and Z positions are where on the map the unit is, and the Y coordinate is the height, or elevation, of the unit.

Note: If this call is attempted on an non-existing unit, nothing will be put on the stack.

Examples

GetUnitPosition(<-UID) ->pos

A “safe” method to use this function and to handle the lack of a return value on non-existent units Are as follows:

	Trace (@UnitPos(7) )
 
:unitPos
	StackSize ->stackSize   # be careful that this variable is not used in other code. 
	GetUnitPosition
	If (Stacksize <-stackSize EQ)
		Return
	else
		V3(-1 -1 -1)
	endif

Index

4rpl/commands/getunitposition.1655821156.txt.gz · Last modified: 2022/06/21 10:19 by Karsten75