captainrads
New Member
- Reaction score
- 14
EDIT: Fixed, Tom Jones was right; I changed the Integer A in the tankspawnlimit variable to the player number of the triggering unit's owner.
I've got a system where buildings spawn tanks every two minutes with a spawn max of three. The problem is, when a tank dies, the trigger that's supposed to detect it isn't working and the units aren't being replaced. I've tweaked the trigger and the spawn trigger multiple times and I cannot figure out what's wrong...here's the spawn trigger:
And the dying trigger:
Anyone see any flaws? The variables are predefined in another trigger and they should work since the units are spawning, but not being replaced.
I've got a system where buildings spawn tanks every two minutes with a spawn max of three. The problem is, when a tank dies, the trigger that's supposed to detect it isn't working and the units aren't being replaced. I've tweaked the trigger and the spawn trigger multiple times and I cannot figure out what's wrong...here's the spawn trigger:
Code:
Tank Spawn
Events
Time - Every 120.00 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units of type twominspawnbuildingtypearray[(Integer A)]) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in xspawngroup) Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
tankspawnlimit[(Integer A)] Less than 3
Then - Actions
Unit - Create 1 twominspawntype[(Integer A)] for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
Unit Group - Add (Last created unit) to twominspawngroup
Set tankspawnlimit[(Integer A)] = (tankspawnlimit[(Integer A)] + 1)
Else - Actions
Else - Actions
Do nothing
Code:
Destroyed tanks
Events
Unit - A unit Dies
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Dying unit) is in twominspawngroup) Equal to True
Then - Actions
Unit Group - Remove (Dying unit) from twominspawngroup
Set tankspawnlimit[(Integer A)] = (tankspawnlimit[(Integer A)] - 1)
Else - Actions
Do nothing
Anyone see any flaws? The variables are predefined in another trigger and they should work since the units are spawning, but not being replaced.