Storing player coordinates?

Started by chaoticDreemur on

Topic category: Help with modding (Java Edition)

Last seen on 11:59, 21. Apr 2022
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Storing player coordinates?

Hi! 

I'm trying to add a back command to my mod (basically like those plugins for servers) that teleports you to your last death location. I was obviously able to set up the command, but I'm trying to also have a procedure that activates when you die and stores your death coordinates for the sake of the command. Problem is, I have no idea how to do that. Is there a way for that to be possible with MCreator?

Last seen on 20:50, 24. Apr 2024
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You basically create three…
Sun, 04/03/2022 - 06:01

You basically create three custom global variable, it must be "PLAYER_PERSISTENT" of type "number". Those are the player coordinates.

 

 

 

Then create a procedure, make sure the global trigger is set to "Entity dies". Add an if statement that checks if the entity that died is the player. inside the if statement, set the global variables to the player coordinates.

 

 

Finally, create a procedure from your command element "When command executed" trigger. In the procedure, drag out "Set Location of Entity to:" then replace the x, y, and z with the 3 global variables.

 

 

 

I haven't tested if it works or not, so you better try it out.