• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] Run at map initialization

Status
Not open for further replies.
Level 17
Joined
Feb 11, 2011
Messages
1,860
I know about initializers. I used this: library MapSetup initializer InitTrigger. However, it didn't seem to run correctly. The InitTrigger function:
JASS:
private function InitTrigger takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerAddAction(function Actions)
    set t = null
endfunction
I left out RegisterEvent... because if you convert the GUI "Map initialization" event to JASS, there is also no RegisterEvent.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
You are creating a trigger without any event, if the function Actions is meant to be started on map init, just cut/paste the code in the initializer, or eventually call the function Actions, depends what you want to do with it later.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
JASS:
private function InitTrigger takes nothing returns nothing
    // your code here
    // if the code in Actions is meant to be executed only on map init, you don't need a trigger, forget you GUI habits
endfunction

Also your initalizer should be renamed for something like "init", something that will makes more sense.
 
Status
Not open for further replies.
Top