View Single Post
  #11  
Old 07-12-2007, 11:11 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
PHP Code:
function onActionAward()
{
 
player.rupees+=250;
}

//#CLIENTSIDE
function onCreated()
{
 
reset_NPC(0);
}

function 
onWa****()
{
 
this.to_deduct = int(random(1,10));
 if (
this.hits - this.to_deduct >= 0)
  {
   
this.hits = this.hits - this.to_deduct;
   
this.chat = this.hits @ " hits left!";
  }
 else
  {
   
this.hits = NULL;
   
NPC_Dead();
  }
}

function 
NPC_Dead()
{
 
this.chat = "";
 
player.chat = "I got $250!";
 
player.triggeraction(x+1.5,y+1.5,"Award","");
 
reset_NPC(2);
}

function 
reset_NPC(time)
{
 
sleep(time);
 
this.hits = 1000;
 
this.chat = this.hits;
} 

Scripted it here on the forums so didn't test anything, but works in theory.
Reply With Quote