mob
var
hp = 100
maxhp = 100
percent = (src.hp/src.maxhp)*100
obj
Bar1
icon='Huds.dmi'
icon_state="bar hud 1"
New(client/C)
screen_loc = "1,10"
C.screen+=src
if (usr.percent <= 29 && usr.percent >= 25) icon_state="bar hud19"
else if (usr.percent <= 24 && usr.percent >= 20) icon_state="bar hud20"
else if (usr.percent <= 19 && usr.percent >= 15) icon_state="bar hud21"
else if (usr.percent <= 14 && usr.percent >= 10) icon_state="bar hud22"
else if (usr.percent <= 9 && usr.percent >= 5) icon_state="bar hud23"
else if (usr.percent <= 5 && usr.percent >= 1) icon_state="bar hud24"
Bar2
icon='Huds.dmi'
icon_state="bar hud 2"
New(client/C)
screen_loc = "2,10"
C.screen+=src
if (usr.percent <= 64 && usr.percent >= 60) icon_state="bar hud12(2)"
else if (usr.percent <= 59 && usr.percent >= 55) icon_state="bar hud13"
else if (usr.percent <= 54 && usr.percent >= 50) icon_state="bar hud14"
else if (usr.percent <= 49 && usr.percent >= 45) icon_state="bar hud15"
else if (usr.percent <= 44 && usr.percent >= 40) icon_state="bar hud16"
else if (usr.percent <= 39 && usr.percent >= 35) icon_state="bar hud17"
else if (usr.percent <= 34 && usr.percent >= 30) icon_state="bar hud18"
Bar3
icon='Huds.dmi'
icon_state="bar hud 3"
New(client/C)
screen_loc = "3,10"
C.screen+=src
if (usr.percent <= 94 && usr.percent >= 90) icon_state="bar hud6"
else if (usr.percent <= 89 && usr.percent >= 85) icon_state="bar hud7"
else if (usr.percent <= 84 && usr.percent >= 80) icon_state="bar hud8"
else if (usr.percent <= 79 && usr.percent >= 75) icon_state="bar hud9"
else if (usr.percent <= 74 && usr.percent >= 70) icon_state="bar hud10"
else if (usr.percent <= 69 && usr.percent >= 65) icon_state="bar hud11"
else if (usr.percent <= 64 && usr.percent >= 60) icon_state="bar hud12"
Bar4
icon='Huds.dmi'
icon_state="bar hud 4"
New(client/C)
screen_loc = "4,10"
C.screen+=src
if (usr.percent <= 100 && usr.percent >= 95) icon_state="bar hud5"
Problem description:
I am making hp bar
My problem here is that it gives error:
Battle.dm:47:error: hp/maxhp: undefined var
Battle.dm:47:error: =: expected a constant expression
it gives those from that "percent = (src.hp/src.maxhp)*100"