NPC Code:
if(created||timeout){
if(this.dir=0&&y>0) y-=0.5;
if(this.dir=2&&x>0) y+=0.5;
if(this.dir=1&&x<64) x-=0.5;
if(this.dir=3&&y<64) x+=0.5;
message #v(this.dir);
timeout=0.5;
}
if(actionmove){
this.dir=strtofloat(#p(0));
timeout=0.5;
}
//#CLIENTSIDE
//Fixed by *osrs
if(created){
setimg block.png;
this.max=4;
timeout=0.05;
}
if(timeout||playerenters){
for(k=0;k<this.max;k++){
if(keydown(k)&&k!=this.m){
triggeraction x,y,move,#v(k);
this.m=strtofloat(#v(k));
}
}
timeout=0.05;
}
I think there is no need to trigger the npc every time when the position is changed,i tested the script online and worked fine.
PS:It's not the whole code,Kai
