- Joined
- Nov 25, 2008
- Messages
- 1,309
JASS:
GetRectMinX()
GetRectMaxX()
GetRectMinY()
GetRectMaxY()
GetRectMinX()
GetRectMaxX()
GetRectMinY()
GetRectMaxY()
GetWorldBounds()
) because Playable Map Area is smaller by the size of the unpathable area around the map(the map boundaries)GetWorldBounds()
it creates entirly new Rect, so you should store it in global variable when you init the map so you only create it once.globals
constant rect World =Rect(-2048.0,-2048.0,2048.0,2048.0)
constant real MinX =GetRectMinX(World)
constant real MinY =GetRectMinY(World)
constant real MaxX =GetRectMaxX(World)
constant real MaxY =GetRectMaxY(World)
constant real CenterX =GetRectCenterX(World)
constant real CenterY =GetRectCenterY(World)
constant real Width =MaxX-MinX
constant real Height =MaxY-MinY
region WorldRegion =null
endglobals
main
I set up WorldRegion and add unit entered events with it and so on. The no was two fold; no to using GetWorldBounds or "Playable Map Area" and also no to the fact that my globals block crashes anything.globals
constant rect World =Rect(-2048.0,-2048.0,2048.0,2048.0)
constant rect World2 =Rect(-1024.0,-1024.0,1024.0,1024.0)
endglobals
function Test takes nothing returns nothing
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"----")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Min X (-1024): "+I2S(R2I(GetRectMinX(World2)))+".")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Min Y (-1024): "+I2S(R2I(GetRectMinY(World2)))+".")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Max X ( 1024): "+I2S(R2I(GetRectMaxX(World2)))+".")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Max Y ( 1024): "+I2S(R2I(GetRectMaxY(World2)))+".")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"----")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Min X (-2048): "+I2S(R2I(GetRectMinX(World)))+".")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Min Y (-2048): "+I2S(R2I(GetRectMinY(World)))+".")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Max X ( 2048): "+I2S(R2I(GetRectMaxX(World)))+".")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Max Y ( 2048): "+I2S(R2I(GetRectMaxY(World)))+".")
endfunction
Test()
prints out 0 for the expected negative numbers, 1024 for the World2 and 2016 for the World printouts respectively.GetWorldBounds()
, odd Blizzard is odd.function Display takes rect r returns nothing
call BJDebugMsg("Max X: "+R2S(maxx(r))+", Max Y: "+R2S(maxy(r)))
call BJDebugMsg("Min X: "+R2S(minx(r))+", Min Y: "+R2S(miny(r)))
endfunction
function Trig_Melee_Initialization_Actions takes nothing returns nothing
call Display(GetWorldBounds())
set R = Rect(0,0,0,0)
call SetRect(R, -4096.00, -4096.00, 4096.00, 4096.00)
call Display(R)
endfunction
SetRect()
, same issue. Also, what map size did you test it on?