NPC Code:
if (weaponfired){
setarray this.check_tiles,3;
setarray this.chang_tiles,3;
this.check_tiles = { 1652,1653,1668,1669};
this.chang_tiles = { 1802,1803,1818,1819};
for (this.t=0;this.t<64+64*64;this.t++){
for (j=0;j<arraylen(this.check_tiles);j++){
if (board[this.t]==this.check_tiles[j]){
board[this.t]=this.chang_tiles[j];
}elseif(board[this.t]==this.chang_tiles[j]){
board[this.t]=this.check_tiles[j];
}
}
}
updateboard 0,0,64,64;
}
This will work.... but only on half of the level.
don't ask me why I don't know.

if you notice anything wrong with it tell me.
I would use x and y but that would require a 3 nested loops. That doesn't work for some reason.