ID:149485
 
Ok i am using nadrews hud system and the meter demo, sorry cant remeber who made the meter demo. what i want to do is to make the health meter appear on the clients screen like this


obj/health_bar
New(client/C)
screen_loc = "3,14"
C.screen+=src

i want it to update like it would normaly and display your health. Here is the health bar code.

src.health_meter.num = (src.health/src.maxhealth)*src.health_meter.width
src.magic_meter.num = (src.mp/src.maxmp)*src.magic_meter.width

//update the meters to take on the new changes
src.health_meter.Update()
src.magic_meter.Update()

//change the meters' names to reflect the current numbers
src.health_meter.name = "[src.health]/[src.maxhealth]"
src.magic_meter.name = "[src.mp]/[src.maxmp]"

mob
var
obj/meter/health_meter

obj/meter/magic_meter

//etc.

New()
..()
src.health_meter = new //initialises the meters
src.magic_meter = new

Stat()
//calculate each meters' number (as a percentage of the total icon_states)
src.health_meter.num = (src.health/src.maxhealth)*src.health_meter.width
src.magic_meter.num = (src.mp/src.maxmp)*src.magic_meter.width

//update the meters to take on the new changes
src.health_meter.Update()
src.magic_meter.Update()

//change the meters' names to reflect the current numbers
src.health_meter.name = "[src.health]/[src.maxhealth]"
src.magic_meter.name = "[src.mp]/[src.maxmp]"

//alternatively, change their names to nothing
//comment out the above name changes and uncomment the below ones to use this method
//src.health_meter.name = ""
//src.magic_meter.name = ""

statpanel("Stats") //switch to the "Stats" statpanel



obj/meter
icon = 'meter.dmi'
icon_state = "0" //that's zero, not ( ) or O

var/num = 0 //the current unrounded icon_state number
var/width = 30
//If you have icon_states from "0" to "30" within your
// meter.dmi file (i.e. you have 31 icon_states in total),
// use this number as it is.

//Change it if you have any other number of states;
// if you have states from "0" to "5", this number would
// be 5 instead.

proc/Update()
if(num < 0) //if the meter is negative
num = 0 //set it to zero
else if(num > width) //if the meter is over 100%
num = width //set it to 100%
src.icon_state = "[round(src.num)]"

I would really appriciate if someone would help me.</0>