• 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.

[Solved] Events during a countdown.

Level 4
Joined
Dec 12, 2018
Messages
35
So, a pretty simple question. Is there any way to set a trigger to activate at a certain point during a countdown?

For example, if I've got a timer set to 300 seconds, can I set a trigger to do the thing when the countdown reaches 120? Do I need to set another timer with its own countdown separately to trigger the condition?
 
Level 30
Joined
Aug 29, 2012
Messages
1,385
I think you can use this function

1721059844653.png


And do something like this

  • Wait until ((Elapsed time for MyTimer) Greater than or equal to 180.00), checking every 1.00 seconds
Might not be 100% perfectly accurate but that'll save you the hassle of having several timers
 
Level 4
Joined
Dec 12, 2018
Messages
35
Ah, sadly it seems that Event check is not avaible for my version (I'm still using the 1.31, not Reforged). But thanks.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Ah, sadly it seems that Event check is not avaible for my version (I'm still using the 1.31, not Reforged). But thanks.
It's definitely available on 1.31, perhaps you're looking in the wrong location.

Anyway, an alternative solution would be to use a Repeating timer that runs once per second. Then simply track the elapsed time in a variable like so:
  • Actions
    • Set Variable YourTimerDuration = 0
    • Countdown Timer - Start YourTimer as a Repeating timer that will expire in 1.00 seconds
  • Events
    • Countdown Timer - YourTimer expires
  • Conditions
  • Actions
    • Set Variable YourTimerDuration = (YourTimerDuration + 1)
    • If all conditions are true then do (Actions)
      • If - Conditions
        • YourTimerDuration Equal to 120
      • Then - Actions
        • -------- It's been 120.00 seconds --------
      • Else - Actions
    • If all conditions are true then do (Actions)
      • If - Conditions
        • YourTimerDuration Equal to 300
      • Then - Actions
        • -------- It's been 300.00 seconds --------
        • Countdown Timer - Pause YourTimer
      • Else - Actions
I used an Integer variable to track the elapsed time since you'll want exact precision when comparing values. This is needed due to floating point precision error. This concern is mostly a problem when using Arithmetic like I am in my second trigger as that's when precision can get lost.

An upside of this solution is that you get exact time precision. This is because Waits are imprecise and need to be synced when playing online. A downside is that you lose the functionality of a Countdown Timer Window.

For efficiency purposes you may be able to increase the Interval of the Repeating timer. For example, in this case you could use an Interval of 60.00 seconds since 60 is a multiple of 120 and 300. However, if you then wanted to check if 145.00 seconds has passed you would run into issues since that value will get skipped. In that case an interval of 3 would work nicely since it's a multiple of all three numbers. Hopefully this makes sense.
 
Last edited:
Top