2

I'm making a map and I need to give the player +1 for taming a wolf but I don't know the command. All I know is /scoreboard objectives add tame {part I don't know}. Then some command block that gives them the point. Then maybe testfor @p[score=tame=1].

All the commands I tried are:

  • testfor @p[team=start]
  • scoreboard objectives add tame{I don't know}
  • scoreboard players set @p{I don't know}
4
  • I'm not sure this is possible. stat.useItem.minecraft.bone doesn't work. You can track number of animals bred, but not how many animals you've tamed.
    – Unionhawk
    Oct 8, 2014 at 7:05
  • It's not possible. Minecraft does not track number of mobs tamed. The closest thing that is tracked to the ## of mobs tamed is the ## of mobs bred.
    – aytimothy
    Oct 8, 2014 at 8:02
  • Actually.. Can you track wolves based on the name of the owner? (If this is possible, then you'll have to setup a detector for every single player); along the lines of @e[type=TamedWolf,Owner=...] or something like that.
    – aytimothy
    Oct 8, 2014 at 8:46
  • Can it be ,Owner=@p] Oct 8, 2014 at 23:46

1 Answer 1

3

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:

  • Players don't have a "wolves tamed" statistic
  • Wolves don't have a "tamed" entry in their NBT, and it's not possible to look for an empty "ownerUUID"

Start with the following commands.

/scoreboard objective add isTamed dummy
/scoreboard objective add wolvesTamed dummy Wolves Tamed

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

/scoreboard players add @e[type=Wolf] isTamed 1 {Sitting:1}
/scoreboard players add @e[type=Wolf,score_isTamed_min=3] isTamed -1
/execute @e[type=Wolf,score_isTamed=1,score_isTamed_min=1] scoreboard players add @p[r=3] wolvesTamed 1 

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 their wolvesTamed 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.

2
  • +1 This may work... Except tamed wolf counts; the scoreboard scores will go haywire if two (or more) guys stood inside (or close to) each other when the wolves are asked to sit (doesn't matter who tamed which one). Of course this will work, but it won't count properly in such event. Basically: Nice workaround, but it only works if players are not close to each other when the sitting happens as it may award the score to the wrong person.
    – aytimothy
    Oct 8, 2014 at 10:37
  • Very nice. Out of curiosity though, what happens in the event of breeding? Obviously not part of the original question, but sit a thought :) +1
    – Ben
    Oct 8, 2014 at 13:29

You must log in to answer this question.

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