ID:261642
 
Anybody know how to do this?
I was thinking like putting in
var/dir = rand(0,4) and then doing if statements but How would you make it move? M.loc = locate(x+1,y,z) or something? Also how would I make it to where it wouldn't go over any dense objects like walls and stuff...

Maybe the proc could be something like this...

mob
proc/npcmove(mob/M as mob)
var/direction = rand(0,4)
if(direction == 0)
M.loc = locate(x+1,y,z)
else if(direction == 1)
M.loc = locate(x,y+1,z)
else if(direction == 2)
M.loc = locate(x-1,y,z)
else if(direction == 3)
M.loc = locate(x,y-1,z)
else
M.loc = locate(x,y,z)Flash
Flash_war wrote:
Anybody know how to do this?

http://www.byond.com/hub/Deadron/WalkingClicking

And many other demos. Check out the demo and tutorial links on the left.