How can I teleport a specific villager to a specific player?

How can I teleport a specific villager to a specific player? - Egg Omelet on Green Ceramic Plate

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!



Best Answer

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: http://minecraft.gamepedia.com/Commands#Target_selectors

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




Pictures about "How can I teleport a specific villager to a specific player?"

How can I teleport a specific villager to a specific player? - Blue and White Labeled Can Beside Clear Drinking Glass With Orange Juice
How can I teleport a specific villager to a specific player? - Book On A White Wooden Table
How can I teleport a specific villager to a specific player? - Books On The Table



How do you summon a specific villager?

How to Enter the Command
  • Open the Chat Window. The easiest way to run a command in Minecraft is within the chat window.
  • Type the Command. In this example, we are going to summon a villager in Minecraft Java Edition (PC/Mac) 1.18 with the following command: /summon villager.


  • What is the command to teleport a player in Minecraft?

    You can teleport to a set of coordinates or teleport another player using the /tp command in Minecraft (see also /teleport command).



    Minecraft Tutorial - Teleport Villagers \u0026 other Entities




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: alleksana, Guto Macedo, Ylanite Koppens, Ylanite Koppens