I found this HealthRegeneration script in another post, but i cannot seem to get it to work, it looks like this:
var CurHealth : int = 100;
var MaxHealth : int = 100;
var RegenPrSec : float = 0.10;
function Update() {
regenerate();
if (Input.GetKeyDown("i")) {
takeDamage();
}
}
function regenerate() {
if (CurHealth < MaxHealth) {
CurHealth += RegenPrSec * Time.deltaTime;
}
}
As far as I can see there is no reason for it to start regenerating when below 0 and it also only goes up to 0. I don’t know much about Time.deltaTime could that be the problem?