Team up

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

Hobbit41

Member
Jun 15, 2017
32
0
0
Category:

Suggested name: teams

What I want:
Im starting a game, and it has 4 teams.
All players online on start must be sorted in this 4 teams. Max players in team = 3.

Ideas for commands:
It starts with event, usually I use "/estart"

Ideas for permissions:
for ops



Hi guys, Im completely stuck :emoji_frowning:


Pls, help me, how should I sort all players in teams?


I know that that thing is easy, but idk why I cant create this...
 
Last edited:
1. Maybe would be nice if you use Request Format.

2. "That thing is easy", Nah. im pretty sure, for beginners btw Who never work with minigame or teams is not easy, btw i have no brain yes. how sort.
 
1. Maybe would be nice if you use Request Format.

2. "That thing is easy", Nah. im pretty sure, for beginners btw Who never work with minigame or teams is not easy, btw i have no brain yes. how sort.


Oh yes, my bad. Actually, while waited, I've made a script by myself. Maybe it would be usefull to somebody (also I'll be glad to any observations):

code_language.skript:
loop all players:
   add 1 to {_numberofunsorted} #increasing number of unsorted players by 1
   add loop-player to {_unsorted::*} #adding player to list of variables
   if {_numberofunsorted} is more than 12: #maximum players for my minigame
       stop loop
while {_numberofunsorted} > 0:
   if {_T} is less than 5: # T = number of team. I have 4 teams
       if {team%{_T}%} is less or equal to 2: #Number of players in team. It's 2 to me
           set {_randomplayer} to random integer between 1 and {_numberofunsorted} #taking random number to select from variables
           remove 1 from {_numberofunsorted} #decreasing number of unsorted for that player
           add {_unsorted::%{_randomplayer}%} to {team%{_T}%::*} #replacing player from Unsorted to one of 4 teams
           add 1 to {team%{_T}%} #increasing number of players in that team by 1
           remove {_unsorted::%{_randomplayer}%} from {_unsorted::*} #simply removing that player from Unsorted
       add 1 to {_T} #moving to next team. First it's filling Team1 with 2 players, then Team2 etc..
   if {_T} >= 5: #If we've filled all 4 teams, then...
       set {_T2} to {_T1}-4 #it continues from Team1. Whole part repeats except we're filling not with 2 players but with 1 (3rd in team). It's needed to be in balance, so if 10 players it would be 3x3x2x2 not 3x3x3x1
       set {_randomplayer} to random integer between 1 and {_numberofunsorted}
       remove 1 from {_numberofunsorted}
       add {_unsorted::%{_randomplayer}%} to {team%{_T2}%::*}
       add 1 to {team%{_2}%}
       remove {_unsorted::%{_randomplayer}%} from {_unsorted::*}
 
Last edited by a moderator: