Blah:
NPC Code:
if (created||timeout) {
if (this.active==1) {
//movement script
if (keydown(0)) {
y-=0.5;
dir = 0;
}
if (keydown(1)) {
x-=0.5;
dir = 1;
}
if (keydown(2)) {
y+=0.5;
dir = 2;
}
if (keydown(3)) {
x+=0.5;
dir = 3;
}
setani whatever,;
freezeplayer 0.05;
}
//Activating or deactivating script.
if (keydown(4)) {
if (this.pressed==0) {
if (this.active==0) this.active=1;
else this.active=0;
this.pressed=1;
}
}
else {
this.pressed=0;
}
timeout = 0.05;
}
But anyways, you need to put in the keydown's in a constantly repeating loop, timeout is the best for that.