-
Events
-
Map initialization
-
Conditions
-
Actions
-
Set Destructible Variable = Gate (Horizontal) 0001 <gen>
-
Set Point Variable = (Position of Gate (Horizontal) 0001 <gen>)
-
Events
-
Unit - A unit enters Checkpoint <gen>
-
Conditions
-
((Entering unit) is in (Units owned by Neutral Hostile)) Equal to True
-
Actions
-
Set Real Variable = (Real((Number of units in (units in Checkpoint <gen> owned by Neutral Hostile))))
-
Trigger - Turn on Next Trigger <gen>
-
Events
-
Time - Every 2.00 seconds of game time
-
Conditions
-
(Number of units in (Units in Checkpoint <gen>)) greater than 0
-
Actions
-
Destructible - Set life of Destructible Variable to ((Current life of Destructible Variable) - (10.00 times Real Variable))
-
Events
-
Unit - A unit leaves Checkpoint <gen>
-
Conditions
-
((Leaving unit) is in (Units owned by Neutral Hostile)) Equal to True
-
Actions
-
Set Real Variable = (Real((Number of units in (Units in Checkpoint <gen> owned by Neutral Hostile))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in (Units in Checkpoint <gen>)) Less than 1
-
Then - Actions
-
Trigger - Turn off Previous Trigger
-
Else - Actions
-
Events
-
Unit - A unit owned by Player 1 (Red) Finishes training a unit
-
Conditions
-
((Trained unit) is in (Units of type New Gate)) Equal to True
-
Actions
-
If ((Destructible Variable is dead) Equal to True) then do (Destructible - Create a Gate (Horizontal) at (Point Variable offset by (0.00, 0.00)) facing 0.00 with scale 1.00 and variation 0) else do (Do nothing)
-
Set Destructible Variable = (Last created destructible)
-
Unit - Remove (Trained unit) from the game
I think this works all the kinks out, however I am sure there's a memory leak here somewhere. or several, anyone elaborate?
Also, 'Leaving unit' I wanted to ask if anyone knows for sure if this counts as units that die, then use another new trigger-->
-
Events
-
Unit - A unit owned by Neutral Hostile Dies
-
Conditions
-
Actions
-
Unit - Remove (Dying unit) from the game
However this will remove the death animations I'm sure unless I set variables for each unit as they spawn per wave per side, then remove them when they die.
also I'm not sure if the editor counts this as a 'leaving unit' for the triggers to disable the gate's destruction.
finally, the reason I did so many loopholes was to make sure units don't count in (say your builder) as it flies over the region when they're piling up at the gate. And so that the Real number is never 0 when it calculates damage. I know that 0 times anything = 0 but it might cause the game to crash, (it stopped crashing for me after I made a few changes and I think this was it.) so I also made it so leaving units re-set the variable's value, and so that it turns off if there are 0 units in the checkpoint region.
EDIT: Fixed the Triggers I did post, however still having a few issues regarding to units leaving a checkpoint. I need to make it so that they can die in it as well and it would still revert the real variable to 0 and turn off the ''gate'' 2 sec. timer
EDIT2: With these triggers setup this way (after I figure out the last issue regarding units leaving the checkpoint) You can easily set this up so that every few waves or each wave, increases the damage done per second to gates (you can do this with a variable array I think so it increases by 1 per wave, or do it manually every way, by simply taking out 10.00 times the Real variable, and making it an Integer variable x Real number variable and then having the Integer variable be = to a set amount each wave. (requires more coding than an array I would think.)
EDIT3: For some reason, when I tested these triggers using a sample map I made - the first neutral unit that enters the checkpoint region does NOT trigger the drain of the gate's energy... only everyone of them after that (even with the triggers setup to turn on and off).
I fixed the units leaving the area issue, simply make 2 versions of the same trigger, one for leaving units, one for dieing.