Saving an nbt tag or other variable set to a player through death

Started by kackalack on Sat, 10/05/2019 - 16:43

Topic category: Help with MCreator modding

Last seen on 22:14, 12. Nov 2019
Joined Feb 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Saving an nbt tag or other variable set to a player through death
Sat, 10/05/2019 - 16:43

I am trying to create a mod that will need to track how many times a player has died. I am attempting to use nbt tags to track this, where on player join a value is set, and on each respawn the value is adjusted. But I did not think that an entities data number would be reset when they died. How could I go about saving the deaths counter of the player so it persists through death? I could try and use a global variable to track it, but I am needing this to work in multiplayer with multiple players each with their own death counter. Could I create a "ghost" chest, much like an ender chest that I could assign nbt tags to for each player, but that would create the problem of establishing the name for the tag and it being unique per that player. I am new to mcreator and minecraft modding, so it might be something obvious I could do. 

Saving deaths in entity NBT…
Sat, 10/05/2019 - 21:16

Saving deaths in entity NBT is not possible as NBT is removed upon death. You might need to use global variables for this.

Last seen on 22:14, 12. Nov 2019
Joined Feb 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
The nbt being removed is…
Sun, 10/06/2019 - 16:57

The nbt being removed is what I found out while trying my original idea. But how would I create a global variable that is specific to the player?

You could use global_session…
Mon, 10/07/2019 - 16:20

You could use global_session variable which is specific per Minecraft client instance.

Last seen on 22:14, 12. Nov 2019
Joined Feb 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
How would I go about saving…
Wed, 10/09/2019 - 03:13

How would I go about saving the data, so on relog it is not reset?

Use session variable only to…
Wed, 10/09/2019 - 10:32

Use session variable only to transfer variable between deaths, then assign the value back to NBT tag.