ID:668504
 
(See the best response by Eternal_Memories.)
Code:
    DeathCheck(var/mob/Killer)
if(src.HP<=0)
if(src.client)
world<<"[Killer] Killed [src]!"// when user dies
src.HP=src.MaxHP
src.loc=locate(9,3,1)// where user spawns after
src.Deaths+=1
else
Killer<<"<b>You Killed [src] for [src.Exp] Exp" // Enemy dies
Killer.Exp+=src.Exp
Killer.LevelCheck()
usr.Gold+=2
usr.Kills+=1
del src


Problem description: how do i made the enemy respawn

World.repop will repopulate the entire world.

I would never remove the "enemy" I would just return the mob to it's starting location with no icon no density and give it a timer... Simple really..
Best response
mob/proc
DeathCheck(var/mob/Killer)
if(src.HP <= 0)
world<<"<b><font color=red>[Killer] killed [src]!"// when user dies
src.HP = src.MaxHP
if(Killer.client) Killer.Kills += 1 // If the killer isn't a NPC, it gets a kill.
if(src.client) src.Deaths += 1 // If the person killed isn't a NPC, it gets a death.
if(!src.client && Killer.client) // If the person killed is a NPC, and the killer is a real person...
Killer<<"<b><font color=red>You killed [src] for [src.Exp] exp" // Enemy dies
Killer.Exp += src.Exp
Killer.LevelCheck()
Killer.Gold += 2 // You should change it, the person'll always receive 2 gold from any kind of NPC.
if(src.client) src.loc = locate(9,3,1)// where user spawns after
if(!src.client) src.Respawn()


mob/var/Respawn_Loc

mob/proc/Respawn()
var/Old_Icon = icon
icon = null
density = 0
spawn(rand(60,120)) // waits 6~12 seconds.
density = 1
icon = Old_Icon
loc = Respawn_Loc

mob/New()
..()
if(!client) Respawn_Loc = loc


I'm not sure if it'll work, but try it!

~ I basically edited it so the NPCs won't get anything from killing / being killed, only the player gets Deaths / Kills... plus EXP + Gold if it's a NPC.
You don't need var/mob/Killer in the argument area of your deathcheck. Just do mob/Killer.
I fixed the Gold i added Killer.Gold+=src.Gold so i will give each enemy a gold so when they kill it the gold will be given to the src