Dual looping problem. need only 1 door not all

Yoshii

New Member
Reaction score
74
I'm having an issue with my map heres how it my map work and whats the issue.
at start of game the game will open a number of lane depending on amount of player

so we have Maindoor array of 8 setup at init for each of the 8 door which is number of player; so basically what the game does in the case if player 3 or 6 are missing, it will not open gate 3 and 6.When a player leave the corresponding gate is closed and a variable named IsDoorOpen keep track of which door is open.

what Im trying to do is for example
only player 1 and 3 are left in the game with game lane open 1 and 3(already working).BUT i want the game to open lane number 2(as its the first closed lane out of 8) when I write -open

heres the trigger
Trigger:
  • OpenCommand
    • Events
      • Player - Player 1 (Red) types a chat message containing -open as An exact match
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DoorIsOpen[(Integer A)] Equal to False
            • Then - Actions
              • For each (Integer B) from 1 to 8, do (Actions)
                • Loop - Actions
                  • Destructible - Open Maindoor[(Integer B)]
            • Else - Actions

Now i know its obviously wrong as it open all door but I cant figure out an action that would pick the 1st array in DoorIsOpen that is False and do Open Maindoor(same array)
 

Yoshii

New Member
Reaction score
74
remove loop B, make it open MainDoor[Integer A] and add Skip Remaining Actions after it.

very nice thx +rep worthy fast and working answer.

heres the working one incase someone need

OpenCommand
Trigger:
  • Events
    • Player - Player 1 (Red) types a chat message containing -open as An exact match
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DoorIsOpen[(Integer A)] Equal to False
            • Then - Actions
              • Set DoorIsOpen[(Integer A)] = True
              • Destructible - Open Maindoor[(Integer A)]
              • Skip remaining actions
            • Else - Actions
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top