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

Waits - Question

Status
Not open for further replies.
Level 11
Joined
Jan 25, 2009
Messages
572
Hello I'm wondering why the best way is to avoid waits?
I'm wondering this becouse i have made a spell with an wait in and that's cuz i'm so lazy. Cuz if i would not have that wait there and use and timer/periodic instead I would need to trigger 200% more that i've alrdy done. Well anyways i'm just wondering why the waits should be avoided:grin:
+rep for answer as always:wink:
 
Level 11
Joined
Jan 25, 2009
Messages
572
Thanks Pharaoh_, here is my trigger that i used for the spell that i've made.
  • Earth Split
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Earth Split
    • Actions
      • Set ES_Cstr = (Triggering unit)
      • Unit - Pause ES_Cstr
      • Set ES_Point1 = (Position of ES_Cstr)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set ES_AyIndex = (ES_AyIndex + 1)
          • Set ES_Offset = (ES_Offset + 110.00)
          • Set ES_Degrees1 = ((Facing of ES_Cstr) - 270.00)
          • Set ES_Degrees2 = ((Facing of ES_Cstr) - 90.00)
          • Unit - Create 1 Splitted Earth (Model) for (Owner of ES_Cstr) at (ES_Point1 offset by ES_Offset towards ES_Degrees1 degrees) facing ES_Point1
          • Set ES_LCUnit[ES_AyIndex] = (Last created unit)
          • Unit - Add Earth Split to ES_LCUnit[ES_AyIndex]
          • Unit - Set level of Earth Split for ES_LCUnit[ES_AyIndex] to (Level of Earth Split for ES_Cstr)
          • Unit - Add a 8.00 second Generic expiration timer to ES_LCUnit[ES_AyIndex]
          • Set ES_Point2 = (Position of ES_LCUnit[ES_AyIndex])
          • Special Effect - Create a special effect at ES_Point2 using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation (udg_ES_Point2)
          • Set ES_AyIndex = (ES_AyIndex + 1)
          • Unit - Create 1 Splitted Earth (Model) for (Owner of ES_Cstr) at (ES_Point1 offset by ES_Offset towards ES_Degrees2 degrees) facing ES_Point1
          • Set ES_LCUnit[ES_AyIndex] = (Last created unit)
          • Unit - Add Earth Split to ES_LCUnit[ES_AyIndex]
          • Unit - Add a 8.00 second Generic expiration timer to ES_LCUnit[ES_AyIndex]
          • Set ES_Point2 = (Position of ES_LCUnit[ES_AyIndex])
          • Special Effect - Create a special effect at ES_Point2 using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation (udg_ES_Point2)
      • Custom script: call RemoveLocation (udg_ES_Point1)
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to ES_AyIndex, do (Actions)
            • Loop - Actions
              • Animation - Play ES_Cstr's Spell Slam animation
              • Animation - Change ES_Cstr's animation speed to 300.00% of its original speed
              • Set ES_Point3 = (Position of ES_LCUnit[(Integer B)])
              • Set ES_LCUFaceLoc[(Integer B)] = (ES_Point3 offset by 80.00 towards (Facing of ES_Cstr) degrees)
              • Unit - Order ES_LCUnit[(Integer B)] to Orc Tauren Chieftain - Shockwave ES_LCUFaceLoc[(Integer B)]
              • Custom script: call RemoveLocation (udg_ES_Point3)
              • Custom script: call RemoveLocation (udg_ES_LCUFaceLoc[GetForLoopIndexB()])
          • Wait 0.90 seconds
      • Set ES_Offset = 0.00
      • Set ES_Degrees2 = 0.00
      • Set ES_AyIndex = 0
      • Animation - Change ES_Cstr's animation speed to 100.00% of its original speed
      • Unit - Unpause ES_Cstr
EDIT: Pharaoh_ i can't give u +rep cuz i must spreat +rep around some... I'll give it another time.
 
Level 13
Joined
Mar 16, 2008
Messages
941
Waits work properly in loops, there is no real reason why they shouldn't, BUT there can be a conflict with the index of the loop. You might know that globals can be reassigned while "waiting", so the loop gets a new value. If this happens, and two loops use the same index, this will horribly cause bugs since the index will get totaly messed up.
What many people mix up is, that waits don't work in "picks", so unit loops, they simply don't work there and cause the rest of the thread to stop.
 
Level 11
Joined
Jan 25, 2009
Messages
572
Waits work properly in loops, there is no real reason why they shouldn't, BUT there can be a conflict with the index of the loop. You might know that globals can be reassigned while "waiting", so the loop gets a new value. If this happens, and two loops use the same index, this will horribly cause bugs since the index will get totaly messed up.
What many people mix up is, that waits don't work in "picks", so unit loops, they simply don't work there and cause the rest of the thread to stop.

Well i've cast the spell like 20 times and there haven't been any problem at all.
Then, should i still use hash and a timer for it?
 
Level 13
Joined
Mar 16, 2008
Messages
941
Then you're lucky, since this realy should bug, example:
You got two spells, both use "IntegerA" as their index in a waiting loop.
First spell starts, Integer A is set to 1 and the loop starts, waits.
Now the second spell starts, Integer A is again set to 1 and nothing changed, it waits.
First spell wait is over, IntegerA set to 2 (increased by 1) and the spell waits again.
Second spell wait is over, IntegerA is set to 3 (increased by 1, should be set to 2!) and the bugging could start, depending on what you do.
 
Level 11
Joined
Jan 25, 2009
Messages
572
Then you're lucky, since this realy should bug, example:
You got two spells, both use "IntegerA" as their index in a waiting loop.
First spell starts, Integer A is set to 1 and the loop starts, waits.
Now the second spell starts, Integer A is again set to 1 and nothing changed, it waits.
First spell wait is over, IntegerA set to 2 (increased by 1) and the spell waits again.
Second spell wait is over, IntegerA is set to 3 (increased by 1, should be set to 2!) and the bugging could start, depending on what you do.

I see. Need to fix that when i have some time over :p
 
Status
Not open for further replies.
Top