Thread: Range Checks
View Single Post
  #1  
Old 04-22-2007, 03:27 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Range Checks

Hello! I was working on RC with Chandler earlier today and I came up with these distance checks.

I needed them for a few things and I thought it might be awesome to let the public be able to use them as well.

=]

The class checks for the NPC can be changed as you wish. There is another function to this set. But I have not completed it yet, so when I do I'll make sure to post it here! =D


PHP Code:
public function playerInRange()
{
for ( 
plplayers )
  {
    if ( 
pl.x in this.getPlayerVec2)[0] )
    {
      if ( 
pl.y in this.getPlayerVec2)[1] )
      {
        return 
true;
      }
    }
    else
    {
      return 
false;
    }
  }
}


public function 
enemyInRange()
{
for ( 
clfindareanpcsthis.getPlayerVec1010 )[0], this.getPlayerVec1010 )[1], 6464  ) )
  {
    if ( 
cl.isinclass"mud_enemyfunctions" ) )
    {
      if ( 
cl.x in this.getVec2)[0] )
      {
        if ( 
cl.y in this.getVec2)[1] )
        {
          return 
true;
        }
      }
      else
      {
        return 
false;
      }
    }
  }
}


public function 
getPlayerVecxDistyDist )
{
  
temp.dx player.vecxplayer.dir ) * temp.xDist;
  
temp.dy player.vecyplayer.dir ) * temp.yDist;

  return ( { 
temp.dxtemp.dy } )

__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote