ID:143639
 
Code:
mob
Spider
name = "Spider"
icon = 'Monsters.dmi'
icon_state = "spider"
HP = 30 //this defines "Killers" health
MAXHP = 30
DMG = 1
MDMG = 5
Player = 0
EXP = 5
GOLD1 = 0
GOLD2 = 3
Respawn = 1000
delay = 20
var/mob/M
New()
. = ..()
spawn()
Wander()
proc/Wander()
while(src)
if(M in oview(5))
step_towards(src,M)
for(M in oview(1))
break
for(M in oview(2))
break
for(M in oview(3))
break
for(M in oview(4))
break
else
step_rand(src)
sleep(10)
for(M in oview(5))
break
sleep(10)
spawn(10)
Wander()
Bump(mob/M)
Fight(M)
return

proc/Fight(mob/M)
if(istype(M,/turf))
return
if(istype(M,/obj))
return
else
var/damage = rand(DMG,MDMG)
M.HP -= damage
world<< "[src] attacks you for [damage] damage!!"
Dcheck(M)
return


Problem description:At first the monsters are fine. they come after me, but if I get too far away they just group up together and sit there waiting for me to come back. I just want them to Wander() after I get out of the way.

One thing first, you sure you want them to randomly move? In my opinion, having them always randomly moving all the time seriously increases lag issues...
In response to Jamesburrow
I want them to at least move while I can see them. I don't want them to sit there until I hit them.
They group together because they are walking towards each other.

        proc/Wander()
while(src)
if(M in oview(5))
if(M.type!=type)step_towards(src,M)
In response to Kaiochao2536
I realise that but they are also attacking each other
In response to Tharamn
...Probably because they are targeting each other. Same thing.