View Single Post
  #7  
Old 11-04-2010, 12:52 AM
ZeroG ZeroG is offline
Developer
Join Date: Oct 2010
Posts: 12
ZeroG is on a distinguished road
Here is the emitter:

PHP Code:
if (created) {
setshape 1,32,32;
}
function 
onPlayerChats(){
  if (
player.chat=="start"){
    if (
player.account=="Graal755284"){
      
settimer(0.1);
    }
  }
}
function 
onTimeout(){
  
sleep 1;
  
putnpc2(this.x,this.y,"join(\"dodge\");");
  
settimer(1);

Here is the class npc that is created:

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
setimg("rock.png");
  
settimer(0.1);
  
dontblock();
}

function 
onTimeout(){
  
temp.dx=0.3;
  
this.x=this.x-temp.dx;
  if (
player.x>this.x-1.5 && player.x<this.x+1.5){
    if (
player.y>this.y-1.5 && player.y<this.y+1){
      
setani dead,;
      
player.chat="I was hit!";
      
player.x=30;
      
player.y=15;
      
destroy();
    }
  }
  if (
this.x<8){
    
destroy();
  }
  
settimer(0.01);

After a while, the rocks stop appearing, and I have to type "/clearnpcs dodge.nw" in the RC for it to continue spawning. I'm wondering if there is a function or something that can clear the npcs automatically.
Reply With Quote