GSC reference › Built-in

ArraySort()

Built-in (engine) Server

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

Signature

ArraySort(<array>, <origin>, [closest], [max], [range])

Parameters

NameRequired?Details
arrayRequired array to sort
originRequired the origin from which to compare
closestOptional if set to true the array will be sorted by distance closest to <origin>, if false by distance farthest from <origin>
maxOptional if set then only the first <max> count of entities will be returned
rangeOptional if set then only the entities within <range> will be considered

Real uses in BO3's scripts

Called 50 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).