# Gate Open/Close Problems

Level 4
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:
• 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
GATE CLOSE:
• 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.)

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
UNLOCK:
• 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?

#### TwoVenomous

Level 12
Open and Destroy the Gate has the same Event "Gate Dies", so whenever the gate is opened, it's the same as the gate is destroyed.

add this action to 'Gate Death' trigger to check if its really triggered or not.

• Game - Display to (All players) the text: This Trigger is Triggered
you could post your map or copy the trigger as text for us to check the problem constantly.

Level 4
added the text action, GateDeath does not fire.... ever...

is there another way of setting the conditions in the gate death so the game relises when the gate is destroyed by the attacking creeps?

EDIT: Problem Solved! Gate_Death Trigger works if condition is set to:

((Triggering Unit) belongs to enemy of Player 2 (Blue)) Equal to True

#### TwoVenomous

Level 12
good job! glad you found the solution

Level 4
Okay, this trigger works, but now I have encountered a new problem...

I applied it to another map I am working on and when the enemy forces destroy the gate, the game crashes! No error messages, nothing... just straight back to windows. Any ideas?

#### TwoVenomous

Level 12
Okay, this trigger works, but now I have encountered a new problem...

I applied it to another map I am working on and when the enemy forces destroy the gate, the game crashes! No error messages, nothing... just straight back to windows. Any ideas?

post the map so we can check it.

Level 4
I had added a 'Remove Destructible' action to the destroy trigger. Works when you take it out...

It might be something to do with the custom model I am using. Anyway, solved!

Replies
5
Views
562
Replies
1
Views
302
Replies
6
Views
276
Replies
3
Views
325
Replies
9
Views
865