• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

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 :(
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
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
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
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