Index

MoveTowardsCellAndAvoid

MoveTowardsCellAndAvoid(<-start <-targetCellX <-targetcellZ <-delta <-minHeight <-checkRange <-checkCreeper <-checkAC <-checkPseudoTerrain) ->pos

Description

Takes a starting 3D position (a 3-vector) and generates a new 3D position using two variables for the X and Z coordinates that can be used by SetUnitPosition to move towards the target location. The resulting point will not be displaced more than the delta argument.

:NOTE:
To clarify, the only difference in this API and MoveTowardsAndAvoid is that you can independently specify an X coordinate variable and an Z coordinate variable while not needing a Y coordinate variable. The generated next position will not be limited to the X and Z axis unlike how other TowardsCell API's like RotateUnitTowardsCell tend to behave.
So be sure to avoid thinking of this API as being similar in behavior to the other TowardsCell API's or it will get very confusing very quickly.
If you came to this API thinking it could generate a next position on only the X-Z axis's, a way to do so is to take the resulting V3 and set the Y-vector to the unit's Y-position.

Examples

#Move a unit towards a destination and crawl over creeper, anticreeper, and shields
42 ->targetX
23 ->targetZ
0.1 ->speed
1 ->minHeight
SetUnitPosition(self MoveTowardsCellAndAvoid(GetUnitPosition(self) <-targetX <-targetZ <-speed <-minHeight 1 true true true))

Index