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

Wait in triggers

Status
Not open for further replies.
Level 9
Joined
Oct 17, 2009
Messages
370
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:
Level 14
Joined
Aug 31, 2009
Messages
775
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.
 
Level 14
Joined
Aug 31, 2009
Messages
775
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.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
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.
Top