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

Wave help

Status
Not open for further replies.
Level 1
Joined
Jan 3, 2014
Messages
4
Hi guys, recently I have been working on Hero defense map and when I start doing the waves I have jumped into a problem: I have tried severial way to solve it but didn't work.

What I am trying to do is to make a timer and when it finish first wave begin and when last unite of them die the timer starts again, and when the timer finish wave 3 begin and so own.

I tried many several ways but only worked to wave 2 then nothing happen, can anyone help with it please?
 
You need:
Wave_Count = Integer variable (keep track of rounds)
Wave_Size = Integer variable (number of units per wave)
Wave_Group = Unit Group variable (used to detect if a new wave should spawn)
Wave_UnitType = Unit Type Array variable (used to determine what type of unit should be spawned)
Wave_SpawnPoint = Point variable (used to detect where the wave should spawn)
Wave_TargetPoint = Point variable (used to detect where the spawned units should move to)
Wave_Timer = Timer variable (to start the first wave)

Map initialization:
Set Wave_UnitType[1] = Footman
Set Wave_UnitType[2] = Rifleman
Set Wave_UnitType[3] = Knight
continue until you reach the number of waves you want

Set Wave_Size = how many units you want to spawn each round
Set Wave_SpawnPoint = where you want the spawned units to spawn
Set Wave_TargetPoint = where you want the spawned units to attack-move to


------------------------------------------------------

At the beginning of the game you start the timer with the amount of time you want to last before the first wave.
Then make a trigger:

Start Waves:
- A timer expires
- Expiring timer equal to Wave_Timer
- Run Spawn New Wave Trigger
- Turn on Spawn New Wave Trigger


Run Spawn New Wave Trigger:
Actions - Every 1 second of game time
Conditions - Number of units in Wave_Group Equal to 0
Actions -
Set Wave_Count = (Set Wave_Count + 1)
- For each integer A 1 to Wave_Size do actions
loop-
Spawn 1 Wave_UnitType[Wave_Count] at Wave_SpawnPoint
Add Last created unit to Wave_Group
Order last created unit to Attack-Move to Wave_TargetPoint

Something like that.


Edit:
Note that this is for 1 spawn point only, if you need more spawn points you will need to use more arrays.
 
Level 1
Joined
Jan 3, 2014
Messages
4
Try to save every unit of the wave into your specified unit group. When any creep dies, check if "number of living units in Your_unit_group is equal to 0" (meaning there are no live creeps) and if yes, start timer anew and run the creep-spawning trigger.

Thanks man you save me, now I knew where my mistake was, I was trying "number of unite in unite group = 0"

Thanks again
 
Status
Not open for further replies.
Top