Ok, who ever is reading this here is my problem. I am using spuzzums health meter code, but it doesnt suit my needs, iv changed it to work with my coding. But i dont want an option to add or decrease randome amounts of health, i want it so that when a mob attacks you, the amount of health goes down along with the picture changing. And vise versa when you eat food. Heres the code, if you get what i mean plz help. Heres the code.
mob
var
obj/meter/health_meter
Health=30
MaxHealth=30
Exp=0
MaxExp=10000
Level=1
Attack=5
Stat()
statpanel("Stats")
stat("Health:",src.health_meter)
stat("Attack Power",Attack)
stat("Level",Level)
New()
..()
src.health_meter = new //initialises the meters
src.health_meter.num = (src.Health/src.MaxHealth)*src.health_meter.width
src.health_meter.Update()
src.health_meter.name = "[src.Health]/[src.MaxHealth]"
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)]"
</0>
ID:267100
![]() Dec 5 2002, 5:33 pm (Edited on Dec 6 2002, 5:27 pm)
|
|