Script bindings: Gangs¶
Verified against: SLUS_212.15 (NTSC-U, SHA1 e9cb2cc49aa046b9e494313dce2f5038ed17b2f4).
Bindings for gangs: creation, membership, spawners, relations: 57 in all. Conventions, the other categories and how to read an entry are on the masterlist.
| Binding | Returns | Scripts | Boot | Mission 1 | Evidence |
|---|---|---|---|---|---|
GangAddMember |
- | 39 | no | no | confirmed (code) |
GangAddSpawner |
- | 37 | no | yes | confirmed (code) |
GangAddTurfBox |
- | 28 | yes | no | confirmed (code) |
GangAttachSpinningIcon |
- | 1 | no | no | confirmed (code) |
GangBrDead |
- | 76 | no | yes | confirmed (code) |
GangBrFlush |
- | 35 | yes | yes | confirmed (code) |
GangCallForHelp |
- | 0 | no | no | inferred |
GangCanFlee |
- | 7 | no | no | confirmed (code) |
GangCanSaveAllys |
- | 5 | no | no | confirmed (code) |
GangCanUseWorldFlags |
- | 17 | yes | no | confirmed (code) |
GangClearBums |
- | 2 | no | no | confirmed (code) |
GangClearHandlers |
- | 2 | no | no | confirmed (code) |
GangClearResponders |
- | 17 | yes | yes | confirmed (code) |
GangClearWanted |
- | 11 | yes | yes | confirmed (code) |
GangCreate |
number | 119 | no | yes | confirmed (code) |
GangDelete |
- | 49 | yes | yes | confirmed (code) |
GangEnableAttackStrategies |
- | 4 | yes | no | confirmed (code) |
GangEngageEnemy |
- | 10 | no | no | confirmed (code) |
GangExitWorld |
- | 24 | yes | no | confirmed (code) |
GangGetHeadCount |
number | 63 | yes | no | confirmed (code) |
GangGetLeader |
number | 6 | yes | no | confirmed (code) |
GangGetStandingCount |
number | 29 | no | no | confirmed (code) |
GangGoodToGo |
boolean | 2 | no | no | confirmed (code) |
GangInvincible |
- | 3 | no | yes | confirmed (code) |
GangIsASpawner |
boolean | 2 | no | no | confirmed (code) |
GangIsWanted |
boolean | 13 | yes | no | confirmed (code) |
GangLookAt |
- | 1 | no | no | confirmed (code) |
GangMakeEnemies |
- | 119 | yes | yes | confirmed (code) |
GangMakeEnemiesOfType |
- | 8 | no | no | confirmed (code) |
GangMakeFriends |
- | 37 | yes | yes | confirmed (code) |
GangMakeNeutralOfType |
- | 2 | no | no | confirmed (code) |
GangQueueResponders |
- | 3 | no | no | confirmed (code) |
GangRemoveSpinningIcon |
- | 1 | no | no | confirmed (code) |
GangRemoveTurfBox |
- | 5 | no | no | confirmed (code) |
GangRespond |
- | 2 | no | no | confirmed (code) |
GangSetAlwaysSeen |
- | 8 | no | no | confirmed (code) |
GangSetAttackable |
- | 4 | no | no | confirmed (code) |
GangSetCustomSpotDialog |
- | 0 | no | no | confirmed (code) |
GangSetDamageResponse |
- | 2 | no | no | confirmed (code) |
GangSetEnemy |
- | 1 | no | no | confirmed (code) |
GangSetFriend |
- | 0 | no | no | confirmed (code) |
GangSetHearRange |
- | 7 | no | no | confirmed (code) |
GangSetInvestigateResponse |
- | 42 | yes | no | confirmed (code) |
GangSetLeader |
- | 6 | yes | no | confirmed (code) |
GangSetLOS |
- | 6 | no | no | confirmed (code) |
GangSetMaxConcurrent |
- | 8 | no | no | confirmed (code) |
GangSetMoney |
- | 15 | no | no | confirmed (code) |
GangSetMsgHandler |
- | 140 | yes | yes | confirmed (code) |
GangSetNeutral |
- | 3 | no | no | confirmed (code) |
GangSetReactToViolence |
- | 1 | no | no | confirmed (code) |
GangSetRespondPercentage |
- | 10 | no | no | confirmed (code) |
GangSetSpawnerModel |
- | 0 | no | no | confirmed (code) |
GangSetSpawnerMustBeOffScreen |
- | 12 | no | no | confirmed (code) |
GangSetTargetable |
- | 4 | no | yes | confirmed (code) |
GangSetThreatResponse |
- | 20 | yes | yes | confirmed (code) |
GangStartSpawner |
- | 45 | no | no | confirmed (code) |
GangSuspend |
- | 75 | yes | yes | confirmed (code) |
GangAddMember¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | index |
number, truncated to an integer | Read but not used by the C++ side; the scripts pass 0 or -1. |
| 3 | human |
number, truncated to an unsigned integer | Handle of the human to add; an invalid handle does nothing. |
Returns nothing.
Moves a human into a gang (0x00166308). It first leaves its previous gang: its actions, target and goals are cleared and
it is taken off that gang's member list (and attack slot, and as leader), which gets a membership event (0x16). Then its
brain's gang (+0x20c) becomes the new gang, the brain is refreshed for it (0x0028aa18), it is set invincible (human
flag 0x10) if the gang is (GangInvincible), its handle goes into the first free of the 16 member slots (+0x48), a
war chief becomes the gang's leader (+0x44), and the gang gets event 0x16.
Notes. The member limit (10, or 16 for gang kinds 1 and 0x17) only triggers 0x0016d0e0, which has no effect (a
stripped diagnostic): no member is dropped, and with all 16 slots taken the handle is silently not stored while the
brain still points at the gang. Human type 237 also installs a gang anim substitution (0x00164178). This corrects the
earlier "a member is dropped first".
- Evidence: confirmed (code) at
0x0016a3f8; detail: traced - Wrapper
0x00373528(registered byRegisterBindings); calls0x0016a3f8Gang_AddMemberByHandle - Used by 39 of 467 script chunks (128 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 19 of 28 levels, first
level80(mission 2) - Coney: implemented
GangAddSpawner¶
GangAddSpawner(gang, name, arg3, types, model, pos, heading, total, delay, maxConcurrent, kind, target, arg13, callback, value, arg16, anim)
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31) that owns the spawner and receives the spawned humans; -1 does nothing. |
| 2 | name |
string | Name of the spawner, used by GangStartSpawner and the other spawner bindings. |
| 3 | arg3 |
number, truncated to an integer | A number stored with the spawner (the scripts pass 0); meaning not traced. |
| 4 | types |
table of 10 numbers (t[1]..t[10]) | Table of up to 10 character type ids (the scripts pass lists such as CharGenSpawner1), taken in turn: each spawn moves to the next slot, back to the first after slot 10 or a 0 (so a fresh spawner starts with the second type). |
| 5 | model |
string | Name of the model/outfit the spawned characters use (such as "warr_sw"); GangSetSpawnerModel changes it. |
| 6 | pos |
table of 3 numbers (t[1]..t[3]) | Spawn position {x, y, z} in world units (metres). |
| 7 | heading |
number, truncated to an integer | Heading of the spawned characters, in degrees. |
| 8 | total |
number, truncated to an integer | How many characters the spawner makes in all; the scripts use -1 for no limit (inferred). |
| 9 | delay |
number, truncated to an unsigned integer | Delay between spawns, in milliseconds (the scripts pass 1, 500 or 1000) (inferred). |
| 10 | maxConcurrent |
number, truncated to an integer | How many of its characters may be alive at once (spawner +0x5a; GangSetMaxConcurrent changes it); a negative -n spawns waves of n, each once the last wave is all dead. |
| 11 | kind |
number, truncated to an integer | The spawner state it starts in (spawner +0x52): 0 off, 1 on, 2 after value seconds, 3 or 5 by distance from player 1, 4 and 9 dispatch squads, 7 and 8 out of sight, 11 keeps the gang topped up. |
| 12 | target |
number, truncated to an unsigned integer | A handle stored with the spawner (the scripts pass NilHandle); meaning not traced. |
| 13 | arg13 |
number, truncated to an integer | A number stored with the spawner (the scripts pass 0); meaning not traced. |
| 14 | callback |
string | Name of a Lua function (dotted and : names work) called once per spawned character, right after it is made, with three arguments: the human's handle, the gang's id and the spawner's name. nil, or a name that is not a function, for none. |
| 15 | value |
number, truncated to an integer | The state's number (spawner +0x68): seconds for state 2, metres for 3, 5, 6 and 8; GangStartSpawner's last argument replaces it. |
| 16 | arg16 |
number, truncated to an unsigned integer | A handle stored with the spawner (the scripts pass NilHandle); meaning not traced. |
| 17 | anim |
string | Name of an animation or behaviour given to spawned characters; "nothing" for none (inferred). |
Returns nothing.
Adds a spawner to a gang: a point that creates gang members over time from a list of character types. A gang has at most 4 spawners; the call is ignored when all four are used. The spawner does nothing until GangStartSpawner starts it.
Notes. 0x0016aec0 → 0x00166ff8. The layout (which argument goes to which spawner field) is confirmed (code); the meaning of the numeric arguments is inferred from the stored fields and the scripts' values. Default per-spawner timers (10, 20, 30, 60 ...) are set at creation. The callback call is in 0x0016d860 (script slots +0x5c handle, +0x64 short, +0x7c string, +0x8c call with 3); scripts such as level87's StoopCallBack index their own tables by the gang id. Type pick 0x0016d810; spawning, the callback and out-of-sight placement: AI: spawners.
- Evidence: confirmed (code) at
0x0016aec0; detail: traced - Wrapper
0x00373dd0(registered byRegisterBindings); calls0x0016aec0 - Used by 37 of 467 script chunks (221 references); boot to menu: no; mission 1: yes; result used: no
- Later in the story: 21 of 28 levels, first
level87(mission 3) - Coney: implemented
GangAddTurfBox¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | box |
number, truncated to an unsigned integer | Handle of a volume box (from AddVolumeBox); anything else is ignored. |
Returns nothing.
Adds a volume box to a gang's turf, the area its members defend and keep to: the handle must resolve to an object whose type is 3 (a volume box), and it goes into the first free one of 8 slots at gang +0x15c (count at +0x17c). A ninth box is ignored silently.
- Evidence: confirmed (code) at
0x0016a328; detail: traced - Wrapper
0x00373438(registered byRegisterBindings); calls0x0016a328 - Used by 28 of 467 script chunks (87 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 25 of 28 levels, first
level80(mission 2) - Coney: implemented
GangAttachSpinningIcon¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31, as returned by GangCreate); -1 does nothing. |
| 2 | icon |
string | Name of the icon model to attach above each member's head; two special names are swapped for a language-dependent variant when the game's language is not English (0x002271f0). |
| 3 | arg |
number, truncated to an integer | A number passed on to the icon spawn for each member (meaning not traced). |
Returns nothing.
Attaches a spinning marker icon above the head of every current member of a gang, replacing any icon a member already has.
Notes. Calls 0x002271f0 for each of the 16 member slots.
- Evidence: confirmed (code) at
0x0016b2c8; detail: brief - Wrapper
0x0035f128(registered byRegisterBindings); calls0x0016b2c8 - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Coney: implemented
GangBrDead¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | on |
boolean (nil or 0 is false) | true switches the members' AI off (brain dead: they stand still and do nothing), false switches it back on. |
Returns nothing.
Switches the AI of every current member off or on; each member's actions are flushed first. The scripts switch whole gangs off during cutscenes and set-ups.
Notes. Per member 0x00292330: flush actions (0x0028db20) and set the brain's off flag (+0x09, 0x0028ced8).
- Evidence: confirmed (code) at
0x0016aa98; detail: traced - Wrapper
0x00373a20(registered byRegisterBindings); calls0x0016aa98 - Used by 76 of 467 script chunks (325 references); boot to menu: no; mission 1: yes; result used: no
- Later in the story: 24 of 28 levels, first
level80(mission 2) - Coney: implemented
GangBrFlush¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 or an unused slot does nothing. |
Returns nothing.
Flushes the AI brain of every current member: all queued goals and actions are removed, so each member stands idle until given new goals.
Notes. Per member it calls 0x0028d910 (pop every goal) and 0x0028db20 (pop every action).
- Evidence: confirmed (code) at
0x0016ba18; detail: traced - Wrapper
0x0035f6f0(registered byRegisterBindings); calls0x0016ba18 - Used by 35 of 467 script chunks (82 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
GangCallForHelp¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31) calling for help. |
| 2 | pos |
table of 3 numbers (t[1]..t[3]) | Position {x, y, z} help is called to; written back to the table. |
Returns nothing.
Makes a gang call for help at a position, if no call is already in progress; the game state remembers the caller and the time (0x00416be0).
Notes. No script calls it.
- Evidence: inferred; detail: brief
- Wrapper
0x0037a698(registered byRegisterBindings); calls0x00416be0 - Used by no script on the disc
- Coney: not implemented
GangCanFlee¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31, read as 16 bits); -1 or an unused slot does nothing. |
| 2 | on |
boolean (nil or 0 is false) | true lets the gang's members run away once the gang is beaten down; false (or nil) keeps them fighting. |
Returns nothing.
Sets the gang's can-flee byte (+0xdf). With it set, a gang tactic's start (0x00307fe0) notes how many members the
gang has (+0xe0) and, when the gang kind has a flee percentage (table 0x0050caa8, byte +0x72 of the kind's
0x7a-byte record), substitutes gen_cower_plead.anm for the members' anim 668. When a member goes down (0x00307d40)
and the members still standing are no more than that percentage of the starting count, each standing member of class
kind 11 drops his enemies, stops fighting (threat response 0) and is pushed a pedestrian reaction goal (type 0x6b, mode
9) away from the nearest enemy: he flees.
Notes. A gang kind with a 0 percentage never flees; only members whose class byte +0x11b is 11 run; a gang of kind 6 with +0xd9 set skips all of this; the default at gang creation is set by 0x00164808.
- Evidence: confirmed (code) at
0x0016bcf0,0x00307fe0,0x00307d40; detail: traced - Wrapper
0x0035f890(registered byRegisterBindings); calls0x0016bcf0Gang_SetCanFlee,0x00307fe0GangTactic_StartFlee,0x00307d40GangTactic_CheckFlee - Used by 7 of 467 script chunks (16 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 5 of 28 levels, first
level95(the hub) - Coney: implemented
GangCanSaveAllys¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 or an unused slot does nothing. |
| 2 | on |
boolean (nil or 0 is false) | true lets the members answer an ally's call for help; false stops them (the brain default is false). No default: a missing value is false. |
Returns nothing.
Sets the can-save-allies byte (brain +0x2d6) of every current member of a gang in use. A human in trouble (a brain in
state 2, checked every 30th update by 0x002b6eb0) looks within 20 m for an allied human whose byte is set, who is not
down or busy and has no goal 0x5f; the first one found is given a goal (0x002b7e00, vtable 0x0053fd30) that makes him
come to the caller's aid.
Notes. Only one helper is recorded per caller (brain +0x204), and none while game state +0x14c is set. What the
help goal does and what brain state 2 means are inferred, not traced.
- Evidence: confirmed (code) at
0x0016b980,0x0029c570,0x002b6eb0,0x002b7d80; detail: traced - Wrapper
0x0035f688(registered byRegisterBindings); calls0x0016b980,0x0029c570,0x002b6eb0,0x002b7d80 - Used by 5 of 467 script chunks (15 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 2 of 28 levels, first
level31(mission 11) - Coney: not implemented
GangCanUseWorldFlags¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 or an unused slot does nothing. |
| 2 | on |
boolean (nil or 0 is false); default true | true (the default) lets the members use the level's world flags (ambient points where characters idle, sit or lean); false stops them. |
| 3 | percent |
number, truncated to an unsigned integer; default 10 | Chance in percent that a member uses a world flag (default 10; the scripts pass 75 or 100); forced to 0 when on is false. |
Returns nothing.
Lets the gang's current members wander to and use the level's world flags (ambient behaviour points), with a given likelihood; used for civilians and idle gangs.
Notes. Writes +0x2d1 (on) and +0x2d2 (percent) in each member's AI; the world-flag behaviour itself is inferred from the name.
- Evidence: confirmed (code) at
0x0016be30; detail: traced - Wrapper
0x00374688(registered byRegisterBindings); calls0x0016be30 - Used by 17 of 467 script chunks (37 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 21 of 28 levels, first
level87(mission 3) - Coney: implemented
GangClearBums¶
No arguments.
Returns nothing.
Deletes the bums in player 1's gang: takes the human at game state +0x228, walks the 16 member slots of its brain's
gang (+0x20c) and destroys (0x0021c7c8) every member whose character class has class byte +0x11b = 6, removing him
from the world, his gang and his formation. From the hub's use, this sends away bums the player recruited.
Notes. Destroys, does not just release: the handles become invalid; does nothing when there is no player 1; player 2's gang is not checked.
- Evidence: confirmed (code) at
0x0016b8d0,0x0021c7c8; detail: traced - Wrapper
0x0035f970(registered byRegisterBindings); calls0x0016b8d0Gang_ClearBums,0x0021c7c8Human_Destroy - Used by 2 of 467 script chunks (3 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
GangClearHandlers¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31, read as 16 bits); -1 or an unused slot does nothing. |
Returns nothing.
Removes every Lua message handler of the gang (the 26 slots at +0xe4 that GangSetMsgHandler fills) and, for each
current member, all 26 of the human's own script handlers (the set returned by its vtable +0x3c), so no script
callback fires for the gang's or its members' events any more.
Notes. Members who join later keep their own handlers; the members' handlers set with SetMsgHandler are cleared too, not only those the gang installed.
- Evidence: confirmed (code) at
0x0016ab90,0x001647e0,0x003858b8; detail: traced - Wrapper
0x00373400(registered byRegisterBindings); calls0x0016ab90Gang_ClearHandlers,0x001647e0Gang_ClearMsgHandlers,0x003858b8ScriptHandlers_ClearAll - Used by 2 of 467 script chunks (6 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
GangClearResponders¶
No arguments.
Returns nothing.
Dismisses every gang that was sent in response to a call for help or a crime: responding non-police gangs with no wanted state are deleted, police responders are stood down (0x0016cc60).
- Evidence: confirmed (code) at
0x0016b8b0; detail: traced - Wrapper
0x0035f668(registered byRegisterBindings); calls0x0016b8b0 - Used by 17 of 467 script chunks (17 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 26 of 28 levels, first
level80(mission 2) - Coney: implemented
GangClearWanted¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
Returns nothing.
Clears the gang's wanted status: makes the police gangs neutral towards it again and, when the gang is the player's, resets the wanted part of the HUD and the police state (0x00169a20).
Notes. global.lua calls it on GangWarriors. It also calls the script system's find-function slot, so a script callback may run (which one is not traced).
- Evidence: confirmed (code) at
0x0016b5e0; detail: traced - Wrapper
0x0035f630(registered byRegisterBindings); calls0x0016b5e0 - Used by 11 of 467 script chunks (14 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 26 of 28 levels, first
level80(mission 2) - Coney: implemented
GangCreate¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | type |
number, truncated to an integer | Gang type id (stored at gang +0x2c): selects the gang's configuration from the gang table (the CfgGang data); 0 is the Warriors and 1 the police. Type 1 also makes the new police gang enemies of every gang that is currently wanted. |
| 2 | name |
string | Unique name of the gang (up to about 28 characters); creation fails if a gang with this name already exists. |
| 3 | flag1 |
boolean (nil or 0 is false) | Read but not used by the C++ side (0x0016cdf0 takes only the type and the name). |
| 4 | flag2 |
boolean (nil or 0 is false) | Read but not used, as flag1. |
Returns number: The new gang's id (slot 0-31), or -1 when the name is already in use or all 32 slots are taken.
Creates a gang: takes a free slot, gives it a name and a type, clears its members and spawners, and sets up the type's default animation and response tables. Members are added afterwards (HuCreate's gang argument, GangAddMember, spawners).
Notes. 0x0016cdf0. A gang holds at most 10 members, or 16 for police (type 1) and type 0x17 (0x00166308).
- Evidence: confirmed (code) at
0x0016a1c8; detail: traced - Wrapper
0x00373148(registered byRegisterBindings); calls0x0016a1c8 - Used by 119 of 467 script chunks (1391 references); boot to menu: no; mission 1: yes; result used: yes
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
GangDelete¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); values of 32 and above (including -1) do nothing. |
Returns nothing.
Deletes a gang and every human still in it: every other gang stops treating it as friend or enemy, each member is destroyed at once (with its held object, radar blip and, for a player, its pad and HUD panel), the tactic is freed and the slot is reset.
Notes. 0x0016d068 then 0x00164738: the gang's message handlers are cleared first, then each member is removed (0x001664d8) and Human_Destroy(h, 0) (0x0021c7c8) runs inside the call. A player in the gang is destroyed too and taken off the player list; no other human becomes the player, so scripts call HuChangePlayerGang first. Characters, destroying a human; AI, deleting a gang.
- Evidence: confirmed (code) at
0x0016a1e8; detail: traced - Wrapper
0x00373200(registered byRegisterBindings); calls0x0016a1e8 - Used by 49 of 467 script chunks (146 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
GangEnableAttackStrategies¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | on |
boolean (nil or 0 is false); default true | true (the default) lets the gang use group attack strategies; false turns them off. |
Returns nothing.
Turns the gang's coordinated attack strategies (flanking, taking turns) on or off (a flag at gang +0xd9).
Notes. The flag write is confirmed; what the strategies are is inferred from the name.
- Evidence: confirmed (code) at
0x0016a2a8; detail: traced - Wrapper
0x00373308(registered byRegisterBindings); calls0x0016a2a8 - Used by 4 of 467 script chunks (11 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 21 of 28 levels, first
level87(mission 3) - Coney: implemented
GangEngageEnemy¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | target |
number, truncated to an unsigned integer | Handle of the human to attack (usually a player). |
Returns nothing.
Sets the whole gang on one target: every current member gets an EngageEnemy goal (type 11, Goal_EngageEnemy) pushed
on its brain against the target, so each walks up to it and fights it with the usual fight goal until the target is out
of range or gone, or a newer goal replaces it.
Notes. The target handle is not checked. The goal's constructor is 0x002af5b0 and its behaviour (Process 0x002afa48) a fight sub-goal (AI). The gang's tactic is left as it is.
- Evidence: confirmed (code) at
0x0016a870; detail: traced - Wrapper
0x00373930(registered byRegisterBindings); calls0x0016a870Gang_EngageEnemy - Used by 10 of 467 script chunks (18 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 6 of 28 levels, first
level80(mission 2) - Coney: implemented
GangExitWorld¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | exit |
number, truncated to an unsigned integer | Handle of the flag (path point) the members walk to before leaving; NilHandle sends them towards the player instead (0x004172c8). |
| 3 | callback |
string | Name of a Lua function called when the last member has gone, or nil. |
| 4 | deleteGang |
boolean (nil or 0 is false); default true | true (the default) deletes the gang once it is empty; false keeps the empty gang. |
Returns nothing.
Sends every member of the gang to an exit point to leave the level. When the gang is already empty, the callback (if any) runs at once and the gang is deleted unless deleteGang is false.
Notes. 0x0016a670; the per-member goal it gives is given through vtables and is not fully traced.
- Evidence: confirmed (code) at
0x0016a670; detail: traced - Wrapper
0x00373880(registered byRegisterBindings); calls0x0016a670 - Used by 24 of 467 script chunks (48 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 15 of 28 levels, first
level87(mission 3) - Coney: implemented
GangGetHeadCount¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31). |
| 2 | living |
boolean (nil or 0 is false) | false (default): count every member slot in use; true: count only members that are not out of the fight (0x00227e60). |
Returns number: The number of members (0-16); 0 for gang id -1.
Counts a gang's members, all of them or only those still fighting; the scripts use it to tell when a group of enemies is beaten.
Notes. 0x00166158.
- Evidence: confirmed (code) at
0x0016a458; detail: traced - Wrapper
0x003735d0(registered byRegisterBindings); calls0x0016a458 - Used by 63 of 467 script chunks (160 references); boot to menu: yes; mission 1: no; result used: yes
- Later in the story: 21 of 28 levels, first
level87(mission 3) - Coney: implemented
GangGetLeader¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31). |
Returns number: The leader's human handle, or NilHandle when the gang id is -1 or the gang has no leader.
Returns the gang's current leader.
Notes. 0x0016a578 asks the leader object for its handle through its vtable.
- Evidence: confirmed (code) at
0x0016a578; detail: traced - Wrapper
0x00373788(registered byRegisterBindings); calls0x0016a578 - Used by 6 of 467 script chunks (32 references); boot to menu: yes; mission 1: no; result used: yes
- Later in the story: 21 of 28 levels, first
level87(mission 3) - Coney: implemented
GangGetStandingCount¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 gives 0. |
Returns number: How many of the gang's (up to 16) members are still on their feet: alive handles that are not knocked down (0x00227dd8), dead (0x00227eb0) or in a third disabled state (0x00227d98).
Counts the gang's members that are still standing (0x00166220). Level scripts poll it to tell when a fight is won: the mission moves on once an enemy gang's count reaches 0.
Notes. Members whose handle no longer resolves (removed humans) are skipped. A knocked-down member who gets up counts again.
- Evidence: confirmed (code) at
0x0016a4a8; detail: traced - Wrapper
0x00373648(registered byRegisterBindings); calls0x0016a4a8Gang_GetStandingCount - Used by 29 of 467 script chunks (133 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 15 of 28 levels, first
level80(mission 2) - Coney: implemented
GangGoodToGo¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31, as returned by GangCreate); -1 always answers nil. |
| 2 | ignoreBusy |
boolean (nil or 0 is false) | false (or left off): a member whose AI is engaged in a fight also makes the answer nil; true: skip that check. |
Returns boolean (1 for true, nil for false): true (1) when every member is ready; nil otherwise or for gang id -1.
Asks whether the gang's members are free to move on, for example before a scripted walk. Each of the gang's 16 member
slots that holds a living human is checked, except humans whose character class is a bum: none may be in any of five
busy states (powered out, attached or held, recovering from a hit, and two more), and unless ignoreBusy is true none
may be engaged in a fight (another human holds one of its attack slots, or its brain has a target).
Notes. The five state tests are human-record state bits 0x20000 (0x00223b70), 0x800000 or human +0x280 attached (0x00227d28), 0x40000 recovery (0x00227dd8), 0x80000000 (0x00227e18) and 0x100000000 (0x00227eb0); the last two are not named. The bum exception is character class byte +0x11b = 6 (record 0x684620 + type × 0x1ac). The fight test is 0x002904a0 (brain attack slots +0x1a4, target +0x124). Empty member slots count as ready, so an empty gang answers true.
- Evidence: confirmed (code) at
0x0016a4e8,0x00165430; detail: traced - Wrapper
0x003736a0(registered byRegisterBindings); calls0x0016a4e8Gang_IsGoodToGoById,0x00165430Gang_AreMembersReady - Used by 2 of 467 script chunks (2 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 2 of 28 levels, first
level95(the hub) - Coney: implemented
GangInvincible¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | on |
boolean (nil or 0 is false) | true makes the members invincible, false mortal again. |
Returns nothing.
Makes every current member of a gang invincible or mortal and remembers the setting at gang +0xd8, so members added later get it too (0x0016a000 walks the 16 member slots; 0x00166308 applies it to a new member). The first mission's combat tutorial uses it to keep the player's crew alive.
- Evidence: confirmed (code) at
0x0016a260; detail: traced - Wrapper
0x003732a0(registered byRegisterBindings); calls0x0016a260 - Used by 3 of 467 script chunks (17 references); boot to menu: no; mission 1: yes; result used: no
- Later in the story: 1 of 28 levels, first
level31(mission 11) - Coney: implemented
GangIsASpawner¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 always answers nil. |
| 2 | name |
string | Spawner name as given to GangAddSpawner (compared case-sensitively). |
Returns boolean (1 for true, nil for false): true (1) when one of the gang's four spawners is in use and has this name; nil otherwise or for gang id -1.
Asks whether a gang still has an active spawner of the given name, for example to know whether reinforcements can still
come. The gang's four spawner slots (gang +0x640, 0x130 bytes each) are searched for one in use (+0x50) whose name
(+0x14) equals name.
Notes. A spawner stops counting as in use once it has made its total number of humans (AI: spawners), so the answer turns false when a spawner is exhausted. Plain strcmp (0x00430c4c).
- Evidence: confirmed (code) at
0x0016b618,0x00168b58; detail: traced - Wrapper
0x00374108(registered byRegisterBindings); calls0x0016b618Gang_HasSpawnerById,0x00168b58Gang_HasSpawnerNamed - Used by 2 of 467 script chunks (7 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
GangIsWanted¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31). |
| 2 | current |
boolean (nil or 0 is false); default true | true (the default, when the argument is absent) asks about the police wanted timer (+0x5e8), false about the second timer (+0x5f0), which a gang call (GoalCallGang, a scout's call) and GangRespond set. A nil passed explicitly counts as false. |
Returns boolean (1 for true, nil for false): true (1) when the chosen wanted flag is set; nil when it is not, when the gang id is -1 or when the slot is not in use.
Asks whether a gang is wanted by the police. With the second argument true (the default) it tests the gang's flag at +0x5e8, with false the one at +0x5f0; a gang id of -1 or a slot not in use gives false. global.lua asks it about the player's gang.
Notes. The reads are confirmed (0x0016b580); the default comes from 0x00409318, which returns the default only when
the argument is missing and 0 for a nil that is present, so GangIsWanted(g, nil) asks about +0x5f0. level87's chapter
5 polls it that way to fail the stealth section on a completed call (Stealth).
- Evidence: confirmed (code) at
0x0016b580; detail: traced - Wrapper
0x0035f5c0(registered byRegisterBindings); calls0x0016b580 - Used by 13 of 467 script chunks (25 references); boot to menu: yes; mission 1: no; result used: yes
- Later in the story: 20 of 28 levels, first
level80(mission 2) - Coney: implemented
GangLookAt¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | target |
number, truncated to an unsigned integer | Handle of the object or human to look at; its position is taken once, at the call. |
Returns nothing.
Makes every current member (up to 16) stop and turn to face a target: each member's brain is switched off as by BrDead (Brain_SetDead, 0x00292330), its goals flushed, and a turn-to-point action queued toward the target's position after a random delay of 0-499 ms. The members then stand facing it until a script switches their brains back on (GangBrDead or BrDead with false).
Notes. The delay unit (ms) is inferred from the 500 range; the facing is not updated if the target moves.
- Evidence: confirmed (code) at
0x0016a910; detail: traced - Wrapper
0x003739a8(registered byRegisterBindings); calls0x0016a910Gang_LookAt - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level52(mission 15) - Coney: not implemented
GangMakeEnemies¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | other |
number, truncated to an integer | The other gang id; -1 does nothing. |
Returns nothing.
Makes two gangs enemies of each other, both ways, so their members fight on sight.
Notes. GangSetEnemy in both directions (0x001690c8).
- Evidence: confirmed (code) at
0x0016acf0; detail: traced - Wrapper
0x00373b78(registered byRegisterBindings); calls0x0016acf0 - Used by 119 of 467 script chunks (355 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
GangMakeEnemiesOfType¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31, 16-bit); -1 or an unused slot does nothing. |
| 2 | type |
number, truncated to an integer | Gang kind (gang +0x2c, the type given to GangCreate); every gang in use of this kind is affected. |
Returns nothing.
Makes the gang and every gang in use of the given kind enemies of each other: in both gangs' masks the other's friend
bit (+0x3c) is cleared and its enemy bit (+0x38) set, as GangMakeEnemies does for one pair. Gangs of that kind made
later are not affected.
Notes. If the gang is itself of that kind its own enemy bit is set too, but a gang always counts its own members as friends (AI: gangs). The crime report uses the same routine one way for police gangs.
- Evidence: confirmed (code) at
0x0016ae60,0x0016c3a8,0x001690c8; detail: traced - Wrapper
0x00373c68(registered byRegisterBindings); calls0x0016ae60Gang_MakeEnemiesOfType,0x0016c3a8Gang_SetHostileToKind,0x001690c8Gang_SetEnemyBit - Used by 8 of 467 script chunks (17 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 4 of 28 levels, first
level3(mission 6) - Coney: implemented
GangMakeFriends¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | other |
number, truncated to an integer | The other gang id; -1 does nothing. |
Returns nothing.
Makes two gangs friends of each other, both ways.
Notes. GangSetFriend in both directions (0x00169060).
- Evidence: confirmed (code) at
0x0016ad80; detail: traced - Wrapper
0x00373bf0(registered byRegisterBindings); calls0x0016ad80 - Used by 37 of 467 script chunks (135 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 27 of 28 levels, first
level87(mission 3) - Coney: implemented
GangMakeNeutralOfType¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | type |
number, truncated to an integer | Gang type id (GangCreate's type, gang +0x2c; 0 the Warriors, 1 the police, Gangs); every gang in use of this type is affected. |
Returns nothing.
Makes the gang neutral towards every gang in use of the given type, both ways: each side's enemy and friend bits for the other are cleared, so they neither fight nor help each other. Gangs that are already friends (either way, including same-type or allied kinds) are left alone, and so is the gang itself.
Notes. Nothing happens when the gang is not in use. With type 0 the gang's own members, and the members of each type-0 gang made neutral when the given gang is itself of type 0, get brain byte +0x290 cleared (0x00169cc8; meaning not traced). The callee's third argument (0 here) would also calm the members and set a 3,000 ms timer; that path is not used by this binding.
- Evidence: confirmed (code) at
0x0016ae90,0x0016c470; detail: traced - Wrapper
0x00373ce0(registered byRegisterBindings); calls0x0016ae90Gang_MakeNeutralOfTypeById,0x0016c470Gang_MakeNeutralWithType - Used by 2 of 467 script chunks (4 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
GangQueueResponders¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | pos |
table of 3 numbers (t[1]..t[3]) | Position {x, y, z} in metres the responders are sent to (also how the nearest spawner is chosen); written back. |
| 2 | count |
number, truncated to an unsigned integer | How many humans the spawner sends (queue entry +0x14); 0 queues nothing. |
| 3 | delaySec |
number, truncated to an unsigned integer | Seconds before the dispatch is due. |
| 4 | human |
number, truncated to an unsigned integer | Handle of the human who called for help: his gang id goes in the entry, and his gang gets a 10 s wanted timer (gang +0x5f0). |
Returns nothing.
Queues reinforcements like a gang dispatch: when any gang has a spawner in the gang-dispatch states (9 or 10, Spawner
states), the nearest such spawner with room in its four-entry queue gets
an entry (due now + delaySec, the position, count, the caller's gang). When it is due the spawner makes a new gang
of its own type and sends it to the position (AI: spawners). Without such a
spawner it does nothing.
Notes. The entry's kind byte is 4 (crime reports use their own kinds via 0x0016df68). The 10 s timer is set whenever such a spawner exists, even when no entry was queued; Gang_UpdateWanted reads it.
- Evidence: confirmed (code) at
0x0016b678,0x0016cb78,0x0016e0f0,0x0016dc70,0x001698c8; detail: traced - Wrapper
0x003743f0(registered byRegisterBindings); calls0x0016b678,0x0016cb78,0x0016e0f0Responders_QueueGangCall,0x0016dc70,0x001698c8 - Used by 3 of 467 script chunks (4 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 3 of 28 levels, first
level93(mission 10) - Coney: not implemented
GangRemoveSpinningIcon¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
Returns nothing.
Removes the spinning marker icon from every member of a gang (the counterpart of GangAttachSpinningIcon).
- Evidence: confirmed (code) at
0x0016b358; detail: brief - Wrapper
0x0035f1c0(registered byRegisterBindings); calls0x0016b358 - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Coney: implemented
GangRemoveTurfBox¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | box |
number, truncated to an unsigned integer | Handle of a volume box previously added with GangAddTurfBox; any other handle changes nothing. |
Returns nothing.
Takes a volume box out of the gang's turf: of the eight turf slots at gang +0x15c the first holding that box is
cleared and the count at +0x17c lowered (0x00165260). The turf tests then ignore the box: 0x001652e8 (is a point
inside the turf) and 0x00165368 (is a standing member of another gang inside it), used by the gang's tactics and its
members' brains to decide where they go and whom they chase.
Notes. With no boxes left (count 0) both tests answer yes, so a gang without turf treats everywhere as its turf.
GangAddTurfBox fills the first empty slot, so removed slots are reused. The callers of the tests (0x0028ff38,
0x0031fdc0, 0x003200c8, 0x0030eec0 ...) are not traced one by one.
- Evidence: confirmed (code) at
0x0016a3a8; detail: traced - Wrapper
0x003734b0(registered byRegisterBindings); calls0x0016a3a8Gang_RemoveTurfBox - Used by 5 of 467 script chunks (23 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 4 of 28 levels, first
level80(mission 2) - Coney: implemented
GangRespond¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31) that responds; -1 or an unused slot does nothing. |
| 2 | pos |
table of 3 numbers (t[1]..t[3]) | Position {x, y, z} in metres to respond to; written back unchanged. |
| 3 | offender |
number, truncated to an unsigned integer | Handle of the human the gang responds to (the scripts pass the player); must be a live human or nothing happens. |
Returns nothing.
Sends every current member of the gang to respond to an incident at the position: each gets a respond goal of reason 4
(0x002c2d80) aimed at the offender, and its brain +0x28d is set. A police gang (kind 1) puts the offender's gang on
its wanted timer for 10 s (gang +0x5e8); any other gang sets the offender gang's second timer (+0x5f0) for 10 s and
first substitutes its spot animation 0x29c with a search set (0x0050cb58, 4 clips).
Notes. Members spawned later are not sent. The respond goal (0x002c2d80) is not traced here; wanted timers: Crimes: wanted. The second timer's effect is not traced.
- Evidence: confirmed (code) at
0x0016b728,0x002c2d80,0x00169878,0x001698c8; detail: traced - Wrapper
0x00374518(registered byRegisterBindings); calls0x0016b728Gang_Respond,0x002c2d80,0x00169878Gang_SetWantedTimer,0x001698c8Gang_SetSecondWantedTimer - Used by 2 of 467 script chunks (3 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level20(flashback 4) - Coney: not implemented
GangSetAlwaysSeen¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31, 16-bit); -1 or an unused slot does nothing. |
| 2 | on |
boolean (nil or 0 is false) | true sets the flag, false (or nil) clears it. |
Returns nothing.
Sets the gang's byte +0xdc. While it is set, an enemy brain scanning for foes (0x0028b358) notices the gang's members
anywhere within its sight range, skipping the view-cone, close-range and line-of-sight tests; and the gang's own members
in the EngageEnemy (11) and Spectate (16) goals skip their line-of-sight test (0x00222288).
Notes. The sight range itself (0x0028bf00) still applies. Readers: 0x0028b47c, 0x002affd8, 0x002b45c8.
- Evidence: confirmed (code) at
0x0016bde8,0x0028b358; detail: traced - Wrapper
0x00374620(registered byRegisterBindings); calls0x0016bde8Gang_SetAlwaysSeen,0x0028b358Brain_ScanEnemies - Used by 8 of 467 script chunks (11 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 7 of 28 levels, first
level3(mission 6) - Coney: implemented
GangSetAttackable¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 or an unused slot does nothing. |
| 2 | on |
boolean (nil or 0 is false); default true | true (the default) lets other AI humans pick the members as targets; false makes them not attackable. |
Returns nothing.
Writes the attackable byte (brain +0x11f) of every current member of a gang in use. Brain_IsAttackableBy (0x00290ea8)
returns it when an AI chooses whom to hit (Brain_PickAttack, FightGoal_Process and four other callers), so with false
the members are left alone by AI attackers; the player can still hit them.
Notes. Members added later keep their own value; grab goals clear and restore the byte themselves (0x002bb560, 0x002bb614). Brain_IsAttackableBy has extra rules for an attacker of character type 0xdd and for police (gang kind 0x17) brains of kind 4, not traced further.
- Evidence: confirmed (code) at
0x0016bb58,0x00290ea8; detail: traced - Wrapper
0x0035f790(registered byRegisterBindings); calls0x0016bb58Gang_SetAttackable,0x00290ea8Brain_IsAttackableBy - Used by 4 of 467 script chunks (7 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 3 of 28 levels, first
level93(mission 10) - Coney: implemented
GangSetCustomSpotDialog¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | sound |
string | Name of the speech sound members say when they spot the player; empty or nil clears it. |
Returns nothing.
Gives the gang a custom line of dialogue for when its members spot the player, replacing the default (hash stored at gang +0x608).
Notes. No script calls it.
- Evidence: confirmed (code) at
0x0016b280; detail: brief - Wrapper
0x0035f558(registered byRegisterBindings); calls0x0016b280 - Used by no script on the disc
- Coney: not implemented
GangSetDamageResponse¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | response |
number, truncated to an integer | Damage response mode (16-bit) written to every current member's brain (+0x220), as BrSetDamageResponse does for one human; scripts use the same values (0, 3, 4). |
Returns nothing.
Writes the damage response (brain +0x220) of every current member of the gang; members added later keep their own. It
is the gang form of BrSetDamageResponse.
Notes. No code that reads brain +0x220 was found (writers only: Brain_SetDamageResponse 0x00292758, brain init
0x0028a570, and goal inits that zero it such as Goal_ObjectThrower), so the value may have no effect in this build. The
gang's in-use flag is not checked.
- Evidence: confirmed (code) at
0x0016b460; detail: traced - Wrapper
0x0035f2f0(registered byRegisterBindings); calls0x0016b460 - Used by 2 of 467 script chunks (2 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level31(mission 11) - Coney: implemented
GangSetEnemy¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31) whose attitude changes; -1 does nothing. |
| 2 | other |
number, truncated to an integer | Gang id that the first gang now treats as an enemy; its bit is its gang index (gang +0x30). |
Returns nothing.
One-way relation: the first gang treats the second as an enemy. The other gang's bit is cleared in the first gang's
friend mask (+0x3c, setter 0x00168f30) and set in its enemy mask (+0x38, setter 0x00168f08); the second gang's own
masks are untouched. Use GangMakeEnemies for both directions.
Notes. One script calls it. No check that the first gang slot is in use. The mask setters may do more than store (not traced).
- Evidence: confirmed (code) at
0x0016ac98,0x001690c8; detail: traced - Wrapper
0x00373b00(registered byRegisterBindings); calls0x0016ac98Gang_SetEnemyById,0x001690c8Gang_SetEnemyBit - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level11(flashback 5) - Coney: not implemented
GangSetFriend¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31) whose attitude changes; -1 does nothing. |
| 2 | other |
number, truncated to an integer | Gang id that the first gang now treats as a friend. |
Returns nothing.
One-way relation: the first gang treats the second as a friend (its bit set in the friend mask, cleared in the enemy mask). Use GangMakeFriends for both directions.
Notes. No script calls it.
- Evidence: confirmed (code) at
0x0016ac40; detail: brief - Wrapper
0x00373a88(registered byRegisterBindings); calls0x0016ac40 - Used by no script on the disc
- Coney: not implemented
GangSetHearRange¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31, read as 16 bits); -1 or a gang with no members does nothing. |
| 2 | help |
boolean (nil or 0 is false) | Which range to set: true the range at which members hear allies calling for help (brain +0x138, default 20 m, as HuSetHelpHearRange), false the range at which they hear noises (brain +0x134, default 50 m, as HuSetHearRange). |
| 3 | range |
number (single precision) | Range in metres; exactly -1 restores the default (20 or 50). |
Returns nothing.
Sets one hearing range on every current member of the gang (the 16 member slots at gang +0x48), as HuSetHearRange or
HuSetHelpHearRange would for each; stealth sections shrink it so guards do not hear the player. -1 puts the default
back.
Notes. Only members alive at the call change; humans the gang spawns later keep their own default (inferred: the
gang stores no range). The readers of brain +0x134 / +0x138 are not traced here.
- Evidence: confirmed (code) at
0x0016bbf0; detail: traced - Wrapper
0x0035f7f8(registered byRegisterBindings); calls0x0016bbf0Gang_SetHearRange - Used by 7 of 467 script chunks (75 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 4 of 28 levels, first
level87(mission 3) - Coney: implemented
GangSetInvestigateResponse¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | response |
number, truncated to an integer | Investigate response mode written to every current member's AI (+0x224); the scripts mostly pass 0 (do not investigate) and a per-gang table value. |
Returns nothing.
Sets whether and how the gang's current members go to investigate disturbances (noises, fights) they notice.
Notes. Same per-member loop as GangSetThreatResponse; value meanings beyond 0 are inferred.
- Evidence: confirmed (code) at
0x0016b4f0; detail: traced - Wrapper
0x0035f3e8(registered byRegisterBindings); calls0x0016b4f0 - Used by 42 of 467 script chunks (112 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 22 of 28 levels, first
level87(mission 3) - Coney: implemented
GangSetLeader¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | human |
number, truncated to an unsigned integer | Handle of the human who becomes the gang's leader (stored at gang +0x44). |
Returns nothing.
Makes a human the gang's leader; the leader is the one the other members follow and the one GangGetLeader returns.
Notes. The handle is stored without checking membership.
- Evidence: confirmed (code) at
0x0016a538; detail: traced - Wrapper
0x00373710(registered byRegisterBindings); calls0x0016a538 - Used by 6 of 467 script chunks (8 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 22 of 28 levels, first
level87(mission 3) - Coney: implemented
GangSetLOS¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | range |
number (single precision) | Sight range in metres, written to every current member's brain (+0x130). |
Returns nothing.
Sets the sight range (brain +0x130, as HuSetLOSRange) of every current member of the gang: how far they see enemies,
used with the field of view +0x12c by the sight checks (AI). Later members keep their own.
Notes. Unlike GangSetAttackable it does not check that the gang is in use; an unused slot's empty member list makes it a no-op.
- Evidence: confirmed (code) at
0x0016a5e8; detail: traced - Wrapper
0x00373808(registered byRegisterBindings); calls0x0016a5e8Gang_SetSightRange - Used by 6 of 467 script chunks (16 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 5 of 28 levels, first
level93(mission 10) - Coney: not implemented
GangSetMaxConcurrent¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | spawner |
string | Name of one of the gang's spawners; an unknown name does nothing. |
| 3 | count |
number, truncated to an integer | How many of the spawner's humans may be alive at once (16-bit). A negative value -n spawns in waves: up to n, then nothing until all of them are dead. |
Returns nothing.
Changes how many humans a spawner keeps alive at the same time (spawner +0x5a). The spawner spawns another human only
while its living count (+0x5c) is below this; with a negative count it fills up to the magnitude and then waits for
the whole wave to die before starting the next.
Notes. Reader: GangSpawner_Update (0x001681a0, at 0x0016855c; the wave flag is spawner +0x51). The spawner's total
(+0x58) still ends it. Spawners: AI.
- Evidence: confirmed (code) at
0x0016b0b0,0x00168eb8; detail: traced - Wrapper
0x00374350(registered byRegisterBindings); calls0x0016b0b0Gang_SetSpawnerMaxConcurrent,0x00168eb8GangSpawner_SetMaxConcurrent - Used by 8 of 467 script chunks (34 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 5 of 28 levels, first
level34(mission 4) - Coney: implemented
GangSetMoney¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 or an unused slot does nothing. |
| 2 | money |
number, truncated to an integer | Money each member carries, in dollars; above 999 becomes 999, negative becomes 0. |
Returns nothing.
Sets the money carried by every current member of the gang (up to 16 member slots): the clamped value goes to +0x370
of each member human, which is what the player gets from mugging or looting that member. Armies of the Night uses it to
set how much each enemy wave drops.
Notes. Only members present at the call are changed; humans that join the gang later keep their own money. Empty member slots are skipped.
- Evidence: confirmed (code) at
0x0016bd38; detail: traced - Wrapper
0x0035f8f8(registered byRegisterBindings); calls0x0016bd38Gang_SetMoney - Used by 15 of 467 script chunks (23 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 5 of 28 levels, first
level60(Armies of the Night 1) - Coney: not implemented
GangSetMsgHandler¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | message |
number, truncated to an integer | Gang message id: an index into the gang's handler table (gang +0xe4 + 4 × id). The scripts use, for example, 1 for a member being hit, 2 for a member dying, 17 for an arrest and 18 for a death. |
| 3 | handler |
string | Name of the Lua function to call (dotted names such as "Menu.onHit" allowed), or nil to clear the handler. |
Returns nothing.
Registers the Lua function the gang calls when the given event happens to it or its members. The name is interned and looked up when the event fires, so the function can be defined or replaced later.
Notes. 0x00164bb8 stores the interned name (script-system slot +0xcc). Gang_OnEvent (0x00164c20) calls it with
(member, other, value): for message 18 the attacker and the members still standing, for 2 the headcount, for 17 the
event's value; other ids pass the event through a generic marshaller and count as handled when the function returns
true. The message ids' meanings are inferred from the scripts' handler names. Behaviour:
AI.
- Evidence: confirmed (code) at
0x0016ab38; detail: traced - Wrapper
0x00373370(registered byRegisterBindings); calls0x0016ab38 - Used by 140 of 467 script chunks (1155 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
GangSetNeutral¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31) whose attitude changes; -1 does nothing. |
| 2 | other |
number, truncated to an integer | Gang id the first gang now treats as neither friend nor enemy. |
Returns nothing.
One-way relation: clears the second gang's bit in both the enemy mask (gang +0x38) and the friend mask (+0x3c) of
the first gang, and stamps the relation-change time (+0x34) when a mask changed. The first gang's members then neither
attack the second gang on sight nor count it as friends; the second gang's own attitude is unchanged.
Notes. Gangs of the same kind, or both police kinds, still count as friends (AI: gangs). Call it both ways for a mutual truce.
- Evidence: confirmed (code) at
0x0016ae10,0x00169130; detail: traced - Wrapper
0x00373d58(registered byRegisterBindings); calls0x0016ae10Gang_SetNeutral,0x00169130Gang_ClearRelationBits - Used by 3 of 467 script chunks (5 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 3 of 28 levels, first
level93(mission 10) - Coney: not implemented
GangSetReactToViolence¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 or an unused slot does nothing. |
| 2 | on |
boolean (nil or 0 is false) | true: members react to violence they witness; false (or nil): they ignore it. |
Returns nothing.
Sets brain byte +0x267 on each current member of the gang (as BrSetReactToViolence does for one human). Only the
civilian brain reads it: on a violence event (0x14) within 15 m, a civilian with it set may report the crime, call the
police or its gang (Goal_CallGang), join the fight or react (PedReaction); with it clear the event is ignored.
Notes. Members spawned later keep their own default (set at brain init 0x0028a570, value not traced). Other brain kinds ignore the byte. The reaction rules (crime type enabled, 40 s since the gang's last report, chance) live in 0x002ffb30; see AI.
- Evidence: confirmed (code) at
0x0016bee0,0x002ffb30; detail: traced - Wrapper
0x00374718(registered byRegisterBindings); calls0x0016bee0Gang_SetReactToViolence,0x002ffb30CivilianBrain_OnEvent - Used by 1 of 467 script chunks (3 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level20(flashback 4) - Coney: not implemented
GangSetRespondPercentage¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31, read as 16 bits); -1 does nothing. Not range-checked otherwise. |
| 2 | percent |
number, truncated to an unsigned integer | Percentage of the members (0-100, stored as one byte) that may be helping at once before no more are sent. |
Returns nothing.
Sets the gang's respond percentage (byte +0xd7 of its 0xb10-byte record at 0x005e6e30): tactics that answer violence
(TacticHanginOut, TacticIdle with respond) send one more free member to fight the attacker only while the share of
members already in goal HelpRespond is below it, so 0 keeps the gang out of fights it did not start and 100 sends
everyone.
Notes. Readers at 0x00312580 and 0x00315228 (AI); other readers may exist. Values above 255 wrap (one byte).
- Evidence: confirmed (code) at
0x0016a2e8; detail: traced - Wrapper
0x0035f4e0(registered byRegisterBindings); calls0x0016a2e8Gang_SetRespondPercentage - Used by 10 of 467 script chunks (23 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 5 of 28 levels, first
level87(mission 3) - Coney: implemented
GangSetSpawnerModel¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | spawner |
string | Spawner name. |
| 3 | model |
string | New model/outfit name for the characters it spawns from now on. |
Returns nothing.
Changes the model a gang's spawner gives to new characters.
Notes. No script calls it.
- Evidence: confirmed (code) at
0x0016b018; detail: brief - Wrapper
0x00374178(registered byRegisterBindings); calls0x0016b018 - Used by no script on the disc
- Coney: not implemented
GangSetSpawnerMustBeOffScreen¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | spawner |
string | Name of one of the gang's spawners (as given to GangAddSpawner); an unknown name does nothing. |
| 3 | on |
boolean (nil or 0 is false) | true: the spawner only spawns while no camera can see its spot; false (or nil): it spawns regardless. |
Returns nothing.
Sets a gang spawner's off-screen flag (spawner +0x8c). While it is set, each update the spawner first checks whether
any player's camera can see a 0.3 m sphere 1.6 m above the spawner's position (in range, in the view frustum and not
hidden behind the level's collision mesh along one ray to its centre), and skips spawning that update if it can, so the
player never sees its humans appear.
Notes. Reader: GangSpawner_Update (0x001681a0, at 0x001685e8, the visibility test 0x001202e8). The test uses the spawner's own position, so it matters for spawners that place humans there, not for the states that place them away from the player. Spawners: AI.
- Evidence: confirmed (code) at
0x0016b070,0x00168e68; detail: traced - Wrapper
0x00374200(registered byRegisterBindings); calls0x0016b070Gang_SetSpawnerMustBeOffScreen,0x00168e68GangSpawner_SetMustBeOffScreen - Used by 12 of 467 script chunks (29 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 9 of 28 levels, first
level34(mission 4) - Coney: implemented
GangSetTargetable¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 or an unused slot does nothing. |
| 2 | on |
boolean (nil or 0 is false); default true | true (the default) lets the player lock on to the members; false (or nil) makes them impossible to target. |
Returns nothing.
Sets whether the gang's current members can be targeted (locked on to) by the player (a byte in each member's AI, +0x120).
- Evidence: confirmed (code) at
0x0016bac0; detail: traced - Wrapper
0x0035f728(registered byRegisterBindings); calls0x0016bac0 - Used by 4 of 467 script chunks (7 references); boot to menu: no; mission 1: yes; result used: no
- Later in the story: 2 of 28 levels, first
level31(mission 11) - Coney: implemented
GangSetThreatResponse¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | response |
number, truncated to an integer | Threat response mode written to every current member's AI (+0x21c of the member's AI controller); the scripts use 0 (ignore threats) and 2 (react to them); the full set of values is not traced. |
Returns nothing.
Sets how the gang's current members react to a threat (someone squaring up to or menacing them). Members added later keep their own setting.
Notes. Only members present at the call are changed (a loop over the 16 member slots); the meaning of each mode value is inferred from the scripts' use.
- Evidence: confirmed (code) at
0x0016b3d0; detail: traced - Wrapper
0x0035f1f8(registered byRegisterBindings); calls0x0016b3d0 - Used by 20 of 467 script chunks (43 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 22 of 28 levels, first
level87(mission 3) - Coney: implemented
GangStartSpawner¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31, read as 16 bits); -1 does nothing. |
| 2 | spawner |
string | Name the spawner was given by GangAddSpawner; only the gang's four spawner slots that are in use are searched (exact match), and an unknown name does nothing. |
| 3 | mode |
number, truncated to an integer | New spawner state (spawner +0x52): 0 stops it, 1 starts it, 2-5, 7, 8, 9 and 11 the others; 6, 10 and other values leave the state unchanged. |
| 4 | value |
number, truncated to an integer | The state's value (spawner +0x68: seconds for state 2, metres for 3, 5, 6 and 8), read as 16 bits; -1 keeps the current one (GangAddSpawner's 15th argument). |
Returns nothing.
Switches a gang's named spawner to a new state, optionally with a new value, and sets its next-spawn time (+0x64) to
now so a spawner made ready spawns on its next update. What each state does is in AI:
spawners.
Notes. The value and next-spawn time are written even when the mode is not accepted. Spawners only run while the level's spawn cap allows (SetSpawnMax). Each spawn calls GangAddSpawner's callback with (human, gang id, spawner name); states 6, 8 and 10 place the human out of the camera's sight (AI: out of sight).
- Evidence: confirmed (code) at
0x0016afc8,0x00168cd0,0x00168aa0; detail: traced - Wrapper
0x00374288(registered byRegisterBindings); calls0x0016afc8Gang_StartSpawner,0x00168cd0Gang_SetSpawnerState,0x00168aa0Gang_FindSpawnerByName - Used by 45 of 467 script chunks (229 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 20 of 28 levels, first
level87(mission 3) - Coney: implemented
GangSuspend¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id (slot 0-31); -1 does nothing. |
| 2 | on |
boolean (nil or 0 is false) | true suspends the gang, false resumes it. |
Returns nothing.
Suspends or resumes a gang (a flag at gang +0xd4); the scripts suspend gangs that are not part of the current scene, for example GangWarriors around cutscenes.
Notes. Only the flag write is confirmed; what the gang update skips while it is set is inferred.
- Evidence: confirmed (code) at
0x0016a220; detail: traced - Wrapper
0x00373238(registered byRegisterBindings); calls0x0016a220 - Used by 75 of 467 script chunks (357 references); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 24 of 28 levels, first
level80(mission 2) - Coney: implemented