• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Global Regions

Status
Not open for further replies.
Level 12
Joined
Apr 27, 2008
Messages
1,228
I tried adding rects to global regions and wc3 crashed every time that was done.
(yes I am sure it was from adding a rect to a global region)
I wonder if this is normal and/or is there a way to avoid the crash while using a global region?
P.s. My region is defined in a globals vJass block.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
You assume correct.
The code is not specific, but here is an example:
JASS:
globals
    region r=CreateRegion()
endglobals
function something takes nothing returns nothing
    call RegionAddRect(r, gg_rct_rect000)
endfunction
I just wonder :)
This is easily avoidable(in my case).
But it would be good if I and anyone who saw this thread knew whether this causes problems.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Lol...
You seem to have very limited knowledge of vJass(if any).
gg_rct_rect000 is a rect created in the WE(main window; Somehow I thought that would be clear to anyone who has used rects created that way).
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Lol...
You seem to have very limited knowledge of vJass(if any).
gg_rct_rect000 is a rect created in the WE(main window; Somehow I thought that would be clear to anyone who has used rects created that way).

i had already with vJass a bug save compilation so it's not very funny xD

Oh and maybe you can't use the native CreateRegion() directly with declare the variable.
I know you can't do it for all natives functions but dunno which ones exactly.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
That may be so, but game crashes when I add the rect - if I do not add it, game does not crash.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
But maybe the region is still not created.

Did you try that :

JASS:
library MyLibrary initializer init

   globals
       region R
   endglobals

   public function init takes nothing returns nothing
      set R= CreateRegion()
   endfunction

endlibrary

function something takes nothing returns nothing
    call RegionAddRect(R, gg_rct_rect000)
endfunction
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Troll-Brain is on the same track, it is crashing when initializing a rect or a region the same time you create the global.(the rect was added for info, since that thing happend me once).

Thus, I found this to work.
JASS:
globals
    region r
endglobals

function test takes nothing returns nothing
    set r = CreateRegion()
    call RegionAddRect(r, gg_rct_rect000)
endfunction
Its kind of the same as Troll-Brain did ._. I noticed that after, sorry for that
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
So it's because you can't use the native CreateRegion and Rect the same time you create the variable.
If you really want to know why, ask blizzard.

Personally i avoid using natives in a declaration of a global variable.
I know it works for CreateTimer and CreateTrigger, but i don't want test the other natives, so i always use an initializer function.
 
Status
Not open for further replies.
Top