Thread: Hmm?
View Single Post
  #5  
Old 11-27-2009, 08:29 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.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.+ (vecx(player.dir) * 3) - 2.5
                  
player.+ (vecy(player.dir) * 3) - 2};  
  
temp.bombPlacer player.account;
  if (!
this.pulledoutBombthis.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.bombRangetemp.bombThrowDirtemp.bombPlacer);
      
onCreated();
      return; 
// will stop the function, thus canceling the timeout
    
}
  }
  
setTimer(0.05);


Last edited by DustyPorViva; 11-27-2009 at 08:42 PM..
Reply With Quote