Author Topic: My Health Display Code Won't Work  (Read 759 times)

Code: [Select]
function PlayerZombie::onDamage(%client, %obj)
{
%displayHealth = %defaultdisplayHealth - %obj.getDamageLevel()
commandToClient(%obj.client,'bottomPrint',"\c1Health: \c3" @ %displayHealth @ "/1200 HP", 3);
parent::onDamage(%client, %obj);
}
What's wrong?  I can't find any errors in it.

Edit: Yes, it's a edit.
« Last Edit: August 03, 2010, 02:00:18 AM by brickybob »

You never defined what %defaultdisplayhealth was?

You never defined what %defaultdisplayhealth was?
I did previously in the script.
...
I'm working on a zombie player with a stuffload of health and %defaultdisplayhealth is 1200 (the amount of HP the zombie has) and it's supposed to set DDH to 1200 when the script executes,
should I make it set defaultdisplayhealth when it gets damaged?  The variable doesn't change anyway.  Maybe I should just put 1200 instead of defaultdisplayhealth because it never changes anyway.
« Last Edit: August 03, 2010, 03:57:13 AM by brickybob »

any variable that begins with "%" will only exist in that function. use $defaultdisplayhealth = stuff

You should get the maximum health with the datablock's maxDamage field. What you have as the "%client" argument is actually the ID of PlayerZombie.