1
Command help
I'm creating a minigame, and I want to have a command block hooked up to a clock that teleports a villager 10 blocks below me so I can control him. I tried using /execute, but I can't figure out how to do what I want. Any help please?
Create an account or sign in to comment.
9
1
This should work, it is a bit round-a-bout, but I can't think of any other way to do it
Put all these commands on a /fill clock, so they activate in this order:
/execute @a ~ ~ ~ /summon ArmorStand ~ ~-10 ~ {CustomName:"placeholder",CustomNameVisible:1,Marker:1b,NoGravity:1}
/tp @e[type=Villager,name=example] @e[type=ArmorStand,name=placeholder]
/kill @e[type=ArmorStand,name=placeholder]
If you need help with getting them in the right order, you can use this one command generator: http://mrgarretto.com/cmdcombiner
I haven't actually tested it, but I am pretty sure the syntax is right, so it should work.
Put all these commands on a /fill clock, so they activate in this order:
/execute @a ~ ~ ~ /summon ArmorStand ~ ~-10 ~ {CustomName:"placeholder",CustomNameVisible:1,Marker:1b,NoGravity:1}
/tp @e[type=Villager,name=example] @e[type=ArmorStand,name=placeholder]
/kill @e[type=ArmorStand,name=placeholder]
If you need help with getting them in the right order, you can use this one command generator: http://mrgarretto.com/cmdcombiner
I haven't actually tested it, but I am pretty sure the syntax is right, so it should work.
1
That's a good idea. I'll give it a shot. Thanks.
1
Happy to help!
1
One way you could do it is by using two commands; one to teleport the villager to you, and one to teleport it 10 blocks below itself. You'll have to position the command block correctly, though. (So that the first runs before the second, I guess?) I didn't experiment a whole lot with single commands, though, so there might be a way to do it with only one command.
1
Depends what the minigame is, if you are planning to have multiple players playing then you would have to make a different villager for each player. Set player one's score to 1, player two's to 2 etc.
then /execute @a[score_Team(or whatever scoreboard objective you have)_min=1,score_Team=1] ~ ~ ~ /tp @e[type=Villager,name=PlayerOne] ~ ~-10 ~
then /execute @a[score_Team(or whatever scoreboard objective you have)_min=1,score_Team=1] ~ ~ ~ /tp @e[type=Villager,name=PlayerOne] ~ ~-10 ~
1
That moves the villager to a position relative to him. I need to move him to a position relative to me.
And it's only one player, but if I want to change it later, I will.
And it's only one player, but if I want to change it later, I will.
1
The villager has to be unique, either a custom name or scoreboard objective usually works. Let's assume the villager is called Bob. The command is:
/execute @p ~ ~ ~ tp @e[type=Villager,name=Bob] ~ ~-10 ~
/execute @p ~ ~ ~ tp @e[type=Villager,name=Bob] ~ ~-10 ~
1
That teleports Bob to 10 blocks below Bob, which, on a clock, would shoot him into the void pretty quickly. I'm not talking about controlling him with pressure plates- I mean teleporting him below my constantly, so if I move to the right, he moves to the right ten blocks below me.
1
Ah yes, my apologies.