ID:734429
 
(See the best response by LordAndrew.)
Code:
mob/proc
DeathCheck(var/mob/Killer)
if(src.HP <= 0)
view()<<"<b><font color=red>[Killer] killed [src]!"// when user dies
src.HP = src.MaxHP
src.MP = src.MaxMP
src.Stamina = src.MaxStamina
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 and for [src.Gold] Gold" // Enemy dies
Killer.Exp += src.Exp
Killer.LevelCheck()
Killer.Gold += src.Gold // 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.PenguinTownSpawn) src.loc = locate(7,5,2)
if(src.blood) src.loc = locate(38,69,1)
if(!src.client) src.Respawn()


mob/var/Respawn_Loc

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

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


Problem description: Well the mobs keep on dying by players figured out in beta test they keep on dying even when the death proc is working and they keep on attacking thats amazing (NOT)
I'm not quite sure what you're trying to ask here. Are you saying that even after players kill enemies, they can keep attacking them? That would be because there's not necessarily anything saying that players cannot do that.

Your DeathCheck() procedure is also horrendously confusing. You repeatedly do checks to see who is and isn't a client without any real regard for proper structure.

Also this line here is wrong: spawn(rand(600,1200)) // waits 6~12 seconds. It's actually 60 to 120 seconds.
I know its 60 secs and hmm the thing with the killing enemies is that even due there dead the players can kill them and they can kill the players also something i didnt add they could attack there own friends other words the other enimies
mob/verb
Attack()
flick("Attack",src)
for(var/mob/Enemies/S in world)
for(var/mob/M in get_step(src,src.dir))
if(M != src) // you could also edit this in the future, so it doesn't attack people allied to you, etc etc.
overlays += 'Attack.dmi'
var/Damage=max(0,src.Str-M.Def)
view(M)<<"[src] hit [M] for [Damage] Damage!"
M.TakeDamage(Damage,src)
overlays -= 'Attack.dmi'
if(S.Dead)
usr<<"<font color=white>It's allready dead</font>"
return
You aren't calling DeathCheck in that snippet .. is it in TakeDamage?
Oh deathcheck
Well Take damage takes damage from the src and the src.HP 0 helps me make it so that when the src is low to 0 health it will fire up the death proc
In response to Whybe (#3)
Best response
Your first for() loop is completely useless. The if(M != src) is also pointless because it's impossible that you would be in the get_step() relative to yourself. Also once again you're mixing src and usr.

Additionally, you should be making use of object-orientated programming here rather than having a single proc that handles every single case by using a bunch of redundant checks.

mob
var
isDead = FALSE

proc
attack()
// Look for enemies here.

// Check to see if the thing being attacked here isDead. If they are, ignore them.

// Calculate damage. Call takeDamage().

takeDamage(damage, mob/attacker)
// Subtract health here.

// If health is less than or equal to zero, call death().

death(mob/attacker)

player
death(mob/attacker)
// Since this is called when the player dies, you would just respawn him elsewhere.

enemy
death(mob/attacker)
// When enemies die, give the attacker experience and tell the enemy to respawn.
I'll also note that both if statements will be done, which you probably would like to combine into one, an if and an else.
i dont get lord andrew one
mob
var
isDead = FALSE

proc
attack()
flick("Attack",src)
//for(var/mob/Enemies/S in world)
for(var/mob/M in get_step(src,src.dir))
if(M != src) // you could also edit this in the future, so it doesn't attack people allied to you, etc etc.
overlays += 'Attack.dmi'
var/Damage=max(0,src.Str-M.Def)
view(M)<<"[src] hit [M] for [Damage] Damage!"
M.TakeDamage(Damage,src)
overlays -= 'Attack.dmi'
DeathCheck()

//takeDamage(damage, mob/attacker)
TakeDamage(var/Damage,var/mob/Attacker)
src.HP-=Damage
src.DeathCheck(Attacker)

DeathCheck(mob/attacker)

player
DeathCheck(mob/attacker)
if(src.HP <= 0)
view()<<"<b><font color=red>[attacker] killed [src]!"// when user dies
src.HP = src.MaxHP
src.MP = src.MaxMP
src.Stamina = src.MaxStamina
attacker.Kills += 1 // If the killer isn't a NPC, it gets a kill.
src.Deaths += 1 // If the person killed isn't a NPC, it gets a death.
src.loc = locate(9,3,1)// where user spawns after
if(src.PenguinTownSpawn) src.loc = locate(7,5,2)
if(src.blood) src.loc = locate(38,69,1)

Enemies
DeathCheck(mob/attacker)
if(src.HP <= 0)
attacker<<"<b><font color=red>You killed [src] for [src.Exp] exp and for [src.Gold] Gold" // Enemy dies
attacker.Exp += src.Exp
attacker.LevelCheck()
isDead = TRUE
attacker.Gold += src.Gold // You should change it, the person'll always receive 2 gold from any kind of NPC.
src.Respawn()



mob/var/Respawn_Loc

mob/proc/Respawn()
del src
var/Old_Icon = icon
icon = null
density = 0
spawn(rand(600,1200)) // waits 60~120 seconds.
density = 1
icon = Old_Icon
loc = Respawn_Loc
Dead = 0

mob/New()
..()
if(!client) Respawn_Loc = loc
You totally skipped the part where you check to see if they're already dead.
Wow it worked!?!?!??!?!