• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger threads

Status
Not open for further replies.
Level 4
Joined
Feb 22, 2012
Messages
74
Does War3 run on a single thread? Meaning nothing ever happens simultaneously?

If I have a trigger that, in the middle of it, does "run trigger, ignore conditions" on another trigger, is the second trigger's actions all executed before the next action in the first trigger?

So the application would be, could I set a global variable in trigger #1, run trigger #2's actions from trigger #1, and use that global in trigger #2 with no concern that it could be overwritten by a third trigger executing between the two triggers, as long as there are no "wait" actions in either one?
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Your assumptions are correct. It's the same for sc2 afaik.

You can open a new thread (mostly to avoid reaching the limit op), but only one thread can run at a time, meaning if you open a new thread, the previous one is halted until the opened thread is not finished (using a wait opens a new thread).
In jass, all functions which take a code or a boolexpr argument open a new thread each time they are called.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Yes.

But always care about recursivity, (an action which fire an event registred)

Usually it can be fixed by :

JASS:
call DisableTrigger(GetTriggeringTrigger())
// your action
call EnableTrigger(GetTriggeringTrigger())

Because most of jass natives functions are "instant".
 
Status
Not open for further replies.
Top