• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Hero Defense Trigger!

Status
Not open for further replies.
Level 4
Joined
May 10, 2012
Messages
55
Hi Hive,
I'm making a Hero Defense map, and I want to make a trigger when:

1 minute elapses to spawn units in some regions...
and when all units are dead, a count down timer appears and when 30 sec elapse another wave spawns and so on... Can any one help me?

+REP for the helper
 
Level 11
Joined
Nov 15, 2007
Messages
781
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set WaveAmount[1] = 10
      • Set WaveAmount[2] = 15
      • Set WaveAmount[3] = 20
      • Set WaveUnitType[1] = Footman
      • Set WaveUnitType[2] = Rifleman
      • Set WaveUnitType[3] = Knight
      • -------- Repeat for every wave --------
      • Set WaveNumber = 1
  • Start
    • Events
      • Time - Elapsed game time is 60.00 seconds
    • Conditions
    • Actions
      • Trigger - Run WaveSpawn <gen> (ignoring conditions)
  • WaveSpawn
    • Events
      • Time - WaveTimer expires
    • Conditions
    • Actions
      • For each (Integer A) from 1 to WaveAmount[WaveNumber], do (Actions)
        • Loop - Actions
          • Unit - Create 1 WaveUnitType[WaveNumber] for Player 12 (Brown) at (Player 12 (Brown) start location) facing Default building facing degrees
          • Unit Group - Add (Last created unit) to WaveGroup
      • Countdown Timer - Destroy WaveTimerWindow
  • WaveTimer
    • Events
      • Unit - A unit Dies
    • Conditions
      • (WaveGroup is empty) Equal to True
    • Actions
      • Set WaveNumber = (WaveNumber + 1)
      • Countdown Timer - Start WaveTimer as a One-shot timer that will expire in 30.00 seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Next wave:
      • Set WaveTimerWindow = (Last created timer window)
      • Countdown Timer - Show WaveTimerWindow
 
Level 4
Joined
Oct 20, 2011
Messages
129
  • WaveTimer
    • Events
      • Unit - A unit Dies
    • Conditions
      • (WaveGroup is empty) Equal to True
    • Actions
      • Set WaveNumber = (WaveNumber + 1)
      • Countdown Timer - Start WaveTimer as a One-shot timer that will expire in 30.00 seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Next wave:
      • Set WaveTimerWindow = (Last created timer window)
      • Countdown Timer - Show WaveTimerWindow

Dead unit doesn't remove itself from unitgroup, so if all the units from WaveGroup are dead, the WaveGroup won't empty.
 
Last edited:
Level 14
Joined
Sep 17, 2009
Messages
1,297
Basically the same, just with a Counter

  • WaveSpawn
  • Events
    • Time - WaveTimer expires
  • Conditions
  • Actions
    • For each (Integer A) from 1 to WaveAmount[WaveNumber], do (Actions)
    • Loop - Actions
      • Unit - Create 1 WaveUnitType[WaveNumber] for Player 12 (Brown) at (Player 12 (Brown) start location) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to WaveGroup
    • Countdown Timer - Destroy WaveTimerWindow
    • Set Counter = WaveAmount[WaveNumber]
  • WaveTimer
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Player 8 (Enemy)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Counter Less than or equal to 1
        • Then - Actions
          • Set WaveNumber = (WaveNumber + 1)
          • Countdown Timer - Start WaveTimer as a One-shot timer that will expire in 30.00 seconds
          • Countdown Timer - Create a timer window for (Last started timer) with title Next wave:
          • Set WaveTimerWindow = (Last created timer window)
          • Countdown Timer - Show WaveTimerWindow
        • Else - Actions
          • Set Counter = (Counter - 1)
 
Level 4
Joined
Oct 20, 2011
Messages
129
Basically the same, just with a Counter

  • WaveSpawn
  • Events
    • Time - WaveTimer expires
  • Conditions
  • Actions
    • For each (Integer A) from 1 to WaveAmount[WaveNumber], do (Actions)
    • Loop - Actions
      • Unit - Create 1 WaveUnitType[WaveNumber] for Player 12 (Brown) at (Player 12 (Brown) start location) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to WaveGroup
    • Countdown Timer - Destroy WaveTimerWindow
    • Set Counter = WaveAmount[WaveNumber]
  • WaveTimer
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Player 8 (Enemy)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Counter Less than or equal to 1
        • Then - Actions
          • Set WaveNumber = (WaveNumber + 1)
          • Countdown Timer - Start WaveTimer as a One-shot timer that will expire in 30.00 seconds
          • Countdown Timer - Create a timer window for (Last started timer) with title Next wave:
          • Set WaveTimerWindow = (Last created timer window)
          • Countdown Timer - Show WaveTimerWindow
        • Else - Actions
          • Set Counter = (Counter - 1)

Use counter may cause bug which make the game never be continue, but it's rarely.
Better: check how much units is alive in WaveGroup.
 
Status
Not open for further replies.
Top