it will be more like:
NPC Code:
// NPC made by I c e P i c k
if (created || playerenters) {
this.createx=int(x);
this.createy=int(y);
}
if (playertouchsme) {toweapons weaponname;
this.playerhearts=playerhearts;
}
if (weaponfired) {
this.mode = (this.mode+1)%2;
timeout = .05;
}
if (timeout && this.mode==1) {
players[this.id].hearts=this.playerhearts;
timeout = .5;
}