(Tutorial) Teleport to Spawn Procedures (WIP)

Started by Spyjetray on Sun, 06/09/2019 - 10:02

Topic category: User side tutorials

Last seen on 19:07, 22. Jun 2019
Joined Jul 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
(Tutorial) Teleport to Spawn Procedures (WIP)
Sun, 06/09/2019 - 10:05 (edited)

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"

https://imgur.com/a/MdORQpH

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.

https://imgur.com/a/UrR0y82

3. Create a procedure that when the player respawns, it calls the first procedure to ensure they appear at the spawnpoint.

https://imgur.com/a/2KL2slw

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.

https://imgur.com/a/bbehohj

 

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.

Edited by Spyjetray on Sun, 06/09/2019 - 10:05
Last seen on 16:45, 25. Jun 2019
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
Nice tutorial :)
Sun, 06/09/2019 - 18:21

Nice tutorial :)

Last seen on 19:07, 22. Jun 2019
Joined Jul 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Glad you like it!
Sun, 06/09/2019 - 18:22

Glad you like it!

Last seen on 16:49, 25. Jun 2019
Joined Aug 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Nice tutorial ! And you can…
Wed, 06/12/2019 - 19:06

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.