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

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