The command to check if anyone on team red
has killed an ocelot is
/testfor @a[score_leader_stat=1, team=red]
Note that there's an underscore between score
and leader_stat
, not an equal sign!
Get the output of that command block and hook it into two other command blocks with
/tp @a[team=red] x y z
/tellraw @a {text:"Red Team has slain the Ocelot!", color:red}
In a 1.8 snapshot, you could also use
/title @a title {text:"Red Team has slain the Ocelot!", color:red}
to get a large text display.
You will need a set of such command blocks for every team and every possible leader. Note that if red team's leader is an Ocelot as well, they will also win the game by killing their own leader.
Currently, your command setup has a few problems. You've got two different scoreboard scores for the two teams, displaying those scores in different locations, and adding a point to all players (by using just @a
without specifying which players you actually want).
The simple solution is to use a team selector in your point-increment system.
/scoreboard players add @a[team=TeamName] PointsName 1
Boom. Your system, as you have it designed right now, will work. This will select all of the players on TeamName and give them a point in their designated scoreboard.
However, from a design standpoint, there's a much better way to do this by using fake players. To start, set up just one scoreboard and put it in the sidebar:
/scoreboard objectives add points dummy Points
/scoreboard objectives setdisplay sidebar points
Now, the /scoreboard players
command doesn't actually require you to specify a player that is online. In fact, that player doesn't even need to exist. But it will happily keep a score for them. So, whenever you want to increment the team score, you can just do this:
/scoreboard players add Team points 1
What this will give you is a scoreboard that keeps track of team points in one entry, in one scoreboard. That way, players can compare, at a glance, what the score is, without needing to rely on the tab menu.
Best Answer
This solution is based on defining the person closest to a wolf when it first sits down as it's tamer.
The reason for this workaround is twofold:
Start with the following commands.
This will add an objective that is used to check for tamed wolves, and another for the players.
Now run the following commands on a clock
This will continuously increase the
isTamed
objective by 1 as long as the wolf sits. This is followed by decreasing it by one if it is greater than 2 (this is not technically necessary, but keeps the scores low)In addition, the player closest to a wolf (and within 3m) with an
isTamed
score of exactly 1 (which can only happen when it first sits down) will have theirwolvesTamed
score increased by 1.There might be an issue with the last command, because wolves might not be able to use "cheats". In this case, you would need to find a way to use the
/trigger
command instead.