ID:148369
 
mob
var/goldgive = 0
var/expgive = 0
icon = 'mob.dmi'
Lizard_Warrior
icon_state = "lizard"
expgive = 10
goldgive = 20
hp = 50
mhp = 50
name = "Lizard Warrior"
New()
..()
spawn() check()
spawn() walkR()

proc
check()
for(var/mob/M in view(10))
if(M.client)
step_to(src,M,10)
for(M in view(1))
if(M.client)
src.attack(M)

spawn(5) check()

walkR()
walk_rand(src,10)
spawn(5) check()

Siientx
Im not quite sure, But try taking out that ..() in the New proc. Or you could try putting it at the end of the 2 spawn() procs, not before. Hope this helps. :/

-GDT
I've never been good at understanding other people's code, but I can write something to replace it with that I'm pretty sure would work.

mob/yourmonster
var/delay = 5

New()
spawn(delay) SearchEnemy()

proc/SearchEnemy()
for(var/mob/M in view())
if(M.client)

if(get_dist(src, M) > 1)
step_to(src, M)
spawn(delay) SearchEnemy()
return

else
Attack(src, M)
spawn(delay) SearchEnemy()
return

walk_rand(src)
spawn(delay) SearchEnemy()
return

That should work. However, I have to recommend that you avoid using enemies that continually run the their program regardless of whether there is anything to attack or not. You might try having it so that whenever a player moves, it checks for any nearby monsters and activates their attack programs. That way you can have as many monsters as they want, and they won't be doing anything until there is something for them to interact with.
New()
..()
spawn(rand(1,3)//so that all of these procs dont call at once
loop()
proc/loop()
var/mob/M
for(M in oview(1))
if(M.client)
src.attack(M)
spawn(5)
loop()
return
for(M in oview(10)
walk_to(src,M,10)
spawn(5)
loop()
return
walk_rand(src,10)
spawn(5)
loop()
return


I think that should do the same thing both of your procs do. If not just tell me, I wrote that out from memory so a few things might not check out.
In response to Triste
Tsk tsk, you forgot your dm tags.
In response to Jotdaniel
I removed them on purpose. Until they fix it on this forum, the DM tags are hidious.
In response to Triste
I like them, it makes the code nice and big, and readable. Becuase I noticed that I put the check for 10 before the check for 1.
Nobody managed to find your problems. One was that you were using walk_rand(), which will stop walking when you move it again. Another was that you were calling check() and walkR(), and then walkR() would call check(), which would result in two instances of check(). Another problem is you're using oview(), and not oview(src).
mob
monster
proc
Wander()
var/turf/T = loc
for(var/mob/M in oview(src))
if(M.client)
step_to(src,M)
break
if(loc != T)
step_rand(src)
Bump(atom/A)
if(ismob(A))
var/mob/M = A
if(M.client)
attack(M)
New()
spawn() Wander()
..()