HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Defense Map - Register when all creeps in a wave dead?

12-23-2006, 03:25 AM#1
Baron Crinkle
Hi,

I'm trying to set it up so that the timer for each subsequent wave of creeps does not start until all presently in a wave are dead. However, using a check that sees the number of all units owned by that player on the playable map and then setting a variable to that real value, followed by triggering the next wave when that variable reaches 0, only seems to work once...
12-23-2006, 03:46 AM#2
xombie
Thats because you don't re-set the group variable to the newly created units. If you do like a wave every 45 seconds, set the units created to a unit group, and then when they are all dead and the new units spawn, set those units to the unit group.
12-23-2006, 03:59 AM#3
Baron Crinkle
For Real variables I cannot choose Unit Group to make my count, so far as I can tell. Under your instruction, I tried making a trigger say Pick every unit in group playable map area owned by (the right player) & do action set (real variable) = (stuck here).

On another note, is the most efficient way of defining the contents of waves through a set of string/integer arrays? I am trying to streamline the types & quantities of units spit out each wave (I am using an arithmatic formula to calculate units based on number of active players), a description (i.e. special properties for the wave) etc. If it is, on a tangent, I'd like to be able to insert 'bonus waves' in the middle of the conventional order if side quests are completed, etc.

On another note entirely, for some reason the ordinary breath of fire hero ability is broken--it does not display the graphic for the fire itself, though it still deals out the damage.

Thanks for the help!
12-23-2006, 04:25 AM#4
Dalten
Why use a real variable to count units? Easiest and best thing is to use an integer.
12-23-2006, 04:47 AM#5
Baron Crinkle
Because I had the triggers set to go off when the real variable reached 0, and I'm unsure as to how to have it activate when an integer trigger reaches 0...
12-23-2006, 04:47 AM#6
Zandose
If you want help with your triggers post them and we can try to fix them.

Updated
Trigger:
Create
Collapse Events
Time - Every 0.01 seconds of game time
Conditions
Collapse Actions
-------- Wave one. 10 Peasents --------
Set WaveType[1] = Peasant
Set WaveNumber[1] = 10
-------- Wave two. 12 Footmen --------
Set WaveType[2] = Footman
Set WaveNumber[2] = 12
-------- Wave Three 14 Knights --------
Set WaveType[3] = Knight
Set WaveNumber[3] = 14
-------- Etc.. --------
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Number of living WaveType[Wave] units owned by Neutral Hostile) Equal to 0
Collapse Then - Actions
Set Wave = (Wave + 1)
Game - Display to (All players) the text: Wave will start in ...
Wait 10.00 seconds
Game - Display to (All players) the text: Here they come!
Unit - Create WaveNumber[Wave] WaveType[Wave] for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
Set UnitGroup = (Units in (Playable map area) owned by Neutral Hostile)
Else - Actions
Attached Files
File type: w3xwave.w3x (12.7 KB)
12-23-2006, 05:12 AM#7
Baron Crinkle
First I have:

A unit owned by player dies
Set remainingunits = remainingunits -1

Second I have

(now changed to) Every 3 seconds elapsed
Condition: Remainingunits=0
(then all of my next-wave setup stuff)

Then finally in the actual wave spawning, at the very end I have it pick every unit in playable map area owned by player and set remaining units = number of units owned by player in playable map area.

I'm not sure how to post triggers as fancily as you did above, but that's pretty damn snazzy.
12-23-2006, 05:14 AM#8
Ammorth
0.01 seconds is way to fast of a check for this method.

There is a better way to do this.

Event:
Player - Properties
Player - Player 1 (Red)'s Food used becomes Equal to 0.00

Assuming the owner of the wave units is player 1.

Then all you have to do is give all the units a food used of 1 (in the object editor) and you are done.
12-23-2006, 05:25 AM#9
Zandose
That works too. But I think mine looks cooler.


Quote:
Originally Posted by Ammorth
0.01 seconds is way to fast of a check for this method.

There is a better way to do this.

Event:
Player - Properties
Player - Player 1 (Red)'s Food used becomes Equal to 0.00

Assuming the owner of the wave units is player 1.

