Changing number of health hearts

Discussion in 'Spigot Plugin Development' started by KnaxelBaby, Jun 26, 2018.

  1. Can you still increase/decrease the hearts displayed to a character on screen?
    Is that what healthscale does?

    displayedHealth = getHealth() / getMaxHealth() * getHealthScale().

    ik this is the formula to get the displayedHealth, but does it effect the players hearts?
    Is a scaled up player health going to act the same as if the player had a higher maxhealth than 20?
  2. Check this site and this as well.

    EDIT: An answer to this: no, it doesn't affect the player's hearts. Only the setMaxHealth() changes the health.

    You can experiment on this and you'll figure everything out.
    #2 darklazerog, Jun 26, 2018
    Last edited: Jun 26, 2018
  3. Actually the answer was/is yes... I just did it, Heatlh Scale = 200 and Max health = 200, basically gives the player 200 health (and it does display the extra hearts)
  4. You should work with Attributes though...
    player.getAttribute(Attribute.(GENERIC_MAX_HEALTH I think).setbasevalue(20)
    • Winner Winner x 1
  5. I must have misunderstood what you asked. The Health Scale doesn't effect the health the player can take but how many hearts it shows. As for the max health, it can be changed without having any visual effects (giving more hearts etc). I may be wrong but I'm pretty confident this is the case.
    • Friendly Friendly x 1
  6. player.setHealth(20) to be the max and to kill him player.setHealth(0)
    • Optimistic Optimistic x 1
  7. You're out of topic. And have fully misunderstood what the OP asked.
    • Friendly Friendly x 1