1

I am making a mini game in Minecraft where when you first spawn in you are in a lobby where there are two 2 3x2 caves, one blue, the other red. When someone walks into one of the caves it adds them to the blue or red team.

I am wanting to know how to

  1. Add someone to a team when they walk into one of the respective caves

  2. Set it so when they press start game it teleports the players to their respective bases, not to the same one

Finally, its going to be a game where you kill the other team's leader (a wolf or ocelot) but how can i keep them from moving around without a fence or barrier because they are the leader.

It would be easy to set up something that will check for players at X. example it would check for players at 93 9 20 then activate another command block.

1
  • The immovable mob has nothing to do with the rest of the question. You should edit it out and ask it as another question. You might want to look into the \effect command, to inflict your leaders with an extreme amount of slowness.
    – MrLemon
    Commented Jun 11, 2014 at 9:59

1 Answer 1

4

The answers you are looking for can be found on the Minecraft Wiki entries for scoreboard and commands.

Setting up teams

To assign a player to a team you have to set up the teams first, using

/scoreboard teams add <team> [display name]
/scoreboard teams option <team> color <value>

<team> is the name of the team, e.g. red or blue. [display name] is an optional longer name, used in the scoreboard display, e.g. Team Ocelot or Team Jacob. The second command sets the team color, use [tab] after color to see your options, e.g. red, blue.

The command to assign someone to a team is

/scoreboard teams join <team> [players]

I suggest using simple pressure plates at the cave entrances, with the command blocks right below. You can then use @p fpr [players] to select the nearest player, who is normally the one that triggered the plate. Alternatively, you can use @a[r=X] to assign everyone in an X block radius sphere around the command block at once, or specify a block range with the selectors x, y, z, dx, dy and dz.

Teleport by team

To teleport every player on a specific team, you can use the @a selector with the team specifier, i.e.

/tp @a[team=<team>] <x> <y> <z>
7
  • If the display name has spaces in it, would we have to surround it with quotation marks like this? "Awesome Bots". Commented Jun 11, 2014 at 12:17
  • Or would you format it with raw JSON text like this? {display:{Name:"Awesome Bots"}}. Commented Jun 11, 2014 at 12:25
  • @DatEpicCoderGuyWhoPrograms seeing that display name is always the last argument of the commands that use it, it might be possible to just include spaces normally. The wiki also writes [display name...] with the ellipsis, indicating multiple arguments. Compare with [players...]. Can't check ingame right now.
    – MrLemon
    Commented Jun 11, 2014 at 13:33
  • @MrLemon the game will be there are two teams and you kill the other teams leader ocelot or wolf how can i set up a scoreboard to show the health of each teams ex. blue 19 red 20 then when the leaders dead how do i make it say red won!!! then teleport red to a special area Commented Jun 11, 2014 at 22:08
  • @kingbluesapphire you should post that as a new question. I'm not sure how to do that, or if it is possible at all, however.
    – MrLemon
    Commented Jun 12, 2014 at 8:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.