SuperSoldier
New Member
- Reaction score
- 10
I'm trying to create a lockable door system that is pathing friendly, meaning your unit won't try and go the long way around because it thinks there is an object in it's way...
These are the triggers I have so far, and they don't seem to be working correctly. What is wrong with them or how would I do it better?
Initialization:
Door Open:
Door Close:
I have a feeling I'm doing something /facepalm :banghead: worthy and can't seem to find it.
These are the triggers I have so far, and they don't seem to be working correctly. What is wrong with them or how would I do it better?
Initialization:
Trigger:
- Actions
- Set cust_horz = Iron Gate (Horizontal)
- Set cust_vert = Iron Gate (Vertical)
- -------- -------- --------
- Destructible - Pick every destructible in (Playable map area) and do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Or - Any (Conditions) are true
- Conditions
- (Destructible-type of (Picked destructible)) Equal to cust_horz
- (Destructible-type of (Picked destructible)) Equal to cust_vert
- Conditions
- Or - Any (Conditions) are true
- Then - Actions
- Set door_count = (door_count + 1)
- Set doors[door_count] = (Picked destructible)
- Set temppoint = (Position of (Picked destructible))
- Set door_area[door_count] = (Region centered at temppoint with size (500.00, 500.00))
- Destructible - Open doors[door_count]
- Destructible - Hide doors[door_count]
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Destructible-type of (Matching destructible)) Equal to cust_vert
- Then - Actions
- Unit - Create 1 Iron Gate for Neutral Passive at temppoint facing 0.00 degrees
- Else - Actions
- Unit - Create 1 Iron Gate for Neutral Passive at temppoint facing 90.00 degrees
- If - Conditions
- Unit - Pause (Last created unit)
- Set door_dummy[door_count] = (Last created unit)
- Trigger - Add to Door Open <gen> the event (Unit - A unit enters door_area[door_count])
- Trigger - Add to Door Close <gen> the event (Unit - A unit leaves door_area[door_count])
- Custom script: call RemoveLocation(udg_temppoint)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
Door Open:
Trigger:
- Actions
- For each (Integer A) from 1 to door_count, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (door_area[(Integer A)] contains (Triggering unit)) Equal to True
- Then - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- door_lock[(Integer A)] Equal to True
- Then - Actions
- Destructible - Close doors[(Integer A)]
- Else - Actions
- Destructible - Show doors[(Integer A)]
- Destructible - Open doors[(Integer A)]
- Unit - Hide door_dummy[(Integer A)]
- Unit Group - Add (Triggering unit) to door_near[(Integer A)]
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- For each (Integer A) from 1 to door_count, do (Actions)
Door Close:
Trigger:
- For each (Integer A) from 1 to door_count, do (Actions)
- Loop - Actions
- Unit Group - Remove (Triggering unit) from door_near[(Integer A)]
- Set tempint = 0
- Unit Group - Pick every unit in door_near[(Integer A)] and do (Actions)
- Loop - Actions
- Set tempint = (tempint + 1)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- tempint Equal to 0
- Then - Actions
- Unit - Unhide door_dummy[(Integer A)]
- Destructible - Hide doors[(Integer A)]
- Else - Actions
- If - Conditions
- Loop - Actions
I have a feeling I'm doing something /facepalm :banghead: worthy and can't seem to find it.