Author Topic: Quick Question about player health  (Read 349 times)

Quick help, whats the variable/function to get a player's health?  Is this correct?:
Code: [Select]
%health = %client.player.getDatablock().Health;
Here's the code i'm trying to incorporate.

Code: [Select]
                %health = %client.player.getDatablock().Health;

if(%health <= 10)
{
%healthcolor = "ff0000";
}
else if(%health <= 25 && %health > 10)
{
%healthcolor = "ffff00";
}
else if(%health <= 50 && %health > 25)
{
%healthcolor = "ffcc00";
}
else if(%health <= 75 && %health > 50)
{
%healthcolor = "ccff00";
}
else if(%health <= 100 && %health > 75)
{
%healthcolor = "00ff00";
}
else
{
%healthcolor = "ffffff";
}
%client.infobartext = %client.infobartext @ "\c6Health: <color:" @ %healthcolor @ ">" @ %health @ "\c6%";

Take the max health (from the data block) and subtract the damage  (from the player object)

%health = %client.player.dataBlock.maxDamage - %client.player.getDamageLevel();