• 🏆 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!

Is it possible that 2 events occur simultaneously?

Status
Not open for further replies.
Level 10
Joined
Apr 9, 2004
Messages
502
I'm wondering if you can have 2 events occur exactly at the same time or if there is always an order?

The reason I ask is because I am using the "variable becomes X" event to handle data and I'm worried if there is anything that could make that event trigger twice at the same time.
 
Level 10
Joined
Apr 9, 2004
Messages
502
Ok, sounds like its not any issue but just to be clear, say I have a trigger that fires when a unit casts an ability and 2 units cast an ability as the same time via two independent triggers. When the ability is cast, it makes a real value turn into, say, 17. When the real becomes 17 is an event that starts another trigger which performs an action and changes the variable back to 0. So in this case, based on what everyone is saying, even if it seems like both would initiate at the same time, there would be 1 that goes and starts the trigger first and runs through all the instantaneous actions before continuing to the second one right?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
"and 2 units cast an ability as the same time"
That is impossible... code-wise.

For example, you order two units to cast an ability.
The game (logically) loops through all selected units and makes them start casting them.

So:
- for each unit in selection ->
---- cast ability X

If you have a trigger that runs when a unit starts casting ability X, that trigger will run during the loop, so:
- for each unit in selection ->
---- cast ability X
---- trigger executed

Code-wise, there is no "at the same time" (even with multithreading).
This indeed does mean that when you want a ton of things to happen (that take a lot of processing time), the game will freeze until all actions are done.
 
Status
Not open for further replies.
Top