obj
heal
icon = 'heal.dmi'
verb
Take()
set src in view(1)
if(usr.maxhp - usr.hp >= 10)
usr.hp += 10
del(src)
if(usr.mhp - usr.hp <= 9)
usr.hp += (usr.maxhp - usr.hp)
del(src)
I made it so when an enemy is killed a health globe drops. I am able to make it so that hp can be restored when the heal is picked up, but i'm having trouble making it so that if the player has max hp or under 10 hp missing (the heal heals for 10) it doesn't make the player's hp higher than the max hp. The problem I encounter is when the character has more than 10 hp missing it works fine, but when he has 9 or less hp missing the heal does nothing.
Two situations exist, your hp is depleted by more than 10 or it damaged by less than 10. In the else case, simply set hp to the max hp and problem solved.
Your main issue was that you were deleting SRC before the second if statement came up. Do not del(src) until the very end of the verb usage.