[JASS] Help me please!

Status
Not open for further replies.
Level 8
Joined
Oct 31, 2010
Messages
238
Hey, I was coding my own function when I realize that it failed...

JASS:
private function onInit takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerAddAction( t, function helloworld )
endfunction

Didn't work but when I do this:

JASS:
private function onInit takes nothing returns nothing
    set gg_trg_hello_world = CreateTrigger()
    call TriggerAddAction( gg_trg_hello_world, function helloworld )
endfunction

it works! When I use the trigger name, it works.. And when i use Trigger t it failed... Someone help?
 
The onInit function will run during map initialisation, so you don't need a trigger to run it. Is that what you want the trigger to do, just run at map initialisation? Don't bother with triggers in that case, just do everything you need to do in the onInit function itself.

JASS:
library stuff initializer onInit

private function onInit takes nothing returns nothing
    // Do stuff
endfunction

endlibrary
 
Status
Not open for further replies.
Back
Top