[Trigger] Auto Detect Players & Auto make 2 Balanced Teams? :O

GfameVideos

New Member
Reaction score
2
How do i make a trigger like this:

-First it auto Detects how many players there are.
-'If Body Count Mode (Team Deathmatch) is chosen, it will automaticly make
2 Balanced teams if possible, and else 1 team has 1 more? :D
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
For the first question

Trigger:
  • Actions
    • Set Integer_X = 0
    • Player Group - Pick every player in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))) and do (Actions)
      • Loop - Actions
        • Set Integer_X = (Integer_X + 1)
    • Game - Display to (All players) for 15.00 seconds the text: (The total number of players is + ((String(Integer_X)) + .))
 

GfameVideos

New Member
Reaction score
2
Thanks, now if someone can 'Extend' this trigger to make it have 2 teams, like if there 6 players, it makes first 3 players team 1 and second 3 players team 2. And when theres 5 players, its gonna be 3v2.
 

GfameVideos

New Member
Reaction score
2
For the first question

Trigger:
  • Actions
    • Set Integer_X = 0
    • Player Group - Pick every player in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))) and do (Actions)
      • Loop - Actions
        • Set Integer_X = (Integer_X + 1)
    • Game - Display to (All players) for 15.00 seconds the text: (The total number of players is + ((String(Integer_X)) + .))

Mate, how do i do the player group trigger of urs. I have everything but i don't seem to be able to end on 'and do (actions)'.

Please help.
 

Ayanami

칼리
Reaction score
288
I believe this should work, didn't try though. Here's the map if you want to copy the variables. Go to your World Editor > Files > Preferences > General > Tick Automatically create unknown variables while pasting trigger data. In the map, just copy the trigger file "Team Count and Balance" into your map. Like I said, didn't test the trigger so not sure if it will work for sure.

Trigger:
  • Team Count and Balance
    • Events
    • Conditions
    • Actions
      • Set PlayerGroup = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
      • Set MyInteger = (Number of players in PlayerGroup)
      • Game - Display to (All players) for 10.00 seconds the text: ((String(MyInteger)) + are currently in-game.)
      • Custom script: call DestroyForce(udg_PlayerGroup)
      • Set IntegerCount = (MyInteger / 2)
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) controller) Equal to User
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • MyInteger Less than or equal to IntegerCount
                • Then - Actions
                  • Player Group - Add (Player((Integer A))) to PlayerGroupTeam2
                • Else - Actions
                  • Player Group - Add (Player((Integer A))) to PlayerGroupTeam1
              • Set MyInteger = (IntegerCount - 1)
            • Else - Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) is in PlayerGroupTeam1) Equal to True
            • Then - Actions
              • Player Group - Remove (Player((Integer A))) from PlayerGroupTeam1
              • Player Group - Pick every player in PlayerGroupTeam1 and do (Actions)
                • Loop - Actions
                  • Player - Make (Player((Integer A))) treat (Picked player) as an Ally with shared vision
              • Player Group - Add (Player((Integer A))) to PlayerGroupTeam1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Player((Integer A))) is in PlayerGroupTeam2) Equal to True
                • Then - Actions
                  • Player Group - Remove (Player((Integer A))) from PlayerGroupTeam2
                  • Player Group - Pick every player in PlayerGroupTeam2 and do (Actions)
                    • Loop - Actions
                      • Player - Make (Player((Integer A))) treat (Picked player) as an Ally with shared vision
                  • Player Group - Add (Player((Integer A))) to PlayerGroupTeam2
                • Else - Actions
      • Player Group - Make PlayerGroupTeam1 treat PlayerGroupTeam2 as an Enemy
 

GfameVideos

New Member
Reaction score
2
Woah, that looks awesum!

So i can simply make another trigger (For the actual Body Count Mode).

Using Playerteam1 and Playerteam2 variables to create spawns?
 

Ayanami

칼리
Reaction score
288
Woah, that looks awesum!

So i can simply make another trigger (For the actual Body Count Mode).

Using Playerteam1 and Playerteam2 variables to create spawns?

I didn't really catch you. Are you asking if you can use "PlayerTeam1" and "PlayerTeam2" variables to spawn creeps for the respectively players? If that's your question, my answer is: yes.
 

GfameVideos

New Member
Reaction score
2
I didn't really catch you. Are you asking if you can use "PlayerTeam1" and "PlayerTeam2" variables to spawn creeps for the respectively players? If that's your question, my answer is: yes.

Thx so much, i luv u! :D

This was the thing i needed to even be able to make something new in my map. creating a members project later today :O

Look otu for it: Tactical Warfare - The Union
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top