Is the NPC named Bomb? If that's the case, there is a bug where WNPC's named after default weapons will load the default scripts(and in this case if you have no bombs, will do nothing). Otherwise I can't find anything wrong with it, unless it's spitting out syntax errors.
PHP Code:
function onActionServerside() {
if (params[0] == "Explode") {
temp.n = findplayer(params[5]).level.putnpc2(params[1], params[2], "");
temp.n.join("object_explosion");
temp.n.bombRange = params[3];
temp.n.bombThrowDir = params[4];
temp.n.bombPlacer = params[5];
}
}
//#CLIENTSIDE
function onCreated() {
this.pulledoutBomb = false;
this.canThrow = false;
this.explosionTimer = null; // I don't think Graal uses nil :)
}
function onWeaponFired() {
if (!this.pulledoutBomb) {
player.chat = "Pull out bomb!";
onTimeout();
} else if (this.canThrow) {
player.chat = "Throw bomb!";
onCreated();
}
}
function onTimeout() {
temp.bombRange = 1;
temp.bombThrowDir = player.dir;
temp.bombPos = {player.x + (vecx(player.dir) * 3) - 2.5,
player.y + (vecy(player.dir) * 3) - 2};
temp.bombPlacer = player.account;
if (!this.pulledoutBomb) this.pulledoutBomb = true;
else {
if (this.explodeTimer < 4) {
this.explodeTimer += .05;
this.canThrow = true;
} else {
this.canThrow = false;
setani("hurt",null);
triggerServer("gui", this.name, "Explode", bombPos[0], bombPos[1], temp.bombRange, temp.bombThrowDir, temp.bombPlacer);
onCreated();
return; // will stop the function, thus canceling the timeout
}
}
setTimer(0.05);
}