• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

What is the trigger execute order in Warcraft 3?

Status
Not open for further replies.

SpasMaster

Hosted Project: SC
Level 23
Joined
Jan 29, 2010
Messages
1,969
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: 130
Level 24
Joined
Aug 1, 2013
Messages
4,657
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