ID:261963
 
Something's wrong here. Nothing happenes when the health is Zero. Code:

    proc/death_check(mob/M)
if(istype(M,/mob/character/))
if(M.hp <= 0)
M <<"You have died!"
src <<"You have killed [M]!"
M.hp = M.maxhp
M.loc = locate(1,1,1)
else
src <<"You killed an NPC!"
del(M)


And I also have a monster issue. Click code problems, and it should be right there.
You have it backwards. src should be the mob that could die, and M should be the mob killing it. That means you have to change how it's called, too.
In response to Garthor
Thanks, Garthor. But, I also have another problem maybe you can solve. The code I am about to show you has no errors, BUT the monster does NOT attack.

mob
villan
Monster
icon = 'monster.dmi'
hp = 200
strength = 5
defense = 5
var/mob/P
New()
. = ..()
spawn()
move()
proc/move()
while(src) //While the mob is still here...
var/Found = FALSE //False is a predefined variable that means 0. True means 1. This is the same as putting var/Found = 0
for(P in oview(5,src)) //If there is a PC in the area, as set with the P var above...
step_towards(src,P) //Step towards the PC
Found = TRUE
break //This makes it so the mob will chase one person, in one turn. If you didn't have this, the mob will chase every PC he/she sees before each walking delay. Basically, it stops the for() loop from continuing through the list.
if(Found != TRUE) //If Found is not that of TRUE (If the mob was not found)...
step_rand(src) //Step randomly once.
sleep(10) //Wait one second
sleep(5) //Dont do anything for 0.5 seconds
Bump(mob/M)
if(istype(M,/mob/character/))
attack(M)
proc/attack(mob/M)
var/damage = M.strength - src.defense
M.hp -= damage
src.level_up()
M.death_check()


Thanks!
In response to SSJ4_Gohan_Majin
If I remember correctly, procedures like step_rand and step_towards will never attempt to step somewhere that contains something dense, so Bump() is never called.
In response to SSJ4_Gohan_Majin
In Bump() you use /mob/character/. That's a bad path, drop the /.
In response to DarkView
I figured out that wasn't the only problem. The monsters start attacking themselves. So, switched around the attack to see if the monsters attack, but they don't and they attack themselves. Edited Code:

mob
villan
Monster
icon = 'monster.dmi'
hp = 200
strength = 5
defense = 5
var/mob/P
New()
. = ..()
spawn()
move()
proc/move()
while(src) //While the mob is still here...
var/Found = FALSE //False is a predefined variable that means 0. True means 1. This is the same as putting var/Found = 0
for(P in oview(5,src)) //If there is a PC in the area, as set with the P var above...
step_towards(src,P) //Step towards the PC
Found = TRUE
break //This makes it so the mob will chase one person, in one turn. If you didn't have this, the mob will chase every PC he/she sees before each walking delay. Basically, it stops the for() loop from continuing through the list.
if(Found != TRUE) //If Found is not that of TRUE (If the mob was not found)...
step_rand(src) //Step randomly once.
sleep(10) //Wait one second
sleep(5) //Dont do anything for 0.5 seconds

proc/attack(mob/M in oview(1))
var/damage = M.strength - src.defense
if(istype(src,/mob/character))
M.hp -= damage
src.level_up()
M.death_check()


Thanks!
In response to SSJ4_Gohan_Majin
Yes, the monsters attack me. But they form a line like this:

| = monster
P = me

||||
||||
||||
||||
P

When ever they move, they do not move toward ME. They just form a line like above. Code:

mob
villan
Monster
icon = 'monster.dmi'
name = "Monster"
hp = 200
strength = 5
defense = 5
var/mob/P
New()
. = ..()
spawn()
move()

proc/move()
while(src) //While the mob is still here...
var/Found = FALSE //False is a predefined variable that means 0. True means 1. This is the same as putting var/Found = 0
for(P in oview(5,src)) //If there is a PC in the area, as set with the P var above...
step_towards(src,P) //Step towards the PC
Found = TRUE
break //This makes it so the mob will chase one person, in one turn. If you didn't have this, the mob will chase every PC he/she sees before each walking delay. Basically, it stops the for() loop from continuing through the list.
if(Found != TRUE) //If Found is not that of TRUE (If the mob was not found)...
step_rand(src) //Step randomly once.
sleep(10) //Wait one second
sleep(5) //Dont do anything for 0.5 seconds

Bump(mob/M) //Override this to tell what it does
if(istype(M,/mob/character))
attack(M) //Attack it with a proc that is defined below.
proc/attack(mob/M) //new proc called attack

var/damage = rand(1,strength)
M.hp -= damage
M <<"You are being attacked by [src.name]!"

M.death_check() //call the death proc to the victim


Thanks!
In response to SSJ4_Gohan_Majin
This is because P is defined as a mob, they are all trying to walk towards each other!
In response to Wanabe
Wanabe wrote:
This is because P is defined as a mob, they are all trying to walk towards each other!

Thanks!