0

I'm developing a Minecraft mini-game and I want to execute a command when a team reach 0 points.

I've created a dummy objective:

/scoreboard objective add health dummy Health

And 3 teams:

/scoreboard teams add A-team teama
/scoreboard teams add B-team teamb
/scoreboard teams add C-team teamc

All teams start with 1000 points and depending what they do their points will be decreased, I want to execute a command when one team reachs 0 points. I'm using this but it doesn't work:

/testfor @a[team=A-team, score_health_min=0]
  • I'm using Minecraft 1.9.1

Thanks in advance and sorry for my bad English.

5
  • 2
    Teams themselves can't have points. Do you mean detecting when someone on that team reaches 0 points, when everyone on that team reaches 0 points, or do you have a fake player set up to represent the team?
    – SirBenet
    Jul 28, 2016 at 12:31
  • No, teams haven't got any players, Mmm.. So should I add a fake player for each team to represent the team?
    – aperpen
    Jul 28, 2016 at 13:56
  • How are you currently adding/subtracting points? You'll need to add a fake player if you haven't already got something set up for that, yeah.
    – SirBenet
    Jul 28, 2016 at 14:07
  • I use /scoreboard players remove A-team health 1 to substract points and for add, the same but replacing remove for add. Oh, ok it's the first time i'm developing a mini-game, how could I do that?
    – aperpen
    Jul 28, 2016 at 14:10
  • That looks like you're already accidentally using a fake player. You're adding/removing score from a player with the username "A-team" (they could be called anything), when they're not logged in/don't exist. That player isn't the team "A-team" and isn't in the team, even though they happen to have the same name as the team. If the person with the username "A-team" were to join (- isn't valid for creating usernames, so it's fine in this case), then the fake player scores you've added/removed would belong to them. I'll write an answer for how to test for fake player scores.
    – SirBenet
    Jul 28, 2016 at 14:30

1 Answer 1

1

To test for the scores of the fake player you have representing the team, you'll need to use the /scoreboard players test command. This is because normal selectors (@a, @p, etc.) only select players that are online (/say @a won't say players who are offline or don't exist, for example).

The syntax for this command is:

/scoreboard players test <player> <objective> <min> [max]

So, for your example, you'll probably want to do:

/scoreboard players test A-team health 0 0

You can use conditional command blocks to run a command when this succeeds:

enter image description here

0

You must log in to answer this question.

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