ID:261410
 
When a PC trys to attack a NPC it gives me a big yucky error.
Here is all the code I have for my attack.
mob
verb
Attack(mob/M as mob in oview(1))
var/damage = usr.strength - M.def
if(damage <= 0)
usr << "[M] easily dodges your attack!"
M << "You easily dodge [usr]'s attack."
else
M.HP -= damage
view() << "[usr] attacks [M] for [damage] HP!"
M:deathcheck()


mob
NPC
proc
deathchecknpc()
if(src.HP <= 0)
view() << "[src] dies!"
del(src)

mob
PC
proc
deathcheck()
if(src.HP <= 0)
view() << "[src] dies!"
src.HP = 10
src.Hunger = 10
src.Thirst = 10
src.Move(locate(2,2,1))
usr.strength += 1
usr.def += 1


Here is the big error.
runtime error: undefined proc or verb /mob/NPC/Worm/deathcheck().

proc name: Attack (/mob/verb/Attack)
usr: GM Little Sally (/mob/PC)
src: GM Little Sally (/mob/PC)
call stack:
GM Little Sally (/mob/PC): Attack(Worm (/mob/NPC/Worm))


well it looks to me like its doing a death check for NPC/Worm not just NPC although i cant help you i can get that much out of it, but what i normaly do is make one death check like

if(M==client)
//player death check stuff here
else
//npc check here.
Little Sally wrote:
When a PC trys to attack a NPC it gives me a big yucky error.
Here is all the code I have for my attack.
> mob
> verb
> Attack(mob/M as mob in oview(1))
> var/damage = usr.strength - M.def
> if(damage <= 0)
> usr << "[M] easily dodges your attack!"
> M << "You easily dodge [usr]'s attack."
> else
> M.HP -= damage
> view() << "[usr] attacks [M] for [damage] HP!"
> M:deathcheck()
>
>
> mob
> NPC
> proc
> deathchecknpc()
> if(src.HP <= 0)
> view() << "[src] dies!"
> del(src)
>
> mob
> PC
> proc
> deathcheck()
> if(src.HP <= 0)
> view() << "[src] dies!"
> src.HP = 10
> src.Hunger = 10
> src.Thirst = 10
> src.Move(locate(2,2,1))
> usr.strength += 1
> usr.def += 1
>

Here is the big error.
runtime error: undefined proc or verb /mob/NPC/Worm/deathcheck().

proc name: Attack (/mob/verb/Attack)
usr: GM Little Sally (/mob/PC)
src: GM Little Sally (/mob/PC)
call stack:
GM Little Sally (/mob/PC): Attack(Worm (/mob/NPC/Worm))



You don't have a proc defined under /mob/NPC/ called deathcheck() The proc you have defined there is called deathchecknpc() You forgot 3 letters, that's all...
In response to Xooxer
my way is simpler i think because all the dckecks can be into one. That way you dont have a millon codes for every class. You can use the same code for all.