ID:143860
 
Code:
    potion
Health_potion
icon='hpot.dmi'
verb
take()
set src in oview(1)
usr<<"You pick up the [src]."
Move(usr)
drop()
set src in usr
usr<<"You drop the [src]."
Move(usr.loc)
drink()
if(usr.HP>=MaxHP)
usr<<"You're already at full health."
else
usr.HP+=15
usr<<"You drink the Health potion"
del(src)


Problem description:
It sais that MaxHP is an undefined variable, but then i define it as MaxHP=30+(10*Lvl), and it sais Lvl is undefined...I can't think of a way to define it without copying the entire Leveling system. Although it does work if I leave out the "if(usr.HP>=MaxHP)" and just have it add the health, whether the health is over the maximum or not...please help!
Thanks

What you are saying is… You’re MaxHp variable is undefenied, and you cannot get it to work there?

Try making it so when you gain a level to multiply your health by 10 (*10), and make sure lvl is defined too. I am kind of confused what you are asking, but I think that should be right.
You could try making it usr.MaxHP also, I doubt it will work, but it may.
In response to Flame Guardian
no, my MaxHP variable is defined under mob, but not under obj, and if I define it under obj, then i have to define lvl, and in order to define lvl, i have to define the entire leveling system.
In response to Theryster
Use usr.MaxHP not just MaxHP ..
In response to Ripiz
I did, and it still doesn't work
In response to Theryster
mob/var

MAXHP = 0

that defines the proc for your usr

only use obj/var for things that only is for a obj

also a good stop when a usr hp is still over what 15 would give him, is a return proc that way he does not drink it anyway
In response to Signaki Corp
I made a verb to punch myself, and my health starts at 40 and goes down 5 each time. but MaxHP was specified as 0, so it sais i'm at full health until i'm at less than 0.
In response to Theryster
I FIGURED IT OUT!!!
sorry, im just excited...I had MaxHP set to 30+(10*Lvl), I just realized that instead, I could just make it base 40 and add 10 when the player levels up. That way, the player's happy, the stupid potions are happy, and more importantly, i can stop throwing things out the window!
(I'm not actually throwing things out the window...i'm very sarcastic)
In response to Theryster
Just to satiate everybody's curiosity: you only defined var/MaxHP within a proc, didn't you?
In response to Garthor
yeah, hehe....