ID:145192
 
Code:DeathCheck
mob
proc
DeathCheck() //check to see if an attack is deadly
if (src.Health <= 0) //if the defender's HP is low enough...
world << "[src] dies!" //give the death messaging
usr.exp += 10
usr.Levelup()
src.loc = locate(1,1,1)
src.Health += MaxHealth


Problem description:when your Health reaches 0 it keeps declining as you get damaged, the DeathCheck isnt working.

VolksBlade wrote:
Code:DeathCheck
> mob
> proc
> DeathCheck() //check to see if an attack is deadly
> if (src.Health <= 0) //if the defender's HP is low enough...
> world << "[src] dies!" //give the death messaging
> usr.exp += 10
> usr.Levelup()
> src.loc = locate(1,1,1)
> src.Health += MaxHealth
>

Problem description:when your Health reaches 0 it keeps declining as you get damaged, the DeathCheck isnt working.


mob
proc
DeathCheck()
if (src.Health <= 0)
if(istype(src.client))
world << "[src] dies!"
usr.Levelup()
src.loc = locate(1,1,1)
src.Health == MaxHealth
else
usr.Exp += src.ExpGet
usr << "You have killed [src]!"
usr<<"You gain [src.ExpGet]!"
del(src)
else
..()


Try this
I suspect that the problem isn't as much with this proc as it is with how it's being called. Also, you may want to pass the mob doing the damage in as an argument, rather than using the ever-changing usr.

Something like this may help for your DeathCheck proc:
mob
proc
DeathCheck(mob/attacker)
if (src.Health <= 0)
world << "[src] dies!"
attacker.exp += 10
attacker.Levelup()
src.loc = locate(1,1,1)
src.Health += src.MaxHealth


And calling DeathCheck would look something like this:

mob_DEF.DeathCheck(mob_ATK)


Where mob_DEF is the the mob being hit, and mob_ATK is the one doing the hitting. Hopefully that's a bit helpful.
In response to Quxatrox
Quxatrox, if you can help someone, don't try.
src and usr in there would practically be the same, though usr might be buggy. Learn about arguments, they're sek-c.