Or if you want the NPC to move on player position dependance and some other things:
NPC Code:
if (created) {
this.x=x;
this.y=y;
this.enterx=32;
this.entery=32;
}
if (playerenters||timeout) {
if (isleader) {
this.xdif=(playerx-this.enterx)+playerx;
this.ydif=(playery-this.entery)+playery;
}
x=this.x+this.xdif;
y=this.y+this.ydif;
timeout=0.05;
timereverywhere;
}
And I probably made some really stupid mistakes in the above script.