ID:141205
 
Code:
        New()
..()
spawn()
WalkAround()
proc/WalkAround()
for(var/mob/M in oview(15,src))
if(M&&M.client&&ismob(M))
if(!src.Frozen)
step_towards(src,M)
src.Selected=M
spawn(10)
walk(src,0)//To fix a certain glitch, just ignore it.
if(prob(95))
if(M in get_step(src,src.dir))
..()
else
src.Ki_Blast()
if(prob(70))
if(M in get_step(src,src.dir))
..()
else
src.Teleport()
if(M in get_step(src,src.dir))
if(ismob(M))
if(M.client)
src.Selected=M
if(!src.Doing)
var/A=rand(1,7)
if(A>=1&&A<=3)
src.Punch()
if(A>=4&&A<=6)
src.Kick()
if(A==7)
src.Block()
var/B=rand(1,30)
sleep(B)
src.StopBlock()

else
step_rand(src)
sleep(10)
spawn(5)
WalkAround()


Problem description: Well, recently I have been trying to work on a smart NPC system. Right now the NPC fights amazingly when it's just the NPC, and my character. I felt like trying to take on about 5 or 6 NPC's so I added them to the map near each other. Now they wander all over the place, sometimes fire a ki blast or teleport, and they only attack if I'm blocking their path.

Usually they follow me and when they get near me they attack but the effect when there are more than 1 NPC's near each other is that they don't follow my player any more and just walk around with little chance to blast, teleport, or attack.

I've been messing with this for about 3 hours and this is my final problem before it's ready(unless there is a way to improve it).

Thanks in advance,
Forerunnerz.


Im pretty sure your problem is that you include the other mobs, and then say if its a client, and a mob, then attack
                if(M&&M.client&&ismob(M))


Your saying if mob/M is not a client, but is a mob then randomly step, and it selects the mob based on byond's weird mechanisms (well not so weird, but still).

You need to change the type of a player so you can say mob/Player/M, so it filters out the non player mobs.