1

I'm making a Minecraft map based on the play Hamilton, and I have a villager posing as Eliza. If you've seen the play or just know of his life, you know that Eliza is Hamilton's wife. I want a command that will teleport Eliza 2 blocks behind the player of the map. I will have the command in a repeating command block, so it will seem that Eliza is following the player around.

Because this is a singleplayer map, @p will work fine as the selector. The villager's custom name is Eliza.

Thanks in advance!

2 Answers 2

3

Summen the villager like that (He will be in "god mode" and will not move)

/summon Villager ~ ~1 ~ {CustomName:"Eliza",CustomNameVisible:1,Profession:0,Invulnerable:1,NoAI:1}

To teleport the villager to the Player put this cmd into an repeating cmd block

/tp @e[name=Eliza,type=Villager] @p

The problem is, that the villeger is exactly in the player. To soolve this, we'll add a kind of delay.

Create a scoreboard:

/scoreboard objectives add lifeTime dummy

Then a repeating cmd block chain:

/summon ArmorStand ~-2 ~ ~ {CustomName:"Follower",Marker:1b,Invisible:1,Invulnerable:1,NoGravity:1}
/scoreboard players add @e[type=ArmorStand,name=Follower] lifeTime 1
/tp @e[score_lifeTime=1,type=ArmorStand,name=Follower] @p
/execute @p ~ ~ ~ tp @e[name=Eliza,type=Villager] @e[score_lifeTime_min=20,type=ArmorStand,name=Follower,rm=2]
/kill @e[score_lifeTime_min=20,type=ArmorStand]

Setup

The player will then follow the player but will not go nearby the player (2 blocks radius)

Generator for summon commands: https://mcstacker.bimbimma.com/

Command selectors: https://minecraft.wiki/w/Commands#Target_selectors

Plugin for visible Commands: CommandDescriptor by SimonMeusel: https://www.spigotmc.org/resources/commanddesciptor.23870/

3
  • Where did the comment go?
    – user143228
    Commented May 29, 2016 at 16:30
  • Mhhhhhhhhhhhhhh Commented May 29, 2016 at 16:30
  • I found a much faster way to do this with less command blocks, see answer below.
    – rappatic
    Commented May 30, 2016 at 13:47
1

Command 1 (In a repeating command block):

/tp @e[type=Villager,name=Eliza] @p

Command 2 (In a chain command block after the repeating one):

/tp @e[type=Villager,name=Eliza] ~-2 ~ ~ 

This will have Eliza stay at least 2 blocks away from the player but follow the player around.

3
  • The problem is when you stand next to a wall the villager will get tped into the wall with my solution the villager wil. exactly follow the player Commented May 30, 2016 at 14:39
  • I agree with @SimonMeusel, this is a poor solution. Eliza won't always be behind the player, or follow the player, she'll just be in the same area.
    – MBraedley
    Commented May 30, 2016 at 21:53
  • @SimonMeusel and MBraedly: When I used it, it worked perfectly fine and was just right for the standards of the minigame (hamiltontheadventure.weebly.com).
    – rappatic
    Commented May 30, 2016 at 22:00

You must log in to answer this question.

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