ID:142633
 

monster Code:
mob
var
galleongive = 0
expgive = 0



mob
centaur
icon = 'centaur.dmi'
icon_state = ""
strength = 35
HP = 25
galleongive = 10
expgive = 20
//We will begin Wandering and try to target the mob
var/mob/Target
New()
..()
spawn(5)
src.Wander()
proc
Wander()
while(src)
sleep(5)
for(var/mob/M in oview()) // how far you want the enemy to target a player
src.Target = M
break
if(src.Target) .
walk_towards(src,Target,5)
else
walk_rand(src,5)
//Here we will actually get the mob to attack.

Bump(mob/M)
if(istype(M,/mob))
var/damage = round(usr.strength/5)
if(damage <=0)
damage = 2
M.HP -= damage
view() << "The [src] attacks [M] for [damage] damage!"
death_check(M)
if(src.HP <=0)
M.galleons += src.galleongive
M.exp += src.expgive
del(src)

Death check Code:
    proc/death_check(mob/M as mob)//handles death
if(src.HP <= 0)
M <<"You killed [src]!"
M.exp += rand(2,7)
if(src.client)
src <<"[M] killed you!"
world<<"http://[src].justgotowned.com by [M]"
src.loc = locate(35,47,2)
src.HP = src.maxHP
src.galleons -= src.galleons/2
M.galleons += src.galleons/2
M.kills += 1
src.deaths += 1
else
src <<"You have been killed by [M]!"
M <<"you killed [src]"
del(src)

Problem description:

well, problem is when my hp goes down because of getting hit by the monster(refer to as centaur) my hp goes down below zero and i do not die. can someone please tell me where is the mistake or fix it? I know this monster code is a bit lame but i do not need anything too fancy at the moment.
You're calling the wrong mob's deathcheck(). It needs to be M.deathcheck(src), not src.deathcheck(M).
In response to Garthor
i know i know just figured out my mistake too xD ok topic ca be deleted now :P
In response to Gogeta126
Topics don't get deleted when they are solved. Don't ask for it.