Blockland Forums > Modification Help

My Health Display Code Won't Work

Pages: (1/1)

brickybob:


--- Code: ---function PlayerZombie::onDamage(%client, %obj)
{
%displayHealth = %defaultdisplayHealth - %obj.getDamageLevel()
commandToClient(%obj.client,'bottomPrint',"\c1Health: \c3" @ %displayHealth @ "/1200 HP", 3);
parent::onDamage(%client, %obj);
}

--- End code ---
What's wrong?  I can't find any errors in it.

Edit: Yes, it's a edit.

herb:

You never defined what %defaultdisplayhealth was?

brickybob:


--- Quote from: herb on August 03, 2010, 02:54:43 AM ---You never defined what %defaultdisplayhealth was?

--- End quote ---
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.

Plornt:

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

Space Guy:

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.

Pages: (1/1)

Go to full version