ID:268147
 
mob/var/HealthOverlay
mob/var/MagicOverlay

mob/proc/Bars()
src.overlays -= src.HealthOverlay
var/obj/HealthBar/O = new/obj/HealthBar
var/Length = 30
<B>var/Percent = round((src.Health/src.MaxHealth) * Length)</B>
O.icon_state = "[(Percent>Length)?(Length-1):Percent]"
if(Percent==30)
O.icon_state = "30"
src.HealthOverlay = O
src.overlays += src.HealthOverlay
src.overlays -= src.MagicOverlay
var/obj/MagicBar/A = new/obj/MagicBar
var/Length1 = 30
var/Percent1 = round((src.Mana/src.MaxMana) * Length1)
A.icon_state = "[(Percent1>Length1)?(Length1-1):Percent1]"
if(Percent1==30)
A.icon_state = "30"
src.MagicOverlay = A
src.overlays += src.MagicOverlay


obj/HealthBar
icon='meter.dmi'
icon_state="29"
pixel_y=6
layer=10

obj/MagicBar
icon='Manameter.dmi'
icon_state="29"
pixel_y=6
layer=10


mob/Monster/Stat()
src.Bars()

runtime error: Undefined operation
proc name: Bars (/mob/proc/Bars)
source file: Meter.dm,8
usr: DoomedSpirit (/mob/Monster/DoomedSpirit)
src: DoomedSpirit (/mob/Monster/DoomedSpirit)
call stack:
DoomedSpirit (/mob/Monster/DoomedSpirit): Bars()
DoomedSpirit (/mob/Monster/DoomedSpirit): New(Grass (89,61,1) (/turf/Grass))
Portal (/mob/Portal): CheckDistance()
Portal (/mob/Portal): CheckDistance()
Portal (/mob/Portal): CheckDistance()
Portal (/mob/Portal): New(Grass (89,61,1) (/turf/Grass))
Kasumi Tomonari wrote:
var/Percent = round((src.Health/src.MaxHealth) * Length)
runtime error: Undefined operation
proc name: Bars (/mob/proc/Bars)
source file: Meter.dm,8
usr: DoomedSpirit (/mob/Monster/DoomedSpirit)
src: DoomedSpirit (/mob/Monster/DoomedSpirit)
call stack:
DoomedSpirit (/mob/Monster/DoomedSpirit): Bars()
DoomedSpirit (/mob/Monster/DoomedSpirit): New(Grass (89,61,1) (/turf/Grass))
Portal (/mob/Portal): CheckDistance()
Portal (/mob/Portal): CheckDistance()
Portal (/mob/Portal): CheckDistance()
Portal (/mob/Portal): New(Grass (89,61,1) (/turf/Grass))

Your problem is that one of those variables is not a number, or there's some other math problem with it.
In response to Jon88
nope, its working with my other NORMAL mob/Players..
In response to Kasumi Tomonari
Try adding in a line that outputs to world the value of src.Health and the value of src.MaxHealth and see what each says.