Try something like this:
NPC Code:
if (created) timeout=0.05;
if (timeout) {
if ((abs(this.px-playerx)>0.6)||(abs(this.py-playery)>0.6)) {
playerx=this.px;
playery=this.py;
}
this.px=playerx;
this.py=playery;
timeout=0.05;
}
That should work. Since a player moves a max of 0.6 tiles every 0.5 seconds (level 3 shield), it checks if a player goes faster. You can modify upon it if you want.