array::sort_by_script_int()
Sorts entities by their script_int key. BO3's decompiled scripts carry no docs for this one: the description is ours, from its name and use.
Signature
array::sort_by_script_int(&a_ents, b_lowest_first = 0)
Needs #using the script that defines it (scripts/shared/array_shared.gsc).
Parameters
| Name | Details |
|---|---|
| a_ents | (passed by reference: &) |
| b_lowest_first | default: 0 |
The decompiled scripts don't keep default values, so some of these may be optional: check the real uses below.
Real uses in BO3's scripts
Called 16 times in the decompiled scripts. A few, zombies first:
- scripts/zm/_zm_audio_zhd.gsc, line 157
var_d1f154fd = array::sort_by_script_int(var_d1f154fd, 1); - scripts/zm/_zm_weap_elemental_bow_storm.gsc, line 636
var_3b7b1ee = array::sort_by_script_int(self.var_3b7b1ee, 1); - scripts/zm/zm_castle_ee_bossfight.gsc, line 807
self.var_9680b225 = array::sort_by_script_int(self.var_9680b225, 1); - scripts/zm/zm_cosmodrome_amb.gsc, line 558
var_ead6e450 = array::sort_by_script_int(var_7533f11, 1); - scripts/zm/zm_genesis_radios.gsc, line 111
level.a_s_radios = array::sort_by_script_int(a_s_radios, 1);
More in array::
- array::thread_all()Threads a function on every entity in an array, passing the same arguments.
- array::add()Adds an item to an array (no duplicates unless allowed) and returns the array.
- array::random()Returns a random element of an array.
- array::randomize()Returns the array in a random order (shuffled).
- array::run_all()Calls a function on every entity in an array (no thread).
- array::filter()Returns the elements of an array that a filter function keeps.
- array::get_all_closest()Returns elements sorted by distance from an origin, optionally capped.
- array::remove_dead()Removes dead entities from an array.
- array::remove_undefined()Removes undefined entries from an array.
- array::contains()True if the array contains a value.
- array::exclude()Returns the array without the items in a second array (or one item).
- array::remove_index()Removes the element at an index and returns the array.
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).