GSC reference › Built-in

ArraySortClosest()

Built-in (engine) Server

Returns a sorted array of entities by closest from <origin>

Signature

ArraySortClosest(<array>, <origin>, [maxReturnCount], [minDist], [maxDist])

Parameters

NameRequired?Details
arrayRequired array to sort
originRequired the origin from which to compare
maxReturnCountOptional if set then only the first <max> count of entities will be returned
minDistOptional if set then only the entities further than <minDist> will be considered
maxDistOptional if set then only the entities closer then <maxDist will be considered

Real uses in BO3's scripts

Called 73 times in the decompiled scripts. A few, zombies first:

Related built-ins

New to GSC?

Start with the basics, or paste a compile error to get the fix.

Built-in descriptions, parameters and examples come from Treyarch's BO3 mod tools docs. Usage links point at shiversoftdev/t7-source (decompiled BO3 scripts).