NPC Code:
if (playerenters) {
toweapons *SpaceWars;
}
if (created&&isweapon) {
disabledefmovement;
disableweapons;
disableselectweapons;
timeout=.05;
}
/* moved everything to the block above
this text, since it would just timeout on
the in-level script and not the weapon
script. */
if (timeout) {
if (keydown(1)&&!onwall(playerx-0.5,playery)) {
playerx-=0.5;
playerdir = 0;
}
if (keydown(3)&&!onwall(playerx+0.5,playery)) {
playerx+=0.5;
playerdir = 0;
}
if (keydown(4)) {
this.mult=0;
}
while (this.mult<18) {
putexplosion 1,playerx,56-this.mult;
this.mult+=2;
sleep .1;
}
timeout = .05;
}
Still kinda ugly, but easy to read. I still think you should have figured that out yourself by troubleshooting...the original problem was just a missing ! in front of the onwall() functions.