Actually use %this.player.getDatablock().maxDamage - %health
Yes, actually, do this. Also change the if condition to if(%health < %this.player.getDatablock().maxDamage
Actually, I think you should change so it reflects the fact that health is actually represented as damage; check if it's greater than zero, and decrement it if it's not, then set damage level to that
Something like this:
function gameConnection::HealthRegenerationBar(%this)
{
cancel(%this.healthRegenerationTick);
if(isObject(%this.player))
{
%maxDamage = %this.player.getDatablock().maxDamage;
%damage = %this.player.getDamageLevel();
if(%damage > 0)
%this.player.setDamageLevel(%damage--;);
commandToClient(%this,'BottomPrint',"Health: "@ %maxDamage - %damage @ "/" @ %maxDamage);
}
%this.healthRegenerationTick = %this.schedule(200,"HealthRegenerationBar");
}
I'd say get this working, then add in different recovery rates based on different damage amounts