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)

Active 1 year ago
Joined Feb 2018
Points:
701

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 8
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.

Active 1 year ago
Joined Feb 2018
Points:
701

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 8
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.

Active 1 year ago
Joined Feb 2018
Points:
701

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 8
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.

Active 4 years ago
Joined Sep 2018
Points:
707

User statistics:

  • Modifications: 0
  • Forum topics: 5
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 24
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.