Hello. I'm working on a personal mod and have run into something that I can't seem to figure out, the code below is meant to prevent death for the player while an item is in the inventory, this is done by checking the player health then fully restoring it if the player has my spark in the inventory and the health is equal or less than 90 as test. The check for a black spark is a test to see what it would do.. I predicted a constantly set Health to 50.. but I want to adjust max health from 100 to 250 for example.. but setHealth(250) doesn't work.
What i'd really like is to find a way to make it so the player can go to say 10 health but won't fall below it, so that as he is mauled by the zombies, he can kill his way out then heal normally (or sped up). I want to see all the scars from the various over runs instead of the instant heal.
I played with a way to get the current health into a local variable then setHealth(currentHealth+10) to simulate fast healing but couldn't figure it out.
Anyway, any advice or examples would be great.