Wow, been a while since I've had to write anything on this board, that wasn't an answer to a problem. Lol. Anyways, I am basically trying make my stat function display a certain amount of hearts, depending on how many the player has left. I need it to display a seperate icon for each heart, all side by side. My current code is this, I turned it into a demo. Thats sad, I can make it a demo, but I can't fix the problem. Simply paste this into a new DM enviroment, add a heart.dmi file (I made my icon pure red :P), compile, run, fiddle, solve, report back with the simple solution, and laugh it me! It's just that simple! (Also, I was fiddling with the '2' heart thing, as you can see.)
mob
Stat()
..()
statpanel("Status")
stat("Hearts:","[hearts]/unused")
var/icon/B = new('heart.dmi')
switch(hearts)
if(1)
stat("Hearts meter:",hearts_meter)
if(2)
stat("Hearts meter:","[B]\icon[hearts_meter.icon]\icon[hearts_meter]")
if(3)
stat("Hearts meter:","[hearts_meter][hearts_meter][hearts_meter]")
if(4)
stat("Hearts meter:","[hearts_meter][hearts_meter][hearts_meter][hearts_m eter]")
if(5)
stat("Hearts meter:","[hearts_meter][hearts_meter][hearts_meter][hearts_m eter][hearts_meter]")
New()
..()
hearts_meter = new
hearts_meter.icon = 'heart.dmi'
hearts_meter.name = ""
mob/var
hearts = 1
obj/hearts_meter
mob/verb
set_hearts(val as num)
hearts = val
usr << "Hearts set to [val]"
obj/hearts_meter
icon = 'heart.dmi'
name = ""
ID:149398
![]() May 8 2002, 8:15 pm
|
|
You can get around some of the icon problem by generating various icons (like one with 5 hearts, one with 4 hearts, etc.) and just putting an obj in the stat panel whose icon_state is changed to reflect the current health. However, I'd suggest that if you want something that graphical, you should go for a HUD anyway.
Lummox JR