ID:170679
 
Is it possible to not let NPC's move diagonally? I know you can do it for clients, but I dont know about NPC's.

Yeah sorry for all the questions lately, I'll try to make this the last for some time.
DeathAwaitsU wrote:
Is it possible to not let NPC's move diagonally? I know you can do it for clients, but I dont know about NPC's.

It is, although you can't use some of the pathfinding step algorithms like step_to() with that.

The main thing is to modify Move():
mob/Move(atom/newloc, newdir=0)
if(newdir & newdir-1) // diagonal
newdir &= pick(3,12)
newloc = get_step(src, newdir)
return ..(newloc, newdir)
return ..()

Lummox JR
In response to Lummox JR
Alright that's fine since I'm only using walk_towards in my game.

Thanks a lot.

But one more thing, when using walk_towards(), is there a demo out there demonstrating how to get mobs the find there way around things like walls to get to the desired location? Like his

xxxxxxxxxxx
xxxxxMxxxxx
xxxOOOOOx
xxxxxPxxxxx

With M being the mob walking towards P and O being the wall blocking M's path, is there a demo out there showing how to get M around a wall like that and in similar situations?
In response to DeathAwaitsU
Deadron has a pathfinding library which can have artificial intelligence by stepping to an item. Just search his hub entries.
In response to Unknown Person
Wow thats really cool, thanks.

A lil help on my other topics would be nice too =P