how to display entity health status?

Posted By: kholis

how to display entity health status? - 05/26/10 04:31

i want to display health status above each entity head. i used panel to display it, but digits variable cannot be changed. it value always 0.0000
Code:
function create_health_panel(){
	temp_panel = pan_create("digits(0,0,5.1,*,0,my.health);",2);
}


if entity health changed, it will execute this function
Code:
function update_health(){
    if(my.state_attacked == true){my.health -= 10;}
    if(my.state_healed == true){my.health += 10;}
    pan_setvar(temp_panel,1,1.0,my.health); //update health status
}


Posted By: Ascalon

Re: how to display entity health status? - 05/26/10 06:40

try do use a global variable instead of my.health. i think this should work
Posted By: painkiller

Re: how to display entity health status? - 05/26/10 15:25

Originally Posted By: Ascalon
try do use a global variable instead of my.health. i think this should work

yes, define a var and put for example in the main loop var_health=player.health;
Posted By: kholis

Re: how to display entity health status? - 05/27/10 10:08

it works. thanks everyone laugh
© 2024 lite-C Forums