Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-03-2006, 05:33 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
findnearestplayers(x,y) specs.

The script obviously loads an array of indexes of the nearest players, but what are it's limitations? Can it only load so many players? Can it only load players within a certain distance?
Reply With Quote
  #2  
Old 02-03-2006, 05:51 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
I don't believe it returns an array of indexes, but rather an array of 'players' (objects). From my experience with it, it returns an array of all the players in the level, arranged from closest to farthest.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 02-03-2006, 06:09 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by napo_p2p
I don't believe it returns an array of indexes, but rather an array of 'players' (objects). From my experience with it, it returns an array of all the players in the level, arranged from closest to farthest.
oh right, yea, it does return an array of objects :P
If that's the case, to maximize efficiency on a rectangular field, you'd want to break the checking loop when you encounter the first instance where the player's distance from the center of the field is greater than the distance from the center of the field to the corner of the field.

I'm working on a new damage system for Classic, and although it's working 100x better than the current one, I'd still like to optimize it as much as possible. I was actually wondering if I'd have to distribute the damage field into checking different spots, but after what you tell me, I could actually decrease lag. Of course, most efficient if you use squares or circles.
Reply With Quote
  #4  
Old 02-07-2006, 04:56 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Could add some kind of findareaplayers() Currently you get the full list of players because the players array is normall relatively small, compared to the npcs array (especially on gmap).
Reply With Quote
  #5  
Old 02-07-2006, 07:07 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Stefan
Could add some kind of findareaplayers() Currently you get the full list of players because the players array is normall relatively small, compared to the npcs array (especially on gmap).
Stefan, that would definitely make a maximum optimization of the damage system. for static values of x,y,width,height.

It's still impossible, however, to create a reliable moving damage field (internal to baddies and such); this is the larger problem. Now I'm also wondering if you read my setshape mode suggestion, because it would also be good to support a radius-based function in the damage system.
Reply With Quote
  #6  
Old 02-08-2006, 09:51 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Stefan
Could add some kind of findareaplayers() Currently you get the full list of players because the players array is normall relatively small, compared to the npcs array (especially on gmap).
I would definediatly want to see that future on Graal, could turn out to be quite usefull.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #7  
Old 02-08-2006, 11:29 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by Stefan
Could add some kind of findareaplayers() Currently you get the full list of players because the players array is normall relatively small, compared to the npcs array (especially on gmap).
I'd like it.
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 05:16 PM.


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