Ok, I have a have a problem with my healing spell, it works fine, everything is great, and even if you have max, it wont let you have any, but the problem is, when I have lets say 1 HP missing, it will add the full ammount (10), so the HP goes 9 over the max. Here is my code, can you help me out?
mob/proc/Heal(mob/M as mob in view(1))
set category = "Spells"
if(usr.MP<=15)
usr<<"You don't have enough MP"
if(usr.HP>=MaxHP)
usr.HP+=0
usr.MP-=0
usr<<"Game Info: Your HP is max!"
else
usr<<"You summon your power...."
usr.overlays+=/obj/overlays/HealStart
sleep(50)
usr.overlays-=/obj/overlays/HealStart
sleep(1)
usr.HP+=50
usr.MP-=10
ID:179630
Nov 26 2001, 1:02 pm
|
|
Ok, I have a have a problem with my healing spell, it works fine, everything is great, and even if you have max, it wont let you have any, but the problem is, when I have lets say 1 HP missing, it will add the full ammount (10), so the HP goes 9 over the max. Here is my code, can you help me out?
mob/proc/Heal(mob/M as mob in view(1)) set category = "Spells" if(usr.MP<=15) usr<<"You don't have enough MP" if(usr.HP>=MaxHP) usr.HP+=0 usr.MP-=0 usr<<"Game Info: Your HP is max!" else usr<<"You summon your power...." usr.overlays+=/obj/overlays/HealStart sleep(50) usr.overlays-=/obj/overlays/HealStart sleep(1) usr.HP+=50 usr.MP-=10 if(usr.hp>=usr.Maxhp) usr.hp=usr.Maxhp |
In response to Super16
|
|
o by the way the code isnt tested
|
In response to Super16
|
|
Hey, thanks alot Super16, that little bit of code worked great!
~KnightRen |
In response to Super16
|
|
Super16 wrote:
if(usr.hp>=usr.Maxhp)Did you just copy whut I posted? |
I suggest adding a general proc to handle things like this, and just call it on the numbers you need to update, mayby like this:
You could call it like this
Hope that helps
Alathon