Solved Random teams red vs blue

  • 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 comminuty!

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

SoMuchWessel

Active Member
Apr 3, 2017
147
3
18
47
Category: Teams

Suggested name: teams.sk

What I want:
I want that people can join a lobby. If there are enough people the game will start. This part is already done.
I want that there are 2 teams: Red and Blue.
After the game starts, i want that everyone in {game::lobby::*} is random assigned to the red or the blue team.
I would like to use the list variables {game::red::*} and {game::blue::*}.

Ideas for commands: -

Ideas for permissions: -

When I'd like it by: As soon as possible
 
Category: Teams

Suggested name: teams.sk

What I want:
I want that people can join a lobby. If there are enough people the game will start. This part is already done.
I want that there are 2 teams: Red and Blue.
After the game starts, i want that everyone in {game::lobby::*} is random assigned to the red or the blue team.
I would like to use the list variables {game::red::*} and {game::blue::*}.

Ideas for commands: -

Ideas for permissions: -

When I'd like it by: As soon as possible
Is this good:
code_language.skript:
set {_l::*} to shuffled {game::lobby::*}
loop {_l::*}:
    set {_li} to loop-index parsed as a number
    if mod({_li}, 2) = 0:
        add loop-value to {game::blue::*}
    else:
        add loop-value to {game::red::*}
 
Thanks!

Is this good:
code_language.skript:
set {_l::*} to shuffled {game::lobby::*}
loop {_l::*}:
    set {_li} to loop-index parsed as a number
    if mod({_li}, 2) = 0:
        add loop-value to {game::blue::*}
    else:
        add loop-value to {game::red::*}