• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Wait in triggers

Status
Not open for further replies.
I thought if u use wait in a trigger it will be interrupted if the trigger runs again, Example:
  • Hero
    • Events
      • Unit - A unit enters Hero selection area <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set Temppoint = (Random point in Spawn area <gen>)
      • Unit - Move (Triggering unit) instantly to Temppoint
      • Custom script: call RemoveLocation (udg_Temppoint)
      • Unit - Add Invulnerable (Neutral) to (Triggering unit)
      • Wait 30.00 game-time seconds
      • Unit - Remove Invulnerable (Neutral) from (Triggering unit)
Does it?
 
Last edited:
Local variables will work fine with waits, as Maker says.

However, if you used something like:
  • Set Unit = (Triggering Unit)
  • Unit - Add Invulnerable (Neutral) to Unit
  • Wait 30.00 game-time seconds
  • Unit - Remove Invulnerable (Neutral) from Unit
Then it will definitely bug out when more than one unit triggers it in a 30 second interval, as it will edit a global variable part way into the actions of the other.
 
Target Unit of Ability Being Cast, Attacking Unit, Killing Unit, Trained Unit etc. Do not work locally.

Essentially, only variations of the Triggering Unit will work locally, where acquiring units other than the triggering will not work.

Eg.
  • Events
    • Unit - A unit dies
  • Conditions
  • Actions
    • Wait 5.00 seconds
    • Unit - Explode (Killing Unit)
Doesn't work if retriggered within 5 seconds, as for this particular trigger, the killing unit is not the triggering unit - and hence the whole local/global thing goes crazy. It often results in the killing unit returning a NULL, and hence no action is taken.

Also, don't use things like Dying Unit, Entering Unit, Training Unit or whatever when Triggering Unit would do just fine.

So yeah, basically I said what Maker said - just trust Triggering Unit, otherwise keep on guard with your waits.
 
It's just baaad. similar to the goto in earlier programming languags :/
Well someone obviously is not a computer programmer.

Goto is still heavilly used as how else does your processor execute code like loops. It is still used in assembly and stuff for micro controlers so do not dis the goto instruction.

Wait (TriggerSleepAction) on the other hand is bad due to its poor ability to keep time. It not only is a lot slower than the specified wait but it gets worse in multiplayer. On top of that if there is any lag or pause in multiplayer the wait delay continues to expire but the game is physically paused.

In the end, use it only when you need some delay but how much does not mater. It is far better and more reliable to use timer objects as their delay is syncronized and accurate.
 
Status
Not open for further replies.
Back
Top