HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Code doesn't seem to work, unknown reason =/

01-18-2008, 09:09 PM#1
Jitse
It's just a simple trigger initialization code, still it doesn't seem to work. It's a GUI trigger converted to JASS, so I could put it in a loop instead of listing eleven events.

Collapse JASS:
function InitTrig_FinishCreeps takes nothing returns nothing
    local integer i = 0
    local integer max = 11
    set gg_trg_FinishCreeps = CreateTrigger(  )
    loop
        exitwhen i >= max
        call TriggerRegisterEnterRectSimple( gg_trg_FinishCreeps, udg_finishRegions[i] )
        call BJDebugMsg("added point " + I2S(i))
        set i = i + 1
    endloop
    call TriggerAddCondition( gg_trg_FinishCreeps, Condition( function Trig_FinishCreeps_Conditions ) )
    call TriggerAddAction( gg_trg_FinishCreeps, function Trig_FinishCreeps_Actions )
endfunction

I added a debug message, just to check they are actually added, and they are. But still the trigger itself never gets triggered, although its GUI variant does, very weird...

The udg_finishRegions is an array containing the points of the regions. The only difference is that the GUI version still took the middle of the generated region variables itself, while I now stored them in an array at map initialization, so I could use them here more efficiently.

If you want to know, also the condition doesn't get triggered (tested it with a debug message).
01-18-2008, 09:55 PM#2
TaintedReality
Something must be wrong with udg_finishRegions. What do you mean it's an array "containing the points of the regions"? That would mean it's a real variable, but in your code it's a rect.
01-18-2008, 09:58 PM#3
Vexorian
I seriously doubt you are assigning udg_finishRegions[i] before that function is called.
01-19-2008, 06:36 PM#4
Jitse
Srry I meant array of rects, not points. Anyway, you were right. Hehe, internally the array was only initialized after this code. I just manually changed the .j file, it all works good now. ^^

Thanks for the replies. :)