5

I am working on a Minecraft map and I came across this. I am trying to make a special ability so that you can summon a Zombie that doesn't attack you but attacks the other players.

2 Answers 2

6

A mob will not try to attack you if you are on the same team as it. For example, you can create a team:

/scoreboard teams add FriendlyMobs

Then add yourself and the zombie to the team:

/scoreboard teams join FriendlyMobs @p @e[type=Zombie]

You could also summon the zombie already on the team:

/summon Zombie ~ ~ ~ {Team:"FriendlyMobs"}
1
  • If Minecraft doesn't support arrays or similar implementations this wouldn't help him, because it would set everyone that uses that ability to the same team, and thus as long as you spawn your own zombie no other (spawned) zombie could attack you
    – Oak
    May 3, 2017 at 21:15
1

You could set up a contraption where it keeps the zombie away from you. Summon the zombie with a CustomName like this:

/summon Zombie ~ ~ ~ {CustomName:"NoAttackZombie"}

and then keep it away from you like this:

/execute {Your Name} ~ ~ ~ execute @e[type=Zombie,name=NoAttackZombie,r=2] ~ ~ ~ tp @e[type=Zombie,name=NoAttackZombie,r=1] ~1 ~ ~

So basically when the zombie gets close to you, it will constantly teleport 1 block away from you within a 2 block radius. However, all other players that are not running the execute command will not teleport the zombie away.

1
  • This will still have it walk towards you and try to attack.
    – user140963
    Mar 6, 2016 at 15:49

You must log in to answer this question.

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