User Tools

Site Tools


4rpl:commands:movetowardscellandavoid

This is an old revision of the document!


Index

MoveTowardsCellAndAvoid

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

Description

Takes a starting 3D position (a vector) and generates a new 3D position that is moved towards the target map integer coordinates. The resulting point will not be displaced more than the delta argument. The minHeight argument restricts how close, height wise, the resulting point can be to the terrain and/or creeper. The checkRange argument is an integer that specifies how many cells outward to inspect when inforcing the minHeight. A value of 0 means to only check the map cell that the target lands on. The checkCreeper argument is a boolean indicating whether to look at creeper for enforing the minHeight. The checkAC argument is a boolean indicating whether to look at anticreeper for enforing the minHeight. The checkPseudoTerrain argument is a boolean indicating whether to look at invisible pseudo terrain (like a shield creates) for enforcing the minHeight

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

4rpl/commands/movetowardscellandavoid.1611347875.txt.gz · Last modified: 2025/02/14 14:56 (external edit)