No updating if I do that... No errors either >.<
I can't think what the problem would ve talk to FA.
Aye :(
Try this instead:
var/list/barIcons=list()

obj/HUD/Bars
layer=10
New(var/mob/M)
if(ismob(M) && M.client) M.client.screen+=src
return ..()
proc/Update(var/barWidth)
barWidth=round(barWidth,0.01)
var/thisBarID="[initial(src.icon)][barWidth]"
if(thisBarID in global.barIcons) src.icon=global.barIcons[thisBarID]
else
var/icon/I
if(barWidth)
I=new(initial(src.icon))
barWidth=I.Width()-(barWidth*I.Width())
I.Shift(EAST,barWidth)
I.Shift(WEST,barWidth)
src.icon=I
global.barIcons+=thisBarID
global.barIcons[thisBarID]=I
HealthBar
icon='HealthBar.dmi'
//The icon should be a single state of a full bar
screen_loc="1,2"
ManaBar
icon='ManaBar.dmi'
screen_loc="1,1"

mob/var
obj/HUD/Bars/HealthBar/healthBar
obj/HUD/Bars/ManaBar/manaBar

mob/proc/SetupHUD()
if(!src.client) return
src.healthBar=new(src)
src.manaBar=new(src)

mob/Login()
src.SetupHUD()
return ..()

//Testy stuff below
mob/var
HP=30
maxHP=30
mob/verb/TestBar()
src.HP=src.maxHP
while(src.HP)
src.HP-=1
src.healthBar.Update(src.HP/src.maxHP)
sleep(1)
src.HP=src.maxHP
src.healthBar.Update(src.HP/src.maxHP)
Asakuraboy wrote:
Essentially, the hud doesn't update. The 'before call' message is displayed, but neither the 'called' or 'after call' messages are...

The initial problem was that you have to initialize the health meter object (you also have to pass its constructor the mob you're giving the health meter to).

Note: Any questions about my libraries are probably better off being placed on the hub entry of the library. I'm more likely to see it there and if you post on BYOND's forum, people aren't always knowledgeable of how my libraries work.

I'm not sure what part of it you have working and what isn't working. If you create the health meter when the player logs in and you call health_meter.update() when a mob takes damage, keep in mind that not all mobs will have health meters. Be sure to do something like this:

mob
proc
take_damage(d)
health -= d

if(health_meter)
health_meter.update(health)
It displays only one circle of hp and chi, and it doesn't update.. :(
Idk about the rest of the code issues but if you just want it to update constantly, override Stat() and place the proc you want to update constantly.
Page: 1 2