Using .setMaxHealth()

Discussion in 'Plugin Development' started by Code0, Feb 19, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Code0

    So, straight to the point, I've been looking around the internetz and studying the docs, but I guess I'm just not able to figure out how the hell setMaxHealth works.

    I've create a wolf object and tried to use setMaxHealth to make it semi-invincible. However, the wolf just acts as if it had normal health. No errors whatsoever in the console.

    Thanks in advance.
     
  2. Offline

    Funergy

    @Code0 Just like vanilla if you give them healthboost it just adds some hearts.
    But you need to heal them after that. Or wait to let the regen do his thing
     
    Code0 and Hawktasard like this.
  3. Offline

    ChipDev

    Try it on yourself. :)
    Or listen to the awesome @Funergy
     
    Funergy likes this.
  4. Offline

    Zombie_Striker

    You have to set it's health to be the max. What you are currently doing is saying that in can be semi-Immortal, not that it will be.
     
  5. Offline

    pablo67340

    If you want to make him semi invincible Couldnt you use EntityDamageEntity event and make it regen a set amount of hearts (in config) every hit? so say a diamond sword does 4 hearts of damage, you can make him heal 3 hearts every hit technically only doing 1 damage? Idk just a thought. not sure if i quite understand what you asked :p
     
    Code0 likes this.
  6. Offline

    Code0

    Just so noone else tries to come up with something, I 'll try out @Funergy's answer. Thanks everyone for your help. I didn't think it would turn out to act like the health boost for players.
     
Thread Status:
Not open for further replies.

Share This Page