View Single Post
  #4  
Old 09-02-2008, 03:36 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I would probably do something like

PHP Code:
function onCreated()
{
  
onTimeOut();
}
function 
onPlayerEnters()
{
  
onCreated();
}
function 
onTimeOut()
{
  if ( 
players.size() <= 0 )
  {
    return;
  }
  
  
temp.pl = findNearestPlayer( this.x, this.y );
  
  if ( 
pl.x in | this.x - 2, this.x + 3 | && pl.y in | this.y - 2, this.y + 2 )
  {
    
pl.attack();
  }
  
  
setTimer( .3 );
} 
You could also have a system weapon like this:
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
setTimer( 0.05 );
}
function 
onTimeOut()
{
  
temp.ns = findareanpcs( player.x - 1, player.y + 1, 2, 2 );
  
  for ( 
temp.npc : ns )
  {
    if ( 
npc.isSpike )
    {
      
player.attack();
    }
  }
  
setTimer( 0.05 );
} 
and in the spike

PHP Code:
function onCreated()
{
  
this.isSpike = true;
}
function 
onPlayerEnters()
{
  
player.addWeapon( "-SpikeDetector" );
  
onCreated();
} 
__________________
Reply With Quote