Alright i got a code i can't seem to make. It's a Health Hud that shows your health :P, but i made one and you got to DoubleClick the HUD every time you get hit or want to see how much damage was inflicted. I want to know how to just let it refresh and not having to Double Click.
obj/Health
icon = 'HealthExp.dmi'
icon_state = "0"
layer = MOB_LAYER+100
DblClick()
usr<<"[usr.Health]/100"
if(usr.Health == 100)
icon_state = "1"
if(usr.Health ==95)
icon_state = "2"
if(usr.Health ==90)
icon_state = "4"
if(usr.Health ==85)
icon_state = "7"
if(usr.Health ==80)
icon_state = "8"
if(usr.Health ==75)
icon_state = "10"
if(usr.Health ==70)
icon_state = "15"
if(usr.Health ==65)
icon_state = "18"
if(usr.Health ==60)
icon_state = "20"
if(usr.Health ==55)
icon_state ="20"
if(usr.Health ==50)
icon_state = "21"
if(usr.Health ==45)
icon_state = "21"
if(usr.Health ==40)
icon_state = "22"
if(usr.Health ==35)
icon_state = "22"
if(usr.Health ==25)
icon_state = "23"
if(usr.Health ==20)
icon_state = "23"
if(usr.Health ==15)
icon_state = "27"
if(usr.Health ==10)
icon_state = "24"
if(usr.Health ==5)
icon_state = "25"
if(usr.Health ==0)
icon_state = "25"
New(client/C) screen_loc = "[world.view+1],[world.view+2]", C.screen+=src
ID:148196
Jun 1 2003, 9:57 am
|
|
I think you just need to create a Damage() proc that combines several functions, such as damaging the mob, checking to see if it died, and updating the health meter.
Oh, and I propose a better way of determining which state is needed for the health meter's current level of health, since using a bunch of if() checks is a really nasty way to do it. So, create a meter that has 33 states, from 0 to 32. Then have the state determine like this: <code>round(32 / max_value * current_value)</code> Where max_value is the max HP, and current_value is the player's current HP. The 32 is also the number of states (minus one) that the meter has. |
In response to Lummox JR
|
|
what is this metersize var? explain to me what it's for
|
In response to JohnReaper
|
|
JohnReaper wrote:
what is this metersize var? explain to me what it's for That's just filler I put in for the maximum number you can use for the icon state of the meter. In Spuzzum's snippet that works out to 30, but it might be less or more depending on the way you draw your meter icons. Lummox JR |
In response to Lummox JR
|
|
Can you give me the url to Spuzzums demo?
|
In response to JohnReaper
|
|
Lummox JR