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

When to use Timers instead of Waits?

Status
Not open for further replies.
Level 8
Joined
Feb 17, 2007
Messages
368
Like for example, would it be worth it in this trigger?:

  • Actions
    • Set CellCamera = (Center of Region 018 <gen>)
    • Camera - Set the camera bounds for (Owner of (Entering unit)) to Region 000 <gen>
    • Camera - Pan camera for (Owner of (Entering unit)) to CellCamera over 0.00 seconds
    • Custom script: call RemoveLocation (udg_CellCamera)
    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Entering unit)) emitting Visibility across Region 000 <gen>
    • Wait 3.50 seconds
    • Unit - Unpause Cell
    • Unit - Make Cell Vulnerable
    • Unit Group - Pick every unit in Hero_Selected_Unit_Group and do (Unit - Unpause (Picked unit))
    • Trigger - Turn on Cell 1stForm Float Txt <gen>
    • Trigger - Turn on CellSkill1 <gen>
    • Trigger - Turn on Cell Mana Gain <gen>

Or this one?:

  • Actions
    • Trigger - Turn off CellSkill1 <gen>
    • Trigger - Turn on UltiSound <gen>
    • Unit - Pause Cell
    • Unit - Make Cell Invulnerable
    • Special Effect - Create a special effect attached to the origin of Cell using war3mapImported\GaiaShield.mdx
    • Set CellUlt[1] = (Last created special effect)
    • Set Cell1stFormFloatText = (Position of Cell)
    • Floating Text - Create floating text that reads |cff000000**|r|cff0... at Cell1stFormFloatText with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • Floating Text - Change (Last created floating text): Disable permanence
    • Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
    • Floating Text - Change the fading age of (Last created floating text) to ulttimer seconds
    • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
    • Custom script: call RemoveLocation (udg_Cell1stFormFloatText)
    • Wait ulttimer seconds
    • Set CellUltCenter = (Center of Region 031 <gen>)
    • Unit - Move Cell instantly to CellUltCenter
    • Custom script: call RemoveLocation (udg_CellUltCenter)
    • Trigger - Turn off UltiSound <gen>
    • Unit - Set mana of Cell to 0.00
    • Game - Set the time of day to 22.00
    • Special Effect - Destroy CellUlt[1]
    • Set TopLeftCellSpot = (Center of top left cell <gen>)
    • Set BotRightCellSpot = (Center of bot right cell <gen>)
    • Unit - Create 1 Cell Jr. for Player 12 (Brown) at TopLeftCellSpot facing 0.00 degrees
    • Set CellJuniors[1] = (Last created unit)
    • Unit - Make CellJuniors[1] Invulnerable
    • Unit - Order CellJuniors[1] to Orc Tauren Chieftain - Shockwave BotRightCellSpot
    • Custom script: call RemoveLocation (udg_TopLeftCellSpot)
    • Custom script: call RemoveLocation (udg_BotRightCellSpot)
    • Wait 2.00 seconds
    • Set TopRightCellSpot = (Center of top right cell <gen>)
    • Set BotLeftCellSpot = (Center of bot left cell <gen>)
    • Unit - Create 1 Cell Jr. for Player 12 (Brown) at TopRightCellSpot facing 270.00 degrees
    • Set CellJuniors[2] = (Last created unit)
    • Unit - Make CellJuniors[2] Invulnerable
    • Unit - Order CellJuniors[2] to Orc Tauren Chieftain - Shockwave BotLeftCellSpot
    • Custom script: call RemoveLocation (udg_TopRightCellSpot)
    • Custom script: call RemoveLocation (udg_BotLeftCellSpot)
    • Wait 2.00 seconds
    • Set BotLeftCellSpot = (Center of bot left cell <gen>)
    • Set TopRightCellSpot = (Center of top right cell <gen>)
    • Unit - Create 1 Cell Jr. for Player 12 (Brown) at BotLeftCellSpot facing 180.00 degrees
    • Set CellJuniors[3] = (Last created unit)
    • Unit - Make CellJuniors[3] Invulnerable
    • Unit - Order CellJuniors[3] to Orc Tauren Chieftain - Shockwave TopRightCellSpot
    • Custom script: call RemoveLocation (udg_BotLeftCellSpot)
    • Custom script: call RemoveLocation (udg_TopRightCellSpot)
    • Wait 2.00 seconds
    • Set BotRightCellSpot = (Center of bot right cell <gen>)
    • Set TopLeftCellSpot = (Center of top left cell <gen>)
    • Unit - Create 1 Cell Jr. for Player 12 (Brown) at BotRightCellSpot facing 90.00 degrees
    • Set CellJuniors[4] = (Last created unit)
    • Unit - Make CellJuniors[4] Invulnerable
    • Unit - Order CellJuniors[4] to Orc Tauren Chieftain - Shockwave TopLeftCellSpot
    • Custom script: call RemoveLocation (udg_BotRightCellSpot)
    • Custom script: call RemoveLocation (udg_TopLeftCellSpot)
    • Wait 2.00 seconds
    • Sound - Play KotoBeastPissed1 <gen>
    • Wait 0.75 seconds
    • Sound - Stop (Last played sound) After fading
    • Set CellUltCenter = (Center of Region 031 <gen>)
    • Unit - Create 1 Cells Ult Explosion for Player 12 (Brown) at CellUltCenter facing 90.00 degrees
    • Custom script: call RemoveLocation (udg_CellUltCenter)
    • Unit - Kill (Last created unit)
    • Wait 2.00 seconds
    • Unit - Kill CellJuniors[1]
    • Unit - Kill CellJuniors[2]
    • Unit - Kill CellJuniors[3]
    • Unit - Kill CellJuniors[4]
    • Unit - Make Cell Vulnerable
    • Unit - Unpause Cell
    • Trigger - Turn on CellSkill1 <gen>
    • Game - Set the time of day to 12.00
