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

Timer problem

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hello, how can i make this trigger function properly? The problem is that after wave 10, it does not re-create the timer window which i want. Or is there an easier way to make this trigger work?
My idea is just to make the timer longer after wave 10.

  • StartTimer
    • Events
      • Time - Elapsed game time is 0.20 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start SpawnTimer as a Repeating timer that will expire in 90.00 seconds
      • Countdown Timer - Create a timer window for SpawnTimer with title Next wave in:
      • Set VariableSet TimerWindow = (Last created timer window)
      • Countdown Timer - Show TimerWindow
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WaveCount Equal to 10
        • Then - Actions
          • Custom script: call DestroyTimer (udg_SpawnTimer)
          • Countdown Timer - Start SpawnTimer as a Repeating timer that will expire in 150.00 seconds
          • Countdown Timer - Create a timer window for SpawnTimer with title Next wave in:
          • Set VariableSet Timerwindow2 = (Last created timer window)
          • Countdown Timer - Show Timerwindow2
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,368
Don't destroy SpawnTimer and there's no reason to create a new timer window/timer window variable.

So all you need to do when WaveCount is equal to 10 is start the timer as a repeating timer that will expire in 150.00 seconds. That's it.

And if you want to adjust the title of the timer window you can do this:
  • Countdown Timer - Change the title of TimerWindow to blah blah blah
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
Don't destroy SpawnTimer and there's no reason to create a new timer window/timer window variable.

So all you need to do when WaveCount is equal to 10 is start the timer as repeating timer that will expire in 150.00 seconds. That's it.

And if you want to adjust the title of the timer window you can do this:
  • Countdown Timer - Change the title of TimerWindow to blah blah blah
You mean like this? If so, i've tried that and it does not work hm.

  • StartTimer
    • Events
      • Time - Elapsed game time is 0.20 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start SpawnTimer as a Repeating timer that will expire in 10.00 seconds
      • Countdown Timer - Create a timer window for SpawnTimer with title Next wave in:
      • Set VariableSet TimerWindow = (Last created timer window)
      • Countdown Timer - Show TimerWindow
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WaveCount Equal to 10
        • Then - Actions
          • Countdown Timer - Start SpawnTimer as a Repeating timer that will expire in 150.00 seconds
        • Else - Actions
 
Level 7
Joined
Feb 23, 2020
Messages
253
Can you post your timer trigger? Where are you increasing WaveCount?
It's a very long list but i made this one short

  • Events
    • Time - SpawnTimer expires
  • Conditions
  • Actions
    • Set VariableSet WaveCount = (WaveCount + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • WaveCount Equal to 1
      • Then - Actions
        • Set VariableSet RandomSpawn = (Random integer number between 1 and 13)
        • Unit - Create 15 Troll (Level 1-3) for Player 12 (Brown) at Region[RandomSpawn] facing Default building facing degrees
        • Unit - Create 15 Troll Warrior (Level 1-3) for Player 12 (Brown) at Region[RandomSpawn] facing Default building facing degrees
      • Else - Actions
And so on..... up to Wavecount 100
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,368
Oh, I see now. The issue is that you're checking if WaveCount is equal to 10 in the the trigger that creates the Timer. That trigger only runs one time after 0.20 seconds have elapsed.

Instead, you need to check if WaveCount is equal to 10 after increasing it by 1, so add the If Then Else to the trigger you posted above.
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
Oh, I see now. The issue is that you're checking if WaveCount is equal to 10 in the the trigger that creates the Timer. That trigger only runs one time after 0.20 seconds have elapsed.

Instead, you need to check if WaveCount is equal to 10 after increasing it by 1, so add the If Then Else to the trigger you posted above.
Yes now it works! Thank you very much man :)
 
Level 7
Joined
Feb 23, 2020
Messages
253
I have a question @Uncle . If i want this timer to only work for the next wave if an item is purchased, does it work the same way? I.E "unit aquires an item, item type of X. Action, set this timer for the next wave. But instead as a one-shot timer ofc.
 
Last edited:

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,368
If I understand your question correctly than yes, you could do that.

Whenever you use "Start SpawnTimer" it resets the timer and sets it to the amount of seconds that you have chosen.

For example: Setting the timer to expire in 10.00 seconds (repeating or not) will set the timer back to 10.00 seconds and begin counting down from there.

You can use a One-shot timer as well as a Repeating timer:
  • Item Example
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to YourItem
    • Actions
      • Countdown Timer - Start SpawnTimer as a Repeating timer that will expire in 10.00 seconds
      • Countdown Timer - Start SpawnTimer as a One-shot timer that will expire in 10.00 seconds
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
If I understand your question correctly than yes, you could do that.

Whenever you use "Start SpawnTimer" it resets the timer and sets it to the amount of seconds that you have chosen.

For example: Setting the timer to expire in 10.00 seconds (repeating or not) will set the timer back to 10.00 seconds and begin counting down from there.

You can use a One-shot timer as well as a Repeating timer:
  • Item Example
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to YourItem
    • Actions
      • Countdown Timer - Start SpawnTimer as a Repeating timer that will expire in 10.00 seconds
      • Countdown Timer - Start SpawnTimer as a One-shot timer that will expire in 10.00 seconds

This seems to be accurate, i see now i explained myself poorly. I want it to work like you're allowed to set this timer for one time only if you purchase this item. But i will try this out :)
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,368
Just to make it clear, you don't need to use both a repeating AND one shot timer in the same trigger. I was just showing that you can use one or the other.

In your case you'll want to use just the One-shot timer.
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
Just to make it clear, you don't need to use both a repeating AND one shot timer in the same trigger. I was just showing that you can use one or the other.

In your case you'll want to use just the One-shot timer.
Ah yes i see, thank you very much! I'm kind of a rookie, that's why i ask a lot of questions :p
 
Status
Not open for further replies.
Top