#save attribute on death?

3 messages · Page 1 of 1 (latest)

loud oriole
#

I'm trying to modify the players health and have it stay at the modified value after death, not sure if its supposed to stay modified or if its a mod compatibility issue

jovial sealBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

loud oriole
#

trying to use this but It wont do anything

EntityEvents.death(event => {
  const {player} = event
  if (!player) return
  player.persistentData.spawnhealthoverride = player.attributes.getBaseValue('generic.max_health')
  console.log(player.persistentData.spawnhealthoverride)
})

PlayerEvents.respawned(event => {
  const {player} = event
  console.log(player.persistentData.spawnhealthoverride)
  player.setAttributeBaseValue('generic.max_health', player.persistentData.spawnhealthoverride)
  player.heal(40)
})