Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 04-22-2007, 07:36 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
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.
Reply With Quote
  #3  
Old 04-22-2007, 08:18 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
cool script
Reply With Quote
  #4  
Old 04-22-2007, 09:05 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
Thanks Chandler and Twinny.

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


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
  #5  
Old 04-23-2007, 12:58 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
i dont understand what its for c.c
__________________
**FLIP OUT**
Reply With Quote
  #6  
Old 04-23-2007, 02:06 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
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.
__________________


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
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:47 PM.


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