Started by
N00BTO0B89
on
Topic category: Help with Minecraft modding (Java Edition)
im having issues healing a boss ive created to full health when it spawns in, currently mcreator doesn't allow this boss to have the max amount of health that I wanted to so I had to find a work around for it I have it set so when the boss spawns in its max health gets set to 50000 but because of this it needs to heal to max health before being able to fight I currently haven't found a single way to heal it to max health either instantly or over a quick period of time
Not totally sure why it needs 50,000 health, but yes, I imagine that's outside the allowed bounds of the game. Normally, you would just set the entity's current health to it's max health, and it wouldn't be an issue. If this is causing problems, you could consider using absorbtion hearts... or just not giving the boss so much health? You can add built-in armor if you're worried about players defeating it to quickly. 50,000 is just really absurd. The warden is meant to be basically unkillable, and it only has, like, 500 hearts.
You could also just make your own health system. Make the entity invincible, but instead decrease some NBT tag or variable whenever it would normally take damage.
so the big thing is that its meant to be used on a modded server and that there are tons of weapons in this server that could deal a very decent amount of damage. my main struggle isn't giving it the health its making it regen to max health almost how the wither is where when it spawns in it heals itself to max and then starts attacking.
Oh, if you just want it to regen quickly, that's much easier. You could simply make a procedure that adds health, (by setting its current health to its current health plus a certain amount every tick), which would cause its health to increase at a constant rate. If you wanted to be a bit fancier, you could make it recover a percentage of its missing health each time the procedure runs. (You would instead make the amount added to its current health the result of multiplying the difference between max and current health by a given percent), which would cause it to heal proportionally faster the more hearts it's missing.
Because the procedure will likely run every tick, if you want it to heal less than half a heart per 20th of a second, (the equivalent of recovering 10 hearts every second, which seems like a bit much), you could add an NBT tag to the entity that acts as a timer between heals; countdown the tag each tick, and when it reaches zero, reset the tag and heal the entity.
thank you so much ill give this a try