It depends where you want them to walk, I use
function onCreated(){

for(NULL;temp.n<=20;temp.n=temp.n+0.2){
this.x=temp.n;
sleep(0.1);
}
}
Depending on where you place it. if n is greater or equal to 20 then it will move down .2 spaces until n is greater then 20. So 20 would be the x position so if it is more then 20 steps to the right from where it starts, it will stop moving. this.x is the npc's x position on the level. you can replace it with this.y to make it move vertical