Would it make the map noticeably more stable etc? It would just be a lot of work to replace all these waits with timers, as I would need a lot more triggers... I know for spells I need them as I want my spell to be MPI/MUI, but what about a series of actions like these? Btw if anyone notices any leaks here tell me, haha.
 
Level 11
Joined
May 31, 2008
Messages
698
Also, just to add on to that, waits have a minimum time that can be applied. For example, if you do wait 0.01 seconds, it will actually wait about 0.25 or something like that. But timers can work for a small interval like 0.01
 
It depends on the precision you desire. As the duration reaches towards infiniti, the precision desired becomes much more negligible. However, as the duration reaches towards 0, the precision becomes a lot more noticeable.

For example, if you wait 3 seconds, it might wait something around 3.1 or 3.2 seconds instead. It depends on lag as well. (Polled wait leads to more precision against that lag, since it uses a timer with it, but it leaks a handle ID each time it is called) Either way, for small durations less than 1, the difference becomes a bit more noticeable. If it is a single wait, usually it is unnoticeable, but for things such as periodics, timers are best suited for it. =)

In a simple form, if you need it to be accurate and the wait is less than 1, then timers are suggested. If it is about 1 or higher, it is usually okay to use waits, as the difference is usually negligible.

In your case, it should be fine to use those waits.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Or you can use Integer/Real for "countdown"
Do it like this:
  • Example 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set Countdown = 5
      • Trigger - Turn on Example 2 <gen>
  • Example 2
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Countdown Greater than 0
        • Then - Actions
          • Game - Display to (All players) the text: (String(Countdown))
          • Set Countdown = (Countdown - 1)
        • Else - Actions
          • Trigger - Turn off (This trigger)
This 2 trigger is related and will show you the countdown of the numbers down to 0 and will turn off the trigger, by obeying the IF/THEN/ELSE function
 
Status
Not open for further replies.
Top