Instant Teleportation
Allows you to instantly teleport a player to a specified position
Template
function mapcraft:built_in/instant_tp/main
Parameters
- MC_PlayerXPlayer X position
- MC_PlayerYPlayer Y position
- MC_PlayerZPlayer Z position
- MC_PlayerRxPlayer Rx position
- MC_PlayerRyPlayer Ry position
In what cases is it useful ?
- You generate coordinates via variables and you want to teleport the player to them
- You want to create a homecontrol for your server
- You create checkpoints for your game
Usage
To teleport a player to the desired position, just change the value of the above variables to the desired value before teleportation.
Then call the function, the player will be immediately teleported to the indicated position.
The teleportation must be done immediately after modifying the variables (in the same tick), otherwise they will be reset to their initial state.
Example
The player will be teleported after the modification to the coordinates (21, 65, -174, 12, 45)
scoreboard players set @s MC_PlayerX 21 scoreboard players set @s MC_PlayerY 65 scoreboard players set @s MC_PlayerZ -174 scoreboard players set @s MC_PlayerRx 12 scoreboard players set @s MC_PlayerRy 45 function mapcraft:built_in/instant_tp/main
If some variables are not changed, the position and orientation on these axes will remain the same when teleporting. In other words, if the player is in (10, 20, 30, 0, 90), and only X, Y, Z and Rx are changed, his future position will be (51, 20, -78, 45, 90)
scoreboard players set @s MC_PlayerX 51 scoreboard players set @s MC_PlayerZ -78 scoreboard players set @s MC_PlayerRx 45 function mapcraft:built_in/instant_tp/main