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

Started by kackalack on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Saving an nbt tag or other variable set to a player through death

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.

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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?

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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?

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If there was some way to get…
Thu, 01/09/2020 - 08:27

If there was some way to get/set scoreboard values then this issue could be solved.