3

I want to teleport a player to a location relative to another. For example, I might want to teleport Steve so that he's exactly 50 blocks on top of Joe.

I can't use /tp, since that will teleport Steve directly onto Joe's location. Is there a way I can teleport someone to somebody else's location, but with an offset? I'd like to do this with a single command, if possible.

6 Answers 6

6

The /tp command accepts relative arguments (~), but you won't be able to do it in a single command. You may wish to use a pair of command blocks to execute them quickly and more or less seamlessly.

The following will teleport Steve to Joe, then zero blocks forward (in the x direction), fifty blocks up (in the y direction), and zero blocks to the side (in the z direction).

/tp Steve Joe
/tp Steve ~ ~50 ~

The format is as follows:

 /tp [player] <x> <y> <z> [<y-rot> <x-rot>]

More information can be found on the Official Minecraft wiki: https://minecraft.wiki/w/Commands#teleport

2

execute Joe ~ ~ ~ teleport Steve ~ ~50 ~

for teleport command, the relative coordinate is of the executor, but not the teleported entity.

1
  • 1.13 syntax: /execute positioned as Joe run teleport Steve ~ ~50 ~ (/tp could also work, because tp and teleport are the same command in 1.13)
    – pppery
    Commented Sep 1, 2018 at 18:50
0
/execute Joe ~ ~50 ~ /tp Steve @p

execute will make Joe execute it but the ~ ~50 ~ would make it execute 50 blocks above Joe's feet because relatives (~) on entities alway count from the bottom block (that is the case with blocks sometimes too, ie. doors and two-block plants). Steve is the parameter which tells the game who to teleport.

-1
/execute Joe ~ ~50 ~ /tp Steve @p
1
  • 2
    Do you think you could add some explanation of the syntax you're using?
    – two bugs
    Commented Jul 29, 2016 at 17:13
-2

You can do the following:

/execute Joe ~ ~ ~ /tp Steve ~ ~50 ~

I hope this helped.

1
  • While it seems like it should work, it doesn't. The tp commands coordinates are always relative to the entity being teleported, not relative to the coordinates the command is executed at. This command is no different from Joe typing /tp Steve ~ ~50 ~ in his chat.
    – MrLemon
    Commented Aug 28, 2015 at 15:36
-3

Well, you could teleport with coordinates.

/tp username (or @p, @a ect if you are making a custom map) x y z

XYZ are available to you when you press f3.

You must log in to answer this question.

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