# How do I make the player teleport like a chorus fruit would make them.

Started by phoenix_wb on Tue, 03/24/2020 - 01:44

Topic category: Help with modding (Java Edition)

Last seen on 09:38, 31. Mar 2020
Joined Feb 2020
User points:

User statistics:

• Modifications:
• Forum topics:
• Wiki pages:
• Tracker tickets:
• MCreator plugins:
How do I make the player teleport like a chorus fruit would make them.
Tue, 03/24/2020 - 01:44

The title is pretty self explanatory, but I just want to make the player teleport when right clicked on an item like a chorus fruit would make it.

Last seen on 20:57, 21. Jan 2021
Joined Jun 2015
User points:

User statistics:

• Modifications:
• Forum topics:
• Wiki pages:
• Tracker tickets:
• MCreator plugins:
You can generate a random…
Wed, 03/25/2020 - 14:43

You can generate a random number, and then, you teleport the player to his coordinates plus (or minus) the random nubers
This teleports randomly the player at 5 blocks from his location, max
if (random(0,1) < 0,5):  <--- This is a random number to determine if the random range will be minus or plus current x
if (random(0,1) < 0,5):    <--- This is a random number to determine if the random range will be minus or plus current z
set (local nx) to random(0,5)
set (local nz) to random(0,5)
move player to x=x+nx, y=y, z=z+nz
else:
set (local nx) to random(0,5)
set (local nz) to random(0,5)
move player to x=x+nx, y=yn z=z-nz
else:
if (random(0,1) < 0,5):
set (local nx) to random(0,5)
set (local nz) to random(0,5)
move player to x=x-nx, y=y, z=z+nz
else:
set (local nx) to random(0,5)
set (local nz) to random(0,5)
move player to x=x-nx, y=yn z=z-nz