Topic category: User side tutorials
While I've been working on my Infinity Gauntlet mod, I wanted the Space Stone to teleport the user to their spawnpoint but I could not find any tutorials on how to do this so I have created some quick teleport to spawn procedures to help with any other people who want to know how to make this.
1. Create some global_world variables called "SpawnX", "SpawnY" and "SpawnZ"
2. Create a procedure that when the player sleeps in a bed, it sets the 3 variables to the player's current x,y,z position and then sets the spawn to the 3 variables.
3. Create a procedure that when the player respawns, it calls the first procedure to ensure they appear at the spawnpoint.
4. Finally, create a procedure that teleports the player to SpawnX,SpawnY,SpawnZ. Add this procedure to the item or block you wish to cause teleportation with.
I hope this helps, if you have any improvements you would like to share, I would love to see them as this is just a work in progress procedure until something better can be found.
Nice tutorial :)
Glad you like it!
Nice tutorial ! And you can use the same procedure for make a /home command. (As I made for my mod Farm Adventure), but you have just to get x, y z (with global variables) when player execute /sethome (for example), and when player execute /home you teleport him to the coordonates.
Does this sett the world spawn for everyone???
I really liked this just one thing I did everything and when I went to the end it just tp me to some random place. Can you pls help with this and I followed the code directly.
It works in the overworld though
Is there a way to reset this once the bed is broken?