HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Map Initialization Event fires this trigger?

02-25-2004, 08:26 PM#1
poolage
While exploring the secrets of JASS and misteries of the WE, I crashed with my head into a wall of stone:

Trigger 'c' does not run on Map Initialization:
Code:
 
function Trig_c_Actions takes nothing returns nothing
    call TriggerSleepAction( 0.50 )
    call ConditionalTriggerExecute( gg_trg_e )
endfunction

//===========================================================================
function InitTrig_c takes nothing returns nothing
    set gg_trg_c = CreateTrigger(  )
    call TriggerAddAction( gg_trg_c, function Trig_c_Actions )
endfunction
while Trigger 'b' does.

Code:
function Trig_b_Actions takes nothing returns nothing
    call TriggerSleepAction( 0.50 )
    call ConditionalTriggerExecute( gg_trg_d )
endfunction

//===========================================================================
function InitTrig_b takes nothing returns nothing
    set gg_trg_b = CreateTrigger(  )
    call TriggerAddAction( gg_trg_b, function Trig_b_Actions )
endfunction

Can some tell me the difference?

I converted both triggers from the GUI, and indeed, trigger b did have the map initialization event. However after convertion into JASS, I can't see any....
02-25-2004, 08:42 PM#2
weaaddar
When converted to Custom Text Check the two checkboxs they now changed one of them should say Run At map initalization. Select that box if you want.

However a real more useful trick is this one Don't make a trigger!:
Code:
function InitTrig_c takes nothing returns nothing
    call TriggerSleepAction( 0.50 )
    call ConditionalTriggerExecute( gg_trg_e )
endfunction
Will run that same code only without being a trigger.
02-25-2004, 08:47 PM#3
poolage
0_o wooot, thx for the tips!

So that's all about the mistery...I should pay more attention to little, sneaky checkboxes!
02-25-2004, 10:47 PM#4
AIAndy
Weaaddar, I don't think it is a good idea to put a wait in an InitTrig function.
02-25-2004, 11:30 PM#5
weaaddar
Well actually your right it'll kill the thread. As the initalization thread is not a trigger. And TriggerSleepAction only works in triggers.
But anyway its stupid to use A sleep action at map init as it only slows loading time of the map. I just was taking the code he placed as an example.
02-26-2004, 01:40 AM#6
poolage
Please, dont be so harsh on the sleepaction; It was just there to let me display if the trigger was fired in Game Initialization.
This shameful thread of mine is anyway rediculous from top to toe, and I wish it was deleted.:////
02-27-2004, 12:44 AM#7
dataangel
The reason you don't observe a difference is because the map initilization event is not really an event. It inserts a call to run the trigger when the map loads in a part of the script file you can't see unless you export your script.