Then all you have to do is give all the units a food used of 1 (in the object editor) and you are done.
12-23-2006, 05:28 AM#10
Ammorth
Ahh, but my method is more stream-line and yields better performance.
12-23-2006, 05:35 AM#11
Zandose
Fine. How about this?
Trigger:
Create Copy
Collapse Events
Player - Neutral Hostile's Food used becomes Equal to 0.00
Conditions
Collapse Actions
Set Wave = (Wave + 1)
-------- Wave one. 10 Peasents --------
Set WaveType[1] = Peasant
Set WaveNumber[1] = 10
-------- Wave two. 12 Footmen --------
Set WaveType[2] = Footman
Set WaveNumber[2] = 12
-------- Wave Three 14 Knights --------
Set WaveType[3] = Knight
Set WaveNumber[3] = 14
-------- - --------
Game - Display to (All players) the text: Wave will start in ...
Wait 10.00 seconds
Game - Display to (All players) the text: Here they come!
-------- - --------
Unit - Create WaveNumber[Wave] WaveType[Wave] for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
Attached Files
File type: w3xwave.w3x (13.0 KB)
12-23-2006, 06:37 AM#12
Baron Crinkle
Trigger:
Timer Start
Collapse Events
Map initialization
Conditions
Collapse Actions
Wait 2.00 seconds
Countdown Timer - Create a timer window for WaveTimer with title Wave arrives in...
Countdown Timer - Start WaveTimer as a One-shot timer that will expire in 20.00 seconds
Countdown Timer - Show (Last created timer window)
Trigger - Turn off (This trigger)

Trigger:
Timer Repeat
Collapse Events
Player - Player 1 (Red)'s Food used becomes Equal to 0.00
Collapse Conditions
RemainingUnits Equal to 0
Collapse Actions
Sound - Play Clapping <gen> at 100.00% volume, located at (Center of Defensive Position <gen>) with Z offset 0.00
Countdown Timer - Create a timer window for WaveTimer with title Wave arrives in...
Countdown Timer - Start WaveTimer as a One-shot timer that will expire in 35.00 seconds
Countdown Timer - Show (Last created timer window)
Game - Display to (All players) the text: (Bonus Gold: + ((String((WaveNumber x 25))) + |r))
Player - Add (WaveNumber x 25) to Player 2 (Blue) Current gold
Player - Add (WaveNumber x 25) to Player 3 (Teal) Current gold
Player - Add (WaveNumber x 25) to Player 4 (Purple) Current gold
Player - Add (WaveNumber x 25) to Player 5 (Yellow) Current gold
Player - Add (WaveNumber x 25) to Player 6 (Orange) Current gold
Player - Add (WaveNumber x 25) to Player 7 (Green) Current gold
Set WaveNumber = (WaveNumber + 1)

Trigger:
Wave Engine
Collapse Events
Time - WaveTimer expires
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
WaveUnit1[WaveNumber] Not equal to No unit-type
Collapse Then - Actions
Unit - Create ((Number of players in (All allies of Player 12 (Brown))) + 2) WaveUnit1[WaveNumber] for Player 1 (Red) at (Center of Northern Assault <gen>) facing (Center of Defensive Position <gen>)
Unit - Create ((Number of players in (All allies of Player 12 (Brown))) + 2) WaveUnit1[WaveNumber] for Player 1 (Red) at (Center of Southern Assault <gen>) facing (Center of Defensive Position <gen>)
Unit - Create ((Number of players in (All allies of Player 12 (Brown))) + 2) WaveUnit1[WaveNumber] for Player 1 (Red) at (Center of Eastern Assault <gen>) facing (Center of Defensive Position <gen>)
Unit - Create ((Number of players in (All allies of Player 12 (Brown))) + 2) WaveUnit1[WaveNumber] for Player 1 (Red) at (Center of Western Assault <gen>) facing (Center of Defensive Position <gen>)
Game - Display to (All players) the text: ((Wave + ( + (String(WaveNumber)))) + (: + (WaveName[WaveNumber] + WaveUnit1Info[WaveNumber])))
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
WaveUnit2[WaveNumber] Not equal to No unit-type
Collapse Then - Actions
Unit - Create ((Number of players in (All allies of Player 12 (Brown))) + 2) WaveUnit2[WaveNumber] for Player 1 (Red) at (Center of Northern Assault <gen>) facing (Center of Defensive Position <gen>)
Unit - Create ((Number of players in (All allies of Player 12 (Brown))) + 2) WaveUnit2[WaveNumber] for Player 1 (Red) at (Center of Southern Assault <gen>) facing (Center of Defensive Position <gen>)
Unit - Create ((Number of players in (All allies of Player 12 (Brown))) + 2) WaveUnit2[WaveNumber] for Player 1 (Red) at (Center of Eastern Assault <gen>) facing (Center of Defensive Position <gen>)
Unit - Create ((Number of players in (All allies of Player 12 (Brown))) + 2) WaveUnit2[WaveNumber] for Player 1 (Red) at (Center of Western Assault <gen>) facing (Center of Defensive Position <gen>)
Game - Display to (All players) the text: ((Wave + (String(WaveNumber))) + (: + (WaveName[WaveNumber] + WaveUnit2Info[WaveNumber])))
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
WaveUnit3[WaveNumber] Not equal to No unit-type
Collapse Then - Actions
Game - Display to (All players) the text: ((Wave + (String(WaveNumber))) + (: + ((String(WaveUnit3[WaveNumber])) + WaveUnit3Info[WaveNumber])))
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
WaveUnit4[WaveNumber] Not equal to No unit-type
Collapse Then - Actions
Game - Display to (All players) the text: ((Wave + (String(WaveNumber))) + (: + ((String(WaveUnit4[WaveNumber])) + WaveUnit4Info[WaveNumber])))
Collapse Else - Actions
Do nothing
Countdown Timer - Destroy (Last created timer window)
Sound - Play GameFound <gen>
Wait 1.00 seconds
Unit Group - Order (Units within 512.00 of (Center of Northern Assault <gen>) matching (Player 1 (Red) Equal to (Owner of (Matching unit)))) to Attack-Move To (Center of Defensive Position <gen>)
Unit Group - Order (Units within 512.00 of (Center of Southern Assault <gen>) matching (Player 1 (Red) Equal to (Owner of (Matching unit)))) to Attack-Move To (Center of Defensive Position <gen>)
Unit Group - Order (Units within 512.00 of (Center of Eastern Assault <gen>) matching (Player 1 (Red) Equal to (Owner of (Matching unit)))) to Attack-Move To (Center of Defensive Position <gen>)
Unit Group - Order (Units within 512.00 of (Center of Western Assault <gen>) matching (Player 1 (Red) Equal to (Owner of (Matching unit)))) to Attack-Move To (Center of Defensive Position <gen>)
Trigger - Turn on Timer Repeat <gen>

It's a beast, I know, but this is how I have it setup at the moment. I then have another set of triggers to setup the text and unit-types for the various variables you see in there of that sort. I set it up for 4 variable sets of units so that I could mix units on some waves while not on others, etc.

The reason there is an initial trigger I turn off is because at map initialization player 1 has no units, and thus no food used--which leaves the trigger rapidly cycling through waves. However, with the above setup, I get the first starter wave as seperately triggered, and then I get the first actual wave, then it stops running properly.
12-23-2006, 02:55 PM#13
Zandose
I can't see anything wrong with that. Can you post the map too?
12-23-2006, 06:18 PM#14
wyrmlord
Suggestions:

1. For the first trigger, change the event to "Elapsed game time equal to 2 seconds" or whatever that is and remove the wait. Turning off the trigger is completely useless unless you will be turning it on later, and in this case it's useless. You can, however, destroy the trigger using a custom script action:
Collapse JASS:
call DestroyTrigger(GetTriggeringTrigger())

2. For trigger two, you should remove the condition. Think to yourself, is it really needed? In this case it shouldn't be. If you're having wave trouble, there may be another solution, but in the end you probably won't need that condition.

3. For trigger 3, remove the Do Nothing action, it's useless. Never use it.

I'd also advise you to look at a tutorial on removing memory leaks sometime, your code has a lot of them as a defense map would most likely have if whoever made it doesn't know what memory leaks are.