• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Alternating between 2 Timers

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
Hello Hive,

in my map I wanted to integrate 2 timers which alternate between one another.

1. So basically: The first timer counts towards the activation of the altar

  • Timer Altar Activation
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start Timer_Activation as a One-shot timer that will expire in 15.00 seconds
      • Countdown Timer - Create a timer window for Timer_Activation with title Altar Activation
      • Set VariableSet Timer_Activation_Window = (Last created timer window)
      • Countdown Timer - Show Timer_Activation_Window
2. Then: After it expires, the second timer is startet to count how long the altar will be active

  • Timer Activation Turn On
    • Events
      • Time - Timer_Altar_Active expires
    • Conditions
    • Actions
      • Countdown Timer - Pause Timer_Altar_Active
      • Countdown Timer - Resume Timer_Activation
3. After this timer runs out the altar will turn dorment again and the first timer starts again(supposedly starting a loop)

  • Timer Activation Turn On
    • Events
      • Time - Timer_Altar_Active expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy Timer_Altar_Sacrifice_Window
      • Trigger - Turn off Timer Altar Active <gen>
      • Trigger - Turn on Timer Altar Activation <gen>
Unfortunately my triggers don't work as intended, after the second one expires it just starts over again and again and ignores step 3. and 1.

Maybe somebody can tell me what I did wrong and help out.

Kind regards,
Mechcash

Edit: I tried another method using the pause-action

  • Timer Altar Activation
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start Timer_Activation as a One-shot timer that will expire in 15.00 seconds
      • Countdown Timer - Create a timer window for Timer_Activation with title Altar Activation
      • Set VariableSet Timer_Activation_Window = (Last created timer window)
  • Timer Altar Active
    • Events
      • Time - Timer_Activation expires
    • Conditions
    • Actions
      • Countdown Timer - Pause Timer_Activation
      • Countdown Timer - Destroy Timer_Activation_Window
      • Countdown Timer - Start Timer_Altar_Active as a One-shot timer that will expire in 18.00 seconds
      • Countdown Timer - Create a timer window for Timer_Altar_Active with title Altar Sacrifice
      • Set VariableSet Timer_Altar_Sacrifice_Window = (Last created timer window
  • Timer Activation Turn On
    • Events
      • Time - Timer_Altar_Active expires
    • Conditions
    • Actions
      • Countdown Timer - Pause Timer_Altar_Active
      • Countdown Timer - Destroy Timer_Altar_Sacrifice_Window
      • Countdown Timer - Start Timer_Activation as a One-shot timer that will expire in 15.00 seconds
      • Countdown Timer - Create a timer window for Timer_Activation with title Altar Activation
      • Set VariableSet Timer_Activation_Window = (Last created timer window)
...it now works as intended, but can somebody tell me if it leaks or leads to other problems, the way I did it :)?
 
Last edited:

Uncle

Warcraft Moderator
Level 68
Joined
Aug 10, 2018
Messages
7,153
You don't need to Pause One-shot timers after they've expired. Pause is used to stop a timer that's still running, but in this case your timers have already finished when you're trying to Pause them.

Also, and this is totally optional, you could use 1 Timer to handle both of these things. Something like this:
  • Timer Activation
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set VariableSet Altar_Active = False
      • Countdown Timer - Start Altar_Timer as a One-shot timer that will expire in 15.00 seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Altar Activation
      • Set VariableSet Altar_Window = (Last created timer window)
  • Timer Expires
    • Events
      • Time - Altar_Timer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Altar_Active Equal to False
        • Then - Actions
          • Set VariableSet Altar_Active = True
          • Countdown Timer - Start Altar_Timer as a One-shot timer that will expire in 18.00 seconds
          • Countdown Timer - Change the title of Altar_Window to Altar Sacrifice
        • Else - Actions
          • Set VariableSet Altar_Active = False
          • Countdown Timer - Start Altar_Timer as a One-shot timer that will expire in 15.00 seconds
          • Countdown Timer - Change the title of Altar_Window to Altar Activation
 
Level 24
Joined
Jun 26, 2020
Messages
1,884
Question:
Do you know what means
  • Time - Elapsed game time is 0.10 seconds
If you think is "Every 0.10 seconds" so its not, this is when the game time reaches 0.10 seconds, so that will happen once at the begging of the game.
You may indeed know it and that I have not understood what you want, I just want to be sure.
 
Level 7
Joined
May 30, 2018
Messages
290
You don't need to Pause One-shot timers after they've expired. Pause is used to stop a timer that's still running, but in this case your timers have already finished when you're trying to Pause them.

Also, and this is totally optional, you could use 1 Timer to handle both of these things. Something like this:
  • Timer Activation
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set VariableSet Altar_Active = False
      • Countdown Timer - Start Altar_Timer as a One-shot timer that will expire in 15.00 seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Altar Activation
      • Set VariableSet Altar_Window = (Last created timer window)
  • Timer Expires
    • Events
      • Time - Altar_Timer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Altar_Active Equal to False
        • Then - Actions
          • Set VariableSet Altar_Active = True
          • Countdown Timer - Start Altar_Timer as a One-shot timer that will expire in 18.00 seconds
          • Countdown Timer - Change the title of Altar_Window to Altar Sacrifice
        • Else - Actions
          • Set VariableSet Altar_Active = False
          • Countdown Timer - Start Altar_Timer as a One-shot timer that will expire in 15.00 seconds
          • Countdown Timer - Change the title of Altar_Window to Altar Activation

Thanks, that's exactly what I was looking for ! repreprep
 
Status
Not open for further replies.
Top