ID:148096
 
Im trying to make HP/AP meters show as a overlay but the meters dont show up, can anyone help me please?

-----------------------------------------
mob
Login()
hp_meter=new
ap_meter=new
Update()

-----------------------------------------

obj/hud
hpmeter
icon='Meter2.dmi'
icon_state = "30"
obj/hud
apmeter
icon='MMeter2.dmi'
icon_state = "30"
mob
var
obj/hud/hpmeter/hp_meter
obj/hud/apmeter/ap_meter
proc/Update()
hp_meter.icon_state=round(hp/maxhp*30)
ap_meter.icon_state=round(ap/maxap*30)
var/n=text2num(hp_meter.icon_state)
if(n>30)n=30
hp_meter.icon_state="[n]"
n=text2num(ap_meter.icon_state)
if(n<30)n=30
ap_meter.icon_state="[n]"
overlays=list()
overlays.Add(hp_meter,ap_meter)

---------------------------------------------
The problem is indentation. You've accidentally specified an icon and icon_state for obj/hud twice instead of doing so once each for hpmeter and apmeter.

Lummox JR
In response to Lummox JR
I did that but nothing happens
In response to NightMare619
NightMare619 wrote:
I did that but nothing happens

That's not a very useful response; post the section you changed so we can actually see what you did.

Lummox JR
In response to Lummox JR
obj/hud
hpmeter <-
icon='Meter2.dmi'
icon_state = "30"
obj/hud
apmeter <-
icon='MMeter2.dmi'
icon_state = "30"
mob
var
obj/hud/hpmeter/hp_meter
obj/hud/apmeter/ap_meter
proc/Update()
hp_meter.icon_state=round(hp/maxhp*30)
ap_meter.icon_state=round(ap/maxap*30)
var/n=text2num(hp_meter.icon_state)
if(n>30)n=30
hp_meter.icon_state="[n]"
n=text2num(ap_meter.icon_state)
if(n<30)n=30
ap_meter.icon_state="[n]"
overlays=list()
overlays.Add(hp_meter,ap_meter)
In response to NightMare619
my code would look nothing like that at all o_O... my style must be really odd. Problem with being self-taught, my code is layed out really neatly.... :P
In response to Da_Rushyo
Da_Rushyo wrote:
my code would look nothing like that at all o_O... my style must be really odd. Problem with being self-taught, my code is layed out really neatly.... :P

Da_Rushyo = Just like meh! I use the old BYOND methods, I even use to use visibility until Dream Maker basicly said it was extinct!
In response to NightMare619
he meant, everything BELOW the if()'s