Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   getAreaPlayers() (https://forums.graalonline.com/forums/showthread.php?t=134258351)

coreys 03-12-2010 02:56 AM

getAreaPlayers()
 
Since there's a getAreaNpcs() function, why is there not a getAreaPlayers()? It would be very useful to have this, and if there's one for NPC's, why not players? Doesn't seem like it'd be hard to implement, either.

Cubical 03-12-2010 03:00 AM

I wouldn't mind seeing this, would make things a bit easier.

DustyPorViva 03-12-2010 03:07 AM

This would eliminate a lot of unneeded checks and calculations and loops that are used for things like hit detection, when you only need to for players in a specific block, and not worry about ALL of the players in the level.

coreys 03-12-2010 05:29 AM

On a related note; something like triggerarea() to trigger every player/npc in a specified area would be just as, if not more, useful. This has been requested more than once before, and seems like such an obvious addition.

Admins 03-12-2010 02:03 PM

The problem is that accessing players[] is much faster than level.players[] and you would probably expect findareaplayers() to work regardless if your current position. It could be possible to add a findareaplayers() which only accesses the players around you.

Cubical 03-12-2010 02:08 PM

Quote:

Originally Posted by Stefan (Post 1562030)
The problem is that accessing players[] is much faster than level.players[] and you would probably expect findareaplayers() to work regardless if your current position. It could be possible to add a findareaplayers() which only accesses the players around you.

Do you mean that it would only be able to get players from your current level and surrounding levels? If so that sounds fine to me.

adam 03-12-2010 02:23 PM

I really don't understand Stefan's post at all.

coreys 03-12-2010 08:25 PM

Quote:

Originally Posted by Stefan (Post 1562030)
The problem is that accessing players[] is much faster than level.players[] and you would probably expect findareaplayers() to work regardless if your current position. It could be possible to add a findareaplayers() which only accesses the players around you.

Well that's pretty much what I (we?) want.

DustyPorViva 03-12-2010 10:48 PM

Quote:

Originally Posted by Cubical (Post 1562032)
Do you mean that it would only be able to get players from your current level and surrounding levels? If so that sounds fine to me.

Which is what getnearestplayers() does...

fowlplay4 03-12-2010 10:51 PM

Quote:

Originally Posted by DustyPorViva (Post 1562093)
Which is what getnearestplayers() does...

It'd be nice if an optional radius parameter was added so it wouldn't require a scripted distance check, getnearestnpcs would be cool too.

Deas_Voice 03-12-2010 11:34 PM

Quote:

Originally Posted by DustyPorViva (Post 1562093)
Which is what getnearestplayers() does...

what's the difference between findnearestplayers() and getnearestplayers() ?

coreys 03-12-2010 11:57 PM

Of course we can just use getNearestPlayers() and check if the player is within a box but it's always faster for that to be done in the engine, and things like hit detection can use any speed boost they can get.

DustyPorViva 03-13-2010 12:05 AM

Quote:

Originally Posted by Deas_Voice (Post 1562104)
what's the difference between findnearestplayers() and getnearestplayers() ?

Do both of those functions exist? I guess so! Anyways, wiki says:
getnearestplayers(float, float) Deprecated. Use findnearestplayers() instead.

I honestly don't know. getnearestplayers may return the indexes of players that was compatible with the old GS1 methods of players[x].

Of course, they could be exactly the same thing but just two function names.

DrakilorP2P 03-13-2010 01:25 AM

Quote:

Originally Posted by Deas_Voice (Post 1562104)
what's the difference between findnearestplayers() and getnearestplayers() ?

One returns indeces the other returns objects. I forget which.

cbk1994 03-13-2010 01:33 AM

I'd love to see a radius parameter added to findNearestPlayers

Quote:

Originally Posted by DrakilorP2P (Post 1562131)
One returns indeces the other returns objects. I forget which.

find returns the object, getNearestPlayers shouldn't be used anymore.


All times are GMT +2. The time now is 09:11 AM.

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