Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Range Checks (https://forums.graalonline.com/forums/showthread.php?t=73604)

killerogue 04-22-2007 03:27 AM

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 } )



Twinny 04-22-2007 07:36 AM

Ahh
PHP Code:

if ( cl.isinclass"mud_enemyfunctions" ) ) 

Probably shouldn't be in a public function. Or atleast have a comment explaining what to do with it.

Chandler 04-22-2007 08:18 AM

cool script

killerogue 04-22-2007 09:05 AM

Thanks Chandler and Twinny.

Oh yeah, got to start commenting things, sorry 'bout that.

theHAWKER 04-23-2007 12:58 AM

i dont understand what its for c.c

killerogue 04-23-2007 02:06 AM

For checking if an npc such as a class, or a player is within a certain distance. I've created for use on my playerworld specifically for my battle system.


All times are GMT +2. The time now is 05:37 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.