Creating a pathing friendly gate/door system, need help.

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


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)]
          • Else - 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)
      • 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


I have a feeling I'm doing something /facepalm :banghead: worthy and can't seem to find it.
 

crazyfanatic

New Member
Reaction score
20
you have to make the set destructible to variable, using For each Integer A between 1 and (your variable) do actions
 

SuperSoldier

New Member
Reaction score
10
I don't understand what you are trying to get at. It sounds like you want me to count the amount of doors then use that to do a for loop to ...?

This is also supposed to be a system, one that can be used on any map.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top