proc
Update(mob/M)
var/icon_state_num = round(M.hp/M.maxhp)*M.maxhp
if(M.hp < M.maxhp/10&&M.hp != 0)
icon_state_num = 1
icon_state = num2text(icon_state_num)
spawn(2)Update(M)
Problem description:
I've checked what should happen with a calculator, and it should work properly. But for some reason, it doesn't.
When the user's HP is full, the HP bar is also full. But when the user's HP is any other number, the bar shows it as 0 HP.
What am I doing wrong?
Update(mob/M)
var/icon_state_num = round(M.hp/M.maxhp *100)
if(M.hp < M.maxhp/10&&M.hp != 0)
icon_state_num = 1
icon_state = num2text(icon_state_num)
spawn(2)Update(M)
try that o.o