LightChaosma
New Member
- Reaction score
- 60
features of this system:
- only spawns creeps at active players
- each player gets thier creeps at the same time
- adds recources to active players at end of a wave.
- units wont get stuck
- lag free
- leak free
- easy to use
- extra features to make it look nice (optional)
- requires only GUI, no fancy world editor
for this system to work, you will need a few variables
- spawnint > an integer array size 2
- playeractive > an integer array size (amount of defenders)
- wave > integer with start value 0
- angle > real array size (ammount of defenders)
- wave_type > unit-type array with size (amount of waves)
- next_wave > timer
- living > real
- Temp_UnitG > tempory unit group (leak prevention)
- custom > integer array with size ( amount of defenders) (extra feature only)
- Temp_point > point array for leak prevention
- spawn_region > region array size (number of defenders)
extra features:
- all creeps will explode on death (choose a nice animation in the object editor under art - special)
- creeps are collored to the color of the player they "attack" (enable allow custom team color in object editor)
- set the custom value of the spwaned units (for eventual route issues)
this trigger will detect if a player is active or not: (map init)
the floowing trigger will define your what creeps will spawn, creep 1 is the creep that will be spaned at level 1, creep 2 at level 2, etc.
this is the trigger to spawn the units: (the underlined parts are the extra features:
in that example i had 8 players.
now, all we need to do now is detect when the next wave begins.
we use the following triggers, they are pretty straight forward, and need no further explenation:
all that is left is to make a start window:
for as far as i know this system is leak free.
i hope it may help someone someday
feel free to use it, you dont have to credit me
here is a picture:
- only spawns creeps at active players
- each player gets thier creeps at the same time
- adds recources to active players at end of a wave.
- units wont get stuck
- lag free
- leak free
- easy to use
- extra features to make it look nice (optional)
- requires only GUI, no fancy world editor
for this system to work, you will need a few variables
- spawnint > an integer array size 2
- playeractive > an integer array size (amount of defenders)
- wave > integer with start value 0
- angle > real array size (ammount of defenders)
- wave_type > unit-type array with size (amount of waves)
- next_wave > timer
- living > real
- Temp_UnitG > tempory unit group (leak prevention)
- custom > integer array with size ( amount of defenders) (extra feature only)
- Temp_point > point array for leak prevention
- spawn_region > region array size (number of defenders)
extra features:
- all creeps will explode on death (choose a nice animation in the object editor under art - special)
- creeps are collored to the color of the player they "attack" (enable allow custom team color in object editor)
- set the custom value of the spwaned units (for eventual route issues)
this trigger will detect if a player is active or not: (map init)
Code:
active player
Events
Map initialization
Conditions
Actions
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player((Integer A))) slot status) Equal to Is playing
Then - Actions
Set player_active[(Integer A)] = 1
Else - Actions
Set player_active[(Integer A)] = 0
Trigger - Turn off (This trigger)
the floowing trigger will define your what creeps will spawn, creep 1 is the creep that will be spaned at level 1, creep 2 at level 2, etc.
Code:
Events
Map initialization
Conditions
Actions
Set Wave_type[1] = creep 1
Set Wave_type[2] = creep 2
Set Wave_type[3] = creep 3
Set Wave_type[4] = creep 4
Set Wave_type[5] = creep 5
Set Wave_type[6] = creep 6
---go on like this---
Trigger - Turn off (This trigger)
this is the trigger to spawn the units: (the underlined parts are the extra features:
Code:
wave
Events
Time - Next_wave expires
Conditions
Actions
Set wave = (wave + 1)
Game - Display to (All players) the text: (Wave + (String(wave)))
[U] Set costum[1] = 1
Set costum[2] = 1
Set costum[3] = 2
Set costum[4] = 2
Set costum[5] = 3
Set costum[6] = 3
Set costum[7] = 4
Set costum[8] = 4[/U]
Set angle[1] = 0.00
Set angle[2] = 180.00
Set angle[3] = 270.00
Set angle[4] = 90.00
Set angle[5] = 180.00
Set angle[6] = 0.00
Set angle[7] = 90.00
Set angle[8] = 270.00
For each (Integer spawn_int[1]) from 1 to <amount of creeps>, do (Actions)
Loop - Actions
Wait <time between units> game-time seconds
For each (Integer spawn_int[2]) from 1 to <amount of players here>, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
player_active[spawn_int[2]] Equal to 1
Then - Actions
Set temp_point[1] = (Center of spawn_region[spawn_int[2]])
Unit - Create 1 Wave_type[wave] for <owner of creeps (player 12 for instance)> at temp_point[1] facing angle[spawn_int[2]] degrees
Custom script: call RemoveLocation(udg_temp_point[1])
Set temp_unitG[1] = (Units in spawn_region[spawn_int[2]] owned by Player 9 (Gray))
Unit Group - Pick every unit in temp_unitG[1] and do (Actions)
Loop - Actions
[U] Unit - Set the custom value of (Picked unit) to costum[spawn_int[2]][/U]
Unit - Turn collision for (Picked unit) Off
[U] Unit - Change color of (Picked unit) to (Color of (Player(spawn_int[2])))[/U] Unit - [U]Make (Picked unit) Explode on death[/U]
Custom script: call DestroyGroup (udg_temp_unitG[1])
Else - Actions
in that example i had 8 players.
now, all we need to do now is detect when the next wave begins.
we use the following triggers, they are pretty straight forward, and need no further explenation:
Code:
start timer
Events
Game - living becomes Equal to 0.00
Conditions
Actions
Countdown Timer - Start Next_wave as a One-shot timer that will expire in 20.00 seconds
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
player_active[(Integer A)] Equal to 1
Then - Actions
Player - Add (wave x 100) to (Player((Integer A))) Current gold
Player - Add 1 to (Player((Integer A))) Current lumber
Else - Actions
Game - Display to (All players) the text: (You have completed wave + ((String(wave)) + ( so you get + (|cff00aa001|r + ( lumber and + (((|cffffff00 + (String((100 x wave)))) + |r ) + gold !!))))))
Code:
count living units
Events
Unit - A unit Dies
Conditions
(Owner of (Dying unit)) Equal to <creep owner>
Actions
Set temp_unitG[1] = (Units owned by <creep owner> matching (((Matching unit) is alive) Equal to True))
Set living = (Real((Number of units in temp_unitG[1])))
Custom script: call DestroyGroup (udg_temp_unitG[1])
all that is left is to make a start window:
Code:
next wave timer
Events
Time - Elapsed game time is 20.00 seconds
Conditions
Actions
Countdown Timer - Start Next_wave as a One-shot timer that will expire in 60.00 seconds
Countdown Timer - Create a timer window for Next_wave with title Next Wave
Trigger - Turn off (This trigger)
for as far as i know this system is leak free.
i hope it may help someone someday
feel free to use it, you dont have to credit me
here is a picture: