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

Help with timers !

Status
Not open for further replies.
Level 1
Joined
Nov 16, 2013
Messages
3
hi, first of all I'm a beginner on world editor and im having some trouble with timers ! (i can't find an answer to my problem with the tutorials so im asking here).

Ok so im making a simple TD map, everything was fine until i try to use 2 timers to spawn waves. So here is how i actually do the thing :

- 5 triggers (init,creep,timer,waves,food)

init :

  • INIT
    • Events
      • Time - Elapsed game time is 15.00 seconds
    • Conditions
      • creep_level Equal 0
    • Actions
      • Quest - Display to (All players) the Avertissement message: |cff995500First lev...
      • Time - Create a timer window for creep_timer_init with title Next level spawn in...
      • Set MyTimerWindow_1 = (Last created timer window)
      • Time - Show MyTimerWindow_1
      • Time - Start creep_timer_init as a Un coup timer that will expire in 20.00 seconds
creep :

  • Creep
    • Events
      • Time - creep_timer_init expires
    • Conditions
      • creep_level Equal 0
    • Actions
      • Time - Destroy MyTimerWindow_1
      • Set creep_level = 1
      • -------- LEVEL 1 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • creep_level Equal 1
        • Then - Actions
          • Set creep_level = (creep_level + 1)
          • Set creep_food = 35
          • Quest - Display to (All players) the Avertissement message: Level 1 - Sheep
          • Unit - Create 35 Level 1 - Sheep for Joueur 12 (Marron) at (Center of Spawn rouge <gen>) facing Orientation bâtiment par défaut degrees
        • Else - Actions
          • Do nothing
timer :

  • Timer
    • Events
      • Unit - A unit owned by Joueur 12 (Marron) Meurt
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • creep_food Equal 0
        • Then - Actions
          • Wait 1.00 seconds
          • Time - Create a timer window for creep_timer_spawn with title Next level in :
          • Set MyTimerWindow_2 = (Last created timer window)
          • Time - Montrer MyTimerWindow_2
          • Time - Start creep_timer_spawn as a Un coup timer that will expire in 20.00 seconds
        • Else - Actions
waves :

  • Waves
    • Events
      • Time - creep_timer_spawn expires
    • Conditions
      • creep_level Supérieur ou égal Ã* 1
    • Actions
      • Time - Destroy MyTimerWindow_2
      • -------- LEVEL 2 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • creep_level Equal 2
        • Then - Actions
          • Set creep_level = (creep_level + 1)
          • Set creep_food = (creep_food + 35)
          • Quest - Display to (All players) the Avertissement message: Level 2 - Chicken
          • Unit - Create 35 Level 2 - Chicken for Joueur 12 (Marron) at (Center of Spawn rouge <gen>) facing Orientation bâtiment par défaut degrees
        • Else - Actions
          • Game - Display to (All players) the text: BUG MAP !!!
      • -------- LEVEL 3 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • creep_level Equal 3
        • Then - Actions
          • Set creep_level = (creep_level + 1)
          • Set creep_food = (creep_food + 35)
          • Quest - Display to (All players) the Avertissement message: Level 3 - Pingu
          • Unit - Create 35 Level 3 - Pingouin for Joueur 12 (Marron) at (Center of Spawn rouge <gen>) facing Orientation bâtiment par défaut degrees
        • Else - Actions
          • Game - Display to (All players) the text: BUG MAP !!!
      • -------- LEVEL 4 --------
food :

  • Food
    • Events
      • Unit - A unit owned by Joueur 12 (Marron) Meurt
    • Conditions
    • Actions
      • Set creep_food = (creep_food - 1)
      • Game - Display to (All players) the text: (String(creep_food))
So the first level is fine, everytime you kill a creep from player12 the var creep_food(35) decrease of 1 when its on 0, a timer should popup then next levels are coming etc etc, but in my case nothing happen, the timer don't popup i tried multiple things to see whats going on but i don't get it.. i need some help !

cheers! :grin:
 
Last edited:
http://www.hiveworkshop.com/forums/miscellaneous-tutorials-456/how-easily-post-triggers-163285/

This should also be in the triggers and scripts forum. This forum is for asking how to do something. Triggers and scripts is for asking how to fix something.

Place your unit types into an array keyed to the lvl you want them to spawn at.
Example:

  • Setup
  • Events
    • 0.00 time out
  • Conditions
  • Actions
    • Set spawnUnitType[1] = lvl one monster
    • Set spawnUnitType[2] = lvl two monster
    • Set spawnUnitType[3] = lvl three monster
    • ------- And so on -------
To use the above when spawning units you check the lvl that player is on then use that as the index to spawn. It will shorten your code and make it easier to edit and read.

Never use the Do nothing action. If you want to make it more readable use comments.

You leak locations in your triggers check the tutorial Things that leak on triggers and scripts page. Also take a look at my tutorial things a GUIer should know. It is in my sig.

As for your timer. It needs to be a repeating timer. Or you need to start it again.
You should not need 2 timers for this.
 
Level 1
Joined
Nov 16, 2013
Messages
3
Thanks you for the fast answer and the tips! I understand how it should be done now, and its easier with your method.. i will see if i can correctly use the timer now :D

edit: edited my first post.
 
Level 1
Joined
Nov 16, 2013
Messages
3
This is how i've done it the first time, but still it didn't work, i still don't know why. The second timer wasn't working.

  • Time - Destroy MyTimerWindow_2
i added this line after trying multiple things to get my second timer working, but it wasn't doing anything.

Anyway, i deleted everything and i am gonna do a fresh start, the night have been great for thinking about another method using your suggestions :thumbs_up:

cheers
 
Status
Not open for further replies.
Top