• 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.

Multiple Trigger Creation

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
How can I have a single trigger in the list to the left, but handle several different triggers?

Lets say I have an ability with a periodic loop, and a drop item actions and acquire item actions and other stuff. Do i need one trigger for each event, or can I mix all the triggers script into a single one? I tried with local triggers and global triggers but none worked. I had to actually create the 4 triggers so they appear on the list as gg_trg_triggername :(
 
u can do this but u need to determine which trigger has fired. if the events are related like seperate chat events u can put them in the same trigger then sort out the entered string.
If u have a multiple region event u can see which region was the triggering region. note u need globals for triggers if u plan on finding out which trigger fired. or global regions if checking which region fired the event and so on.

it would help if u try to say more on what ur trying to do. also is this in jass or GUI ?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
It's JASS.

JASS:
globals
    trigger Trigger1 = CreateTrigger()
    trigger Trigger2 = CreateTrigger()
    trigger Trigger3 = CreateTrigger()
endglobals
//========================================
function Init_Trig_ThisTrig takes nothing returns nothing
call TriggertAddEvent(Trigger1)
call TriggerAddAction(Trigger1)
call TriggerAddCondition(Trigger1)

call TriggertAddEvent(Trigger2)
call TriggerAddAction(Trigger2)
call TriggerAddCondition(Trigger2)

call TriggertAddEvent(Trigger3)
call TriggerAddAction(Trigger3)
call TriggerAddCondition(Trigger3)
endfunction
 
that will work when u fill in the info completely. if the trigger stays on the whole time and calls a different function then u dont need the global triggers. also u should just use a timer rather than a trigger for time periods.

u should also not use triggeraddaction. it is bad to use.

u can check out some of my jass systems. they have multiple triggers in them.
the newest 2 gold / lumber banking and the gold / lumber give systems both have multiple triggers i added like what u r doing.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I know dimf... we've talked about this several times :p My doubt is not about the efficiency, i'm obviously doing this as reference.

I tested before and doesn't work when i add the events and stuff.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I don't have it, i just remembered it. I had to create the triggers and use gg_trg_triggerName to make them work. I couldn't handle them with locals nor global triggers in the same script :/
 
Status
Not open for further replies.
Top