-4

On the map that I am making there are 4 teams: RED YELLOW GREEN BLUE. All players have already chosen their team. There can be as many players on 1 team as they want. Let's say 2 join on RED 1 on GREEN and 3 on YELLOW now those players want to choose an arena for the battle. There are 3 arenas at the moment when a player choose the arena (by pressure plate) it will teleport him on his team side the same for all the others and when all players are in there sides there will be a button. Now when all teams press there button it will activate those 12 commands that will open the doors play a sound and a particle...

RED TEAM SIDE
1 command:/fill 420 101 -1584 420 102 -1584 air 2 command:/playsound minecraft:block.anvil.land block @a 420 100 -1584 100 2 0 3 command:/particle blockcrack 420 101 -1584 0 1 0 1 100 1 @a 101

GREEN TEAM SIDE 1 command:/fill 461 101 -1625 461 102 -1625 air 2 command:/playsound minecraft:block.anvil.land ambient @a 461 101 -1625 100 2 3 command:/particle blockcrack 461 101 -1625 0 1 0 0 100 normal @a 101

YELLOW TEAM SIDE 1 command:/fill 502 101 -1584 502 102 -1584 air 2 command:/playsound minecraft:block.anvil.land ambient @a 502 101 -1584 100 2 3 command:/particle blockcrack 502 101 -1584 0 1 0 0 100 normal @a 101

BLUE TEAM SIDE 1 command:/fill 461 101 -1543 461 102 -1543 air 2 command:/playsound minecraft:block.anvil.land ambient @a 461 101 -1543 100 2 3 command:/particle blockcrack 461 101 -1543 0 1 0 0 100 normal @a 101

Item at offhand command:/replaceitem entity @a slot.weapon.offhand minecraft:fireworks 1 0 {Fireworks:{Flight:3}}

...after that the battle has started. Now all players are done they want a different arena they will go back to there team sides and will press a button that will teleport them back to the lobby but only if all buttons on every team are pressed and at the same time they will leave the team...

1 command:/scoreboard teams leave @a 2 command:/teleport @a 334 113 -1584

...the same thing as long they want to battle and change arenas.

I tried to describe as much as I could what will happen when a player joins a team choose the arena start and leaving the game.

2 Answers 2

2

there are multiple ways you could do this, some are easier, some are more complicated.
All of these answers require you to join the players to their team if they press the button.


1. check for players without a team using redstone

this is the easiest solution. If you can assure that there will never be any more players than 4 (and any less than 2) in the world, you can use this method.

using the selector @a[team=] (in a testfor command for example) you can check for anyone that doesn't have a team. as soon as that number reaches 0 and the commandblock turns off, you can start your mechanism. for that you can just put a comparator next to this block and revert its output with a redstone torch.
Be aware that this means that if there is only one player on the server and he manages to get into a team, the game will start as well. so you either want to block off the buttons as long as there aren't at least 2 players or you can just check for a minimum of 2 players using the command

/testfor @a

and then taking the redstone output of a comparator to only power the other command if it's signal length is at least 2 (and at most 4, if you stop the signal from passing. it's possible, but not very room efficient and also laggy).


allright, those are the relatively easy possibilities using some commands and some redstone. but since we normally resort to not using redstone at all, here is the non-redstone and foolproof version.

2. count the actual players present in the world and then the ones in a team using the stats command.

this one requires some more complicated commands but no redstone and it is less prone to failure.

setup:

we'll need a few scoreboards for that

/scoreboard objectives add teamcount dummy
/scoreboard objectives add playercount dummy

as well as a scoreholder entity, i'll use an armorstand for this example, named "data":

/summon armor_stand ~ ~1 ~ {CustomName:"data",CustomNameVisible:1,NoGravity:1b,Marker:1b,Invulnerable:1}

then we'll need to initialise the scoreboard for the armorstand that we use in the stats later on:

/scoreboard players set @e[type=armor_stand,name=data] teamcount 0
/scoreboard players set @e[type=armor_stand,name=data] playercount 0

now onto the commandblocks:

first you'll have a commandblock that tests for all players present in the world

/testfor @a

we then use the /stats command to write the result of the testfor in the count scoreboard of the fake player #players (set , and to the coordinates of the first commandblock).

/stats block <x> <y> <z> set SuccessCount @e[type=armor_stand,name=data] playercount

then we testfor the amount of players that have a team, so we can check if the amount of players is correct.

/testfor @a[team=!]
    ↑
    /stats block <x> <y> <z> set SuccessCount @e[type=armor_stand,name=data] teamcount

voila, now we have the amount of players that are present in the world in the one objective and the amount of players that are in a team in the other.

now we just need a few execute commands to start the starting mechanism for each of the three possibilities:

/execute @e[type=armor_stand,name=data,score_playercount_min=2,score_playercount=2,score_teamcount_min=2,score_teamcount=2] ~ ~ ~ /<your starting command here>
/execute @e[type=armor_stand,name=data,score_playercount_min=3,score_playercount=3,score_teamcount_min=3,score_teamcount=3] ~ ~ ~ /<your starting command here>
/execute @e[type=armor_stand,name=data,score_playercount_min=4,score_teamcount_min=4,score_teamcount=4] ~ ~ ~ /<your starting command here>

Note: I changed the last command to execute if there are 4 or more players present in the world, so it will still start with 5 players in the world

Note2: these commands will now try to execute the starting command every gametick, so you might want to have something as the starting command that doesn't get reset every tick, like setting a redstone_block that only gets removed after the game is finished!

and there we go, that is how you make that happen.

4
  • ok i have all commands that you told me but i may have pute them wrong here is what i want so you can tell me what to do there are 4 teams RED YELLOW GREEN BLUE all players have already choose there team there can be as many players on 1 team as they want there can be let's say 2 on RED 1 on GREEN 3 on YELLOW now those players want to choose an arena for the battle there are 3 arenas at the moment when a player choose the arena (by presure plate) it will teleport him on his team side the same for all the others and when all players are in there sides there
    – Alex
    Commented Jan 6, 2017 at 18:39
  • will be a button now when all teams press there button it activate 12 chain command blocks that will open the doors play a sound and a particle and when everyone are done and want a new arena there will be a onether button that when all teams press will take them back to lobby
    – Alex
    Commented Jan 6, 2017 at 18:39
  • 1
    I'm sorry, the lack of punctuation really makes this very hard to read. But now you suddenly want this to work with however many people per team and not (as at least i understood your original post) 4 people with 1 per team? And the questions you asked now really appears to be a completely new question and should thus be asked in a new question.
    – Plagiatus
    Commented Jan 6, 2017 at 22:49
  • i am sorry about this the thing is that i read again what i write and i saw that i didn't explain exactly what i need so i write again the title maybe is wrong to the text is now exactly what i need it's hard to make a good map when you are not good with commands so sorry again but i really want to make this map as good as possible
    – Alex
    Commented Jan 6, 2017 at 23:47
0

Use the team selector to select the team, assuming that when you join a team it is assigned to you via /scoreboard teams.

@a[team=<team>]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .