ID:272985
 
Hello, I seem to be having trouble implementing NPCs with out having players disconnect if a NPC kills them or if anyone kills them.

This is the original death proc unedited, I would really like and appreciate if someone could help make a proc to go with this code that would.."If a player kills a NPC than a NPC is deleted. If a Player kills a Player usual death proc situation. if a NPC kills a Player usual death proc situation.

And here's the code.

DeathCheck()
spawn(1)
usr.Unlock()
if(le<=0)
if(icon=='Barrier.dmi')
del src
usr<<"You have defeated [src]!"
src<<"[usr] has defeated you."
src.le=src.mle
if(usr.le==usr.mle)
usr.pkills+=1
if(usr.le<=4)
usr.cckills+=1
usr.kills+=1
src.deaths+=1
if(usr.team=="B")
bluescore+=1
if(usr.team=="R")
redscore+=1
if(usr.team=="G")
greenscore+=1
if(usr.team=="Y")
yellowscore+=1
if(chartype=="GBD")
usr.le=0
usr.DeathCheck()
spawn(1)
if(barr==1)
for(var/mob/Barrier/C in world)
if(C.owner==src)
del C
spawn(1)
chartype=""
overlays=null
icon=null
barr=0
direction="right"
loc=locate(,,)
status="g"
canmove=1
delayattack=0
shotdelay=0
LockShow()
usr.Unlock()
Stop using usr in your procs. It's wrong.

mob/verb/kill(var/mob/M)
M.hp = 0
M.deathcheck(src)

mob/proc/deathcheck(var/mob/killer)
if(hp <= 0)
world << "[killer] killed [src]"
del(src)

mob/monster
deathcheck(var/mob/killer)
if(hp <= 0)
world << "[killer] killed [src]"
killer.exp += 1
del(src)

mob/player
deathcheck(var/mob/killer)
if(hp <= 0)
world << "[killer] killed [src]"
if(istype(killer, /mob/player))
killer.pks += 1
loc = locate("RESPAWN")