Instructions/Distance

From Desynced Wiki
Distance
File:Instructions-Distance.png
Returns distance to a unit
Lua ID get_distance
Category Global
Icon Closest Enemy.png
Argument One: Type Input
Argument One: Name Target
Argument One: Description Target unit
Argument One: Data Type entity
Argument Two: Type Output
Argument Two: Name Distance
Argument Two: Description Unit and its distance in the numerical part of the value
Argument Three: Type Input
Argument Three: Name Unit
Argument Three: Description The unit to measure from (if not self)
Argument Three: Data Type entity


Using the signal register as an input set to an entity in the world and storing the distance value as a variable.

The "Distance" component takes a location based input (unit world location) and stores the distance from the that input to the unit your script is being run on in the result. This can be used identify how far one unit is away from another.