ID:149337
 
obj/HPBar
icon = 'hpbar.dmi'
layer=1000000001
New(client/C)
screen_loc = "8,13"
icon_state = null
C.screen += src
Update(C)

proc/Update(client/C)
var/mob/M
for (M in world)
if (M.key == C.key)
src.icon_state = "[round(((M.powerlevel / M.Maxpowerlevel) * 100) / 3.33333333)]"
spawn (5) Update(C)

is my code, relogging gets this error.. never used to..


runtime error: Cannot read null.key
proc name: Update (/obj/HPBar/proc/Update)
source file: HUD.dm,13
usr: null
src: HPBar (/obj/HPBar)
call stack:
HPBar (/obj/HPBar): Update(null)
HPBar (/obj/HPBar): Update(null)
http://www.byond.com/hub/Sariat/BYONDcodeclient

There is a example of a healthbar.
In response to Sariat
Sariat wrote:
http://www.byond.com/hub/Sariat/BYONDcodeclient

There is a example of a healthbar.

But, i dont want the "add health" "subtract health" thing, i want it Auto update, inwhich it was fine for along time till now! >_<
In response to RaeKwon
RaeKwon wrote:
Sariat wrote:
http://www.byond.com/hub/Sariat/BYONDcodeclient

There is a example of a healthbar.

But, i dont want the "add health" "subtract health" thing, i want it Auto update, inwhich it was fine for along time till now! >_<

Then just call the proc! add health and subtract health are just there for example.