My name is Kjetil, and what in the world was wrong with my formating?
I see nothing wrong in
NPC Code:
dir=getdir(npcs[this.i].x-x,npcs[this.i].y-y);
If you acctuly look, you would see that I posted the same as he, to point out that it was that part I meant...!