How to prevent a unit from going over map boundaries?

Status
Not open for further replies.
Level 6
Joined
Feb 16, 2014
Messages
193
So I'm making this unit move using SetUnitX/Y but whenever the unit goes out of the map boundaries(the black area) then the game suddenly crashes, so how can I *detect* if the unit is going out of map boundaries and teleport the unit away from it ?
 
Be aware that flying units directly at the border of the map have been known to crash even though they are still in map bounds. As such you really need a few tiles boundary around your map on top of the x/y inside map bounds.
In JASS for example you save max/min values of x/y of map bounds,
and then make comparisons if your x/y are in between.
Or why not test if they are inside the playable map area rect? Should work with most maps.
 
Sorry for the late reply xD,
I think I'll try to do it with GUI first, but if I can't then I'll try and use that vJass code PurgeandFire posted :thumbs_up: Thx guys :)
 
Status
Not open for further replies.
Back
Top