I am having problems with a gate open/close feature on a 'castle defense' type map. In the scenario, Castle has 3 levels. Friendly units spawn at the back and run through various gates on thier path to the enemy. The enemies spawn front and break gates down as they attack the castle.
So far:
I have triggered the gate to open and close as friendly units enter a rect. around to the gate. (I included adding a unit-group variable to only close when all friendly units are out of the rect.)
GATE OPEN:
I have also incorporated a lock function, based off Roar(Lock) and Taunt(Unlock). When casted from a 'Gate Control' unit these abilities are triggerd to turn on/off the open close triggers.
LOCK:
Lastly, the 'Gate Death' event. I included a trigger to switch off all gate related triggers (Open/Close/Lock/Unlock) when the gate is killed by the enemy.
GATE DEATH:
The Problem:
Whenever the enemy units destroy the gate, it dies (dissapears off of map), but the 'Gate Death' trigger seems not to fire... When friendly units then enter the gate open rect. the gate pops back into existance and closes when the unit leaves, forcing the gate to be destroyed again.
Have I triggered something wrong? Suggestions?
So far:
I have triggered the gate to open and close as friendly units enter a rect. around to the gate. (I included adding a unit-group variable to only close when all friendly units are out of the rect.)
GATE OPEN:
-
Event
- Unit - Unit enters Gate Open {rect.}
-
Cond
- ((Triggering unit) ally of Player 2) = True
-
Actions
- Unit Group - Add (Triggering Unit) to Gate_Occ {var}
- Destructible - Open Gate
-
Event
- Unit - Unit leaves Gate Close {rect.}
-
Cond
- ((Triggering unit) ally of Player 2) = True
-
Actions
-
Unit Group - Remove (Triggering Unit) to Gate_Occ {var}
-
If (All Cond = True) do (Actions) else do (Else Actions)
- If - Cond:
-
(Gate_Occ {var} is empty) = true
- Then - Action
- Destructible - Close Gate
- Else - Action
- Unit Group - Pick every unit in Gate Close {rect.} and order picked unit to attack-move to Gate_Way_1 {rect.} (a region outside gate rect.)
-
If (All Cond = True) do (Actions) else do (Else Actions)
-
Unit Group - Remove (Triggering Unit) to Gate_Occ {var}
I have also incorporated a lock function, based off Roar(Lock) and Taunt(Unlock). When casted from a 'Gate Control' unit these abilities are triggerd to turn on/off the open close triggers.
LOCK:
-
Event
- Unit - Gate Control begins casting an ability
-
Cond
- (Ability being cast) = Lock
-
Actions
- Trigger - Turn Off GATE OPEN {trig}
- Wait untill ((number of units in Gate_Occ {var}) = 0) checking every 1 sec
- Destructible - Close Gate
-
Event
- Unit - Gate Control begins casting an ability
-
Cond
- (Ability being cast) = Unlock
-
Actions
- Trigger - Turn On GATE OPEN {trig}
Lastly, the 'Gate Death' event. I included a trigger to switch off all gate related triggers (Open/Close/Lock/Unlock) when the gate is killed by the enemy.
GATE DEATH:
-
Event
- Destructable - Gate dies
-
Cond
- (Triggereing Player) = Player 1 Red
-
Actions
- Trigger - Turn Off GATE OPEN {trig}
- Trigger - Turn Off GATE CLOSE {trig}
- Trigger - Turn Off LOCK {trig}
- Trigger - Turn Off UNLOCK {trig}
- Unit - Remove Gate Controll from the game
The Problem:
Whenever the enemy units destroy the gate, it dies (dissapears off of map), but the 'Gate Death' trigger seems not to fire... When friendly units then enter the gate open rect. the gate pops back into existance and closes when the unit leaves, forcing the gate to be destroyed again.
Have I triggered something wrong? Suggestions?