[Solved] Map's boundaries

Status
Not open for further replies.
Level 10
Joined
Sep 16, 2016
Messages
269
Hi guys, I'm kind of confused about GetWorldBounds(), bj_mapInitialPlayableArea, and bj_mapInitialCameraBounds. What is the different between the 1st and the other 2?

I'm trying to make a short library which contains dummy units within map. I found that some get max/min X/Y from GetWorldBound, but some others get them from GetCameraBound. So what should I pick?
 
Thx guys, somehow I used GetWorldBounds() to get max/min value of X and Y. But the map keep crashing when I cast towards south (270 degree), it didn't happen to the other 3 sides.
  • Set BoundMaxX = ((Max X of (Entire map)) - 500.00)
  • Set BoundMaxY = ((Max Y of (Entire map)) - 500.00)
  • Set BoundMinX = ((Min X of (Entire map)) + 500.00)
  • Set BoundMinY = ((Min Y of (Entire map)) + 500.00)
  • Custom script: set rc=Rect( udg_BoundMinX, udg_BoundMinY, udg_BoundMaxX, udg_BoundMaxY )
 
I keep the unit contained in the map by setting its X/Y when unit leaves region rc. I added 500 offset for safe distance actually, thing works well without that number as well, EXCEPT when I make the dummy go south, game crashes when it hits the southern side of the map.
 
I keep the unit contained in the map by setting its X/Y when unit leaves region rc.
By the time a leave region event fires it is already too late and the game has crashed.

Before moving a unit to a new position you need to test that the destination point is within the playable map area. You also need to make sure that there is a multi tile non-playable boarder around the edge of the map so that as little as possible interacts with the direct map edge.

Something as simple as flying units directly against the map edge has been known to cause a crash.
 
Status
Not open for further replies.
Back
Top