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

What is the trigger execute order in Warcraft 3?

Status
Not open for further replies.

SpasMaster

Hosted Project: SC
Level 24
Joined
Jan 29, 2010
Messages
1,994
Simple question: In what order are triggers with the same event executed?
I made a test map where trigger 1 displays the number "3" when the message "a" is written.
A second trigger with the same event displays the number "4".
The ordering of the triggers in the side bar does not seem to impact which one executes first.
So how does it work and can it be adjusted?
 
Level 11
Joined
May 16, 2016
Messages
730
Simple question: In what order are triggers with the same event executed?
I made a test map where trigger 1 displays the number "3" when the message "a" is written.
A second trigger with the same event displays the number "4".
The ordering of the triggers in the side bar does not seem to impact which one executes first.
So how does it work and can it be adjusted?
I never thought about that, but I think it also depends on trigger position in the trigger editor. trigger on higher position is engaged first.
 
Level 11
Joined
May 16, 2016
Messages
730
"The ordering of the triggers in the side bar does not seem to impact which one executes first."
Looks like I found that is a problem. The first engaged trigger is a trigger which was created first. I checked here I created trig1 (1) then trig2 (2) then trig3 (3). Results: 123
Then I deleted all and made again, but trig1 (3) trig2 (1) trig3(2)
ResultsL 321
So trigger priority depends on what is trigger was created first.
 

Attachments

  • Check Trigger Queue.w3x
    12 KB · Views: 133
Level 24
Joined
Aug 1, 2013
Messages
4,658
Trigger executions with identical events run in the same order as they are added as listener to the event.
In simple terms, the trigger that is created first is executed first.
GUI Trigger creation in the world editor seems to register itself at the end of the trigger queue.
So, when you create a new trigger with an event that another trigger also has, the newly created trigger will run later.
However, iirc, when closing and re-opening the map, the triggers will re-register themselves in the order in which they are in the trigger list (the tree view at the left).

So, in the end, it is unreliable to trust on a certain order of execution.
If you have two triggers with identical events and you really want them to execute in a certain order, then you might want to merge them to one trigger.
If either of the triggers has conditions, you would have to copy and paste them over to an if statement instead.
 
Status
Not open for further replies.
Top