• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

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.
 

Rheiko

Spell Reviewer
Level 28
Joined
Aug 27, 2013
Messages
4,259
Allinrect is asking for a variable. It's causing an error.
Create a boolean variable named allinrect. Replace the first function with this:
  • Custom script: local boolean udg_allinrect = true
for all custom scripts which have allinrect in there, add "udg_" prefix.
for example:
  • Custom script: set udg_allinrect = false
hope it helps.
 
Status
Not open for further replies.
Top