| 12-22-2004, 09:54 AM | #1 |
Could someone tell me why doesn't gate in my trigger closes when an enemy unit comes near it. Code:
outside
Events
Unit - A unit enters Outside <gen>
Conditions
Actions
If (((Triggering unit) belongs to an enemy of Player 1 (Red)) Equal to True) then do (Set Enemy_Outside = True) else do (Do nothing)
If (((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True) then do (Set Ally_Outside = True) else do (Do nothing)
Trigger - Run check 2 <gen> (ignoring conditions)Code:
recheck
Events
Unit - A unit enters Both <gen>
Unit - A unit leaves Both <gen>
Conditions
Actions
Unit Group - Pick every unit in (Units in Outside <gen> matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True)) and do (Actions)
Loop - Actions
Unit Group - Add (Matching unit) to Ally_Out
Unit Group - Pick every unit in (Units in Inside <gen> matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True)) and do (Actions)
Loop - Actions
Unit Group - Add (Matching unit) to Ally_In
Unit Group - Pick every unit in (Units in Outside <gen> matching (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True)) and do (Actions)
Loop - Actions
Unit Group - Add (Matching unit) to Enemy_Out
Unit Group - Pick every unit in Ally_In and do (Actions)
Loop - Actions
Set AllyIn = (AllyIn + 1)
Unit Group - Pick every unit in Ally_Out and do (Actions)
Loop - Actions
Set AllyOut = (AllyOut + 1)
Unit Group - Pick every unit in Enemy_Out and do (Actions)
Loop - Actions
Set EnemyOut = (EnemyOut + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AllyIn Equal to 0
Then - Actions
Set Ally_Inside = False
Else - Actions
Set AllyIn = 0
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AllyOut Equal to 0
Then - Actions
Set Ally_Outside = False
Else - Actions
Set AllyOut = 0
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
EnemyOut Equal to 0
Then - Actions
Set Enemy_Outside = False
Else - Actions
Set EnemyOut = 0
Trigger - Run check 2 <gen> (checking conditions)Code:
check 2
Events
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ally_Inside Equal to False) and (Ally_Outside Equal to False)
Then - Actions
Destructible - Close Elven Gate (Vertical) 0000 <gen>
Wait 5.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ally_Inside Equal to True) and (Enemy_Outside Equal to False)
Then - Actions
Destructible - Open Elven Gate (Vertical) 0000 <gen>
Wait 5.00 seconds
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ally_Outside Equal to True) and (Enemy_Outside Equal to False)
Then - Actions
Destructible - Open Elven Gate (Vertical) 0000 <gen>
Wait 5.00 seconds
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ally_Outside Equal to True) and (Enemy_Outside Equal to True)
Then - Actions
Destructible - Close Elven Gate (Vertical) 0000 <gen>
Wait 5.00 seconds
Else - Actions
Do nothingCode:
inside new
Events
Unit - A unit enters Inside <gen>
Conditions
((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True
Actions
Set Ally_Inside = True
Trigger - Run check 2 <gen> (ignoring conditions) Also i will add my test map so you can see the region and everything. |
| 12-22-2004, 11:26 AM | #2 |
Im not even going to look at that post but i will look at that map.... EDIT: i looked at that and so far u havent even told me whats wrong....i mean there is alot simpliar ways to control a gate opening and closing but if u want this to work depending on ur player....? here....its this simple: Code:
Open CLose
Events
Unit - A unit enters Both <gen>
Conditions
Actions
Trigger - Turn off (This trigger)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of (Entering unit)) is an enemy of Player 1 (Red)) Equal to True
Then - Actions
Destructible - Close Elven Gate (Vertical) 0000 <gen
Else - Actions
Destructible - Open Elven Gate (Vertical) 0000 <gen>
Wait 10.00 seconds
Trigger - Turn on (This trigger) |
| 12-22-2004, 07:27 PM | #3 | |
Quote:
PS. I think i found a problem it was the ally_in/out variable but i dont know how to put in this variable number of ally or enemy units. I just don't know whats wrong with this part it doesn't count units at all (result at the Ally_Out=0 ?!?). Code:
Unit Group - Pick every unit in (Units in Outside <gen> matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True)) and do (Actions)
Loop - Actions
Unit Group - Add (Matching unit) to Ally_Out
Unit Group - Pick every unit in Ally_Out and do (Actions)
Loop - Actions
Set AllyOut = (AllyOut + 1) |
| 12-23-2004, 08:25 PM | #4 |
In the top trigger you use (Triggering Unit) in the If. Use (Entering Unit) instead. |
