AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   find_sphere_class, how speccialy does it work? (https://forums.alliedmods.net/showthread.php?t=293358)

grs4 01-30-2017 06:16

find_sphere_class, how speccialy does it work?
 
Hi,
I did not found on internet information about, how entities in
Code:

find_sphere_class(aroundent, const _lookforclassname[], Float:radius, entlist[], maxents, const Float:origin[3])
entlist[] are returned.

I mean, if I will set radius to 1000.0, Do entities in variable entlist will be ordered by nearest?

eg. we have 5 entities in 1000.0 range from entity 50. So, entlist[0] will return nearest ent?

edon1337 01-30-2017 07:55

Re: find_sphere_class, how speccialy does it work?
 
PHP Code:

//from jghg2
/* As above, but returns number of ents stored in entlist. Use to find a specific type of entity classname (specify in _lookforclassname) around a
 * certain entity specified in aroundent. All matching ents are stored in entlist. Specify max amount of entities to find in maxents.
 * If aroundent is 0 its origin is not used, but origin in 6th parameter. Ie, do not specify 6th parameter (origin) if you specified an entity
 * in aroundent.
 */
native find_sphere_class(aroundent, const _lookforclassname[], Float:radiusentlist[], maxents, const Float:origin[3] = {0.00.00.0}); 


grs4 01-30-2017 08:01

Re: find_sphere_class, how speccialy does it work?
 
You did not helped me.
Quote:

returns number of ents stored in entlist......All matching ents are stored in entlist.
It is not the anwser.
I know that it contains all elements in this radius, but I want to know if variable entlist is ordered ascending/descending by distance from aroundend

edon1337 01-30-2017 08:44

Re: find_sphere_class, how speccialy does it work?
 
Oh, I have no clue, thought that would help so I posted it.

Check these :

https://forums.alliedmods.net/showpo...64&postcount=4
https://forums.alliedmods.net/showpo...89&postcount=4
https://forums.alliedmods.net/showthread.php?t=47400

Black Rose 01-30-2017 12:04

Re: find_sphere_class, how speccialy does it work?
 
They are in order of entity index.
Generally that is how entity finding functions works.
They loop through indexes, comparing distance and if it's within range, return it.
Spoiler


Usually sorting is not important and therefor a waste of resources. However, you can always sort them using SortCustom1D

Spoiler

grs4 01-30-2017 18:16

Re: find_sphere_class, how speccialy does it work?
 
Thanks. That's what I wanted to know


All times are GMT -4. The time now is 20:55.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.