0

I'm trying to make a cutscene type thing where a zombie (prison guard) talks to you, then turns round and walks down a path. I know how to do the walking thing, but the turning is more difficult. I've spawned an invisible armor stand (LogPrisonGuard1) at the dimensions I want him to turn to, and I'm doing /minecraft:tp @e[name="Prison Guard"] @e[type=ArmorStand,name=LogPrisonGuard1]. When it activates however, I get this error: You must specify which player you wish to perform this action on. Any help?

2

The problem is with the @e[name="Prison Guard"] selector; you cannot use spaces in selectors, nor can you put quotation marks around strings in selectors.

I believe the error you are getting is caused by Minecraft understanding the command as having 3 arguments, which matches the /tp overload that can be used in chat but not in command blocks:

Command : /minecraft:tp
<x> : @e[name=Prison
<y> : Guard"]
<z> : @e[type=ArmorStand,name=LogPrisonGuard1]


Some potential solutions are to:

  1. Select the guard based on something else (e.g: position, tags, team)
  2. Give the guard a name without spaces (Warden, perhaps?)
  3. Use their CustomName NBT to first give them a tag, then select them from that tag.

For the third option, you'll need to run a command like this to add the tag:

/scoreboard players tag @e add IsPrisonGuard {CustomName:"Prison Guard"}

Then select them using: @e[tag=IsPrisonGuard]. This works because you can have spaces within quotations for NBT data, just not for selectors.

7
  • The command still doesn't work? /minecraft:tp @e[name=Warden] @e[type=ArmorStand,name=LogPrisonGuard1] – Knightz Jun 12 '16 at 15:21
  • @SirAlex What error is it giving? Have you got one thing called Warden, and another called LogPrisonGuard1? – SirBenet Jun 12 '16 at 16:08
  • @SirAlex Note that the second selector for /tp must resolve to a single target. If you have more than 1 "LogPrisonGuard1" armor stand, the command will fail. You can use the c parameter to force the number of targets to obtain, but be aware that it might not necessarily target the one you want if there are multiple (e.g. /tp @e[name=Warden] @e[type=ArmorStand,name=LogPrisonGuard1,c=1]). – Skylinerw Jun 12 '16 at 16:29
  • @colorfusion Yes @Skylinerw Okay, what does the c exactly do? How does it define which is which. I don't think I have more than 1 – Knightz Jun 12 '16 at 19:37
  • @SirAlex What error is it giving? c=1 won't be needed if you only have one, but it's probably good practice either way - for @e it'll select the closest one. – SirBenet Jun 12 '16 at 20:31
-1

Fixed with /entitydata @e[name=Warden] {Rotation:[180f,4f]} This data tag effects the yaw and pitch of the entity, changing the way they look. If you still need to move the entity, and you are getting this problem, have one command block that tp's them to the place, then use the above command.

1
  • 2
    Thanks for posting your solution! It would be really helpful to other users with a similar problem if you included some details on why your solution works in your answer, so they can more easily adapt it to their own situation. – Wipqozn Jun 16 '16 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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