Hi, So I'm making a custom health plugin but every time the custom health int changes the numbers get out of place because I'm always dividing by 1 number. Code (Text): p.setHealth(customHealth / 5); So for example if I had 50 health the Minecraft Health bar should be full hearts of 20 and if I get damaged it should decrease based on the amount of custom health I have. But what would happen if I had a custom health of 100 and so on? What would be the proper way to do it? So basically I'm trying to make a plugin with custom health but keeping the 20 hearts bar in place.
currentcustomhealth / (totalcustomhealth * 0.2) /e might be off. currentcustomhealth/totalcustomhealth*0.2 might be the way. im exhausted and cant think about it hard enough
Shouldn't it be * 20. cause e.g. health 20, custom max health 40: 20/40*20 = 10 displayed HP = half hp
there's a way to change health scale, so it keeps at a wanted amount while health is increasing, no math needed then (but not sure if that works on 1.14.4, it does on 1.12.2 at least)