• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

How to give sight for whole team on area and close when whole team enters?

Status
Not open for further replies.
Level 5
Joined
Jun 15, 2016
Messages
111
So, I'm making a bossfight, and i want it so that if ONLY the whole team enters, the sight of the whole boss area is revealed. Also, There is a gate behind, so i want it so that if the whole team enters the gate closed.
I've made the door close trigger already (as it is super simple) but I haven't made it so that it only closes once the whole team entered. (There's a choice of 1 - 4 players, so how do I make it that if there's example 3 players, if all 3 entered, the triggers start?)
 
Level 5
Joined
Jun 15, 2016
Messages
111
It might be too much to ask, but I really want answers :( I'm passionate about making incredible bossfights; the only problem is how I make them with more than 1 player ( I usually just make solo bossfights )
 
Please no double posting.

Anyway, first you have to know how many active players there is and add them to a player group. You need two variables to do this: "Active Players" which is a player group / force, and a unit group called "Player Characters", their names aren't relevant, but that is what I called it.



  • Get Active Players
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Player Group - Add (Picked player) to ActivePlayers
            • Else - Actions
This add all players that are users to the group at the start of the game.



  • Leaver
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
    • Conditions
    • Actions
      • Player Group - Remove (Triggering player) from ActivePlayers
      • Unit Group - Pick every unit in PlayerCharacters and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Triggering player)
            • Then - Actions
              • Unit Group - Remove (Picked unit) from PlayerCharacters
            • Else - Actions
If one of the original active players leave the game, they are removed from the active players group and their hero is removed from the player character group.



  • Add Player Character
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Add No unit to PlayerCharacters
Add all the player heroes to this when they pick them or at the start of the game.



  • Check if Active Players in Region
    • Events
      • Unit - A unit enters Boss Region <gen>
    • Conditions
    • Actions
      • Custom script: local boolean allinrect = true
      • Unit Group - Pick every unit in PlayerCharacters and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Boss Region <gen> contains (Picked unit)) Equal to True
            • Then - Actions
            • Else - Actions
              • Custom script: set allinrect = false
      • Custom script: if allinrect == true then
      • -------- put triggers that should run if all players are in the boss region here. --------
      • Custom script: endif
Finally this trigger will check if all active player's units is in the region, if they are the line before "endif " will run.


All these are necessary.
 
Level 5
Joined
Jun 15, 2016
Messages
111
What double post? (I'll check, I might have spammed the Create Thread button a bit because the PC is slow)

Also, Thank you!!! It's literally solved now :)
 
Level 5
Joined
Jun 15, 2016
Messages
111
Please no double posting.

Anyway, first you have to know how many active players there is and add them to a player group. You need two variables to do this: "Active Players" which is a player group / force, and a unit group called "Player Characters", their names aren't relevant, but that is what I called it.



  • Get Active Players
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Player Group - Add (Picked player) to ActivePlayers
            • Else - Actions
This add all players that are users to the group at the start of the game.





  • Leaver
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
    • Conditions
    • Actions
      • Player Group - Remove (Triggering player) from ActivePlayers
      • Unit Group - Pick every unit in PlayerCharacters and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Triggering player)
            • Then - Actions
              • Unit Group - Remove (Picked unit) from PlayerCharacters
            • Else - Actions
If one of the original active players leave the game, they are removed from the active players group and their hero is removed from the player character group.



  • Add Player Character
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Add No unit to PlayerCharacters
Add all the player heroes to this when they pick them or at the start of the game.



  • Check if Active Players in Region
    • Events
      • Unit - A unit enters Boss Region <gen>
    • Conditions
    • Actions
      • Custom script: local boolean allinrect = true
      • Unit Group - Pick every unit in PlayerCharacters and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Boss Region <gen> contains (Picked unit)) Equal to True
            • Then - Actions
            • Else - Actions
              • Custom script: set allinrect = false
      • Custom script: if allinrect == true then
      • -------- put triggers that should run if all players are in the boss region here. --------
      • Custom script: endif
Finally this trigger will check if all active player's units is in the region, if they are the line before "endif " will run.


All these are necessary.

Allinrect is asking for a variable. It's causing an error.
 
Status
Not open for further replies.
Top