Skip to content

Script bindings: World and objects

Verified against: SLUS_212.15 (NTSC-U, SHA1 e9cb2cc49aa046b9e494313dce2f5038ed17b2f4).

Bindings for objects, cars, doors, flags, paths, volume boxes and triggers: 80 in all. Conventions, the other categories and how to read an entry are on the masterlist.

Binding Returns Scripts Boot Mission 1 Evidence
AddFlag number 94 no yes confirmed (code)
AddPath usertype 15 no no confirmed (code)
AddVolumeBox number 53 no yes confirmed (code)
BreakGlassInRadius - 6 no no confirmed (code)
BreakObjectsInRadius - 12 no no confirmed (code)
CarCanBeDamagedBy - 0 no no inferred
CarDestroy - 5 no no confirmed (code)
CarExplode - 2 no no confirmed (code)
CarMakeGoodAsNew - 2 no yes confirmed (code)
CarPlaceInTrunk - 0 no no inferred
CarPlaceInTrunkOnDetach - 12 no no confirmed (code)
CarRemovePart - 3 no no confirmed (code)
CarSetColor - 15 no yes confirmed (code)
CarSetPartDamage - 0 no no inferred
CarSetPartOpen - 1 no no confirmed (code)
CarSpawn number 26 no yes confirmed (code)
CarSpawnRadio - 15 no yes confirmed (code)
ChangeBlocker - 2 no no confirmed (code)
ChangeCollision - 5 no no confirmed (code)
CloseDoor - 53 no yes confirmed (code)
ConvertJumpToDoor - 3 no no confirmed (code)
DisableDoorCollision - 0 no no confirmed (code)
DisableDoorLink - 2 no no confirmed (code)
DoorOpen - 19 no no confirmed (code)
DoorOpenDegree - 50 no yes confirmed (code)
EnableDoorLink - 2 no no confirmed (code)
EnableVolumeBox - 43 no no confirmed (code)
FindFlag number 3 no no confirmed (code)
FlagEnable - 2 no no confirmed (code)
FlagGetOwner number 9 no no confirmed (code)
FlagNetAddLink - 29 no yes confirmed (code)
FlagNetClear - 1 no no confirmed (code)
FlagNetTraverse - 27 yes yes confirmed (code)
FlagNetValidate - 1 no no confirmed (code)
FreezeWorld - 0 no no inferred
GetFlagPos usertype 14 yes no confirmed (code)
GetHitpoints number 2 no no confirmed (code)
GetLeftDoorHandle number 42 no yes confirmed (code)
GetObjectName string 8 no no confirmed (code)
GetPTank number 4 yes no confirmed (code)
GetRightDoorHandle number 29 no no confirmed (code)
IsDoorOpen boolean 2 no no confirmed (code)
IsInsideBox boolean 75 yes no confirmed (code)
ObjColor - 1 no no confirmed (code)
ObjDestroy - 93 yes yes confirmed (code)
ObjectChangeState - 1 no no confirmed (code)
ObjEnablePhysics - 12 no no confirmed (code)
ObjEnableZone - 95 yes yes confirmed (code)
ObjGetIndex number 7 no no confirmed (code)
ObjGetZone number 2 no no confirmed (code)
ObjHide - 50 yes no confirmed (code)
ObjIsA boolean 1 no no confirmed (code)
ObjIsAlive boolean 5 no no confirmed (code)
ObjIsZoneEnabled boolean 1 no no confirmed (code)
ObjMarkZone - 12 no no confirmed (code)
ObjScriptArgEnd - 0 no no confirmed (code)
ObjScriptArgStart - 0 no no confirmed (code)
ObjScriptPushInt - 0 no no confirmed (code)
ObjScriptPushObject - 0 no no confirmed (code)
ObjScriptSignal - 0 no no confirmed (code)
ObjSetTrainPoint - 7 no no confirmed (code)
ObjShow - 70 yes yes confirmed (code)
ObjSpawn number 123 yes yes confirmed (code)
ObjStartTrain - 7 no no confirmed (code)
ObjStopTrain - 3 no no confirmed (code)
OpenDoor - 46 no no confirmed (code)
OpenDoorAnimated - 6 no no confirmed (code)
OrientObject - 0 no no confirmed (code)
PathValid boolean 16 no no confirmed (code)
ReleasePTank - 4 yes no confirmed (code)
RotateVolumeBox - 31 no yes confirmed (code)
SetDoorPickable - 16 no no confirmed (code)
SetFlagPos - 19 no no confirmed (code)
SetPositionOfWater - 4 no no confirmed (code)
SpawnBreakableGlass number 32 no yes confirmed (code)
SpawnDoor number 46 no yes confirmed (code)
TriggerSphereCfg - 70 yes yes confirmed (code)
TriggerSphereEnable - 30 yes no confirmed (code)
TriggerSphereSetRadius - 2 no no confirmed (code)
UnloadTimedObjects - 1 no no confirmed (code)

AddFlag

AddFlag(name, pos, heading, kind, kind2) -> number
# Argument Read as Meaning
1 name string Flag name (the scripts use names like fP1_01); FindFlag looks flags up by it. Only the first 15 characters are kept.
2 pos table of 3 numbers (t[1]..t[3]) World position {x, y, z} in metres. Written back unchanged.
3 heading number (single precision) Facing in degrees (the scripts pass values such as 45, 89, 270), kept as given at +0x44; TeleportToFlag with heading -1 uses it.
4 kind number, truncated to an integer Integer stored with the flag (16-bit, at +0xd0); scripts usually pass 0. Meaning not traced.
5 kind2 number, truncated to an integer Second integer stored with the flag (16-bit, sign-extended to +0xd8); usually 0.

Returns number: Handle of the new flag.

Creates a flag: a named marker point with a facing, used as a spawn point, waypoint, objective or interaction point. Levels create thousands of them, in their AddFlagsBoxesPaths after CfgSetDatabaseSizes has sized the pool. See World flags.

Notes. Callee 0x00415c18 → 0x00415b68 (a flag from the flag pool, 0x00415af0, initialised by 0x00415e70 with NilHandle as parent). A full pool is not checked: the constructor then runs on a null pointer.

  • Evidence: confirmed (code) at 0x00415c18; detail: traced
  • Wrapper 0x00379fd0 (registered by RegisterBindings); calls 0x00415c18 Flag_Add
  • Used by 94 of 467 script chunks (7058 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

AddPath

AddPath(name, flags) -> WorldPath
# Argument Read as Meaning
1 name string Path name (such as WheelChairRace); 15 characters are kept.
2 flags table of 8 numbers (t[1]..t[8]) Up to eight flag (or object) handles {f1, ..., f8} in order; missing entries read as 0 and invalid handles are skipped. Written back unchanged (a missing entry comes back as 0).

Returns WorldPath object (nil for none): The path object, or nil when all 32 path slots are taken.

Creates a named path through up to eight flags: a 0x38-byte record (name, the flags' objects at +0x10 in order, count +0x32, slot +0x30, next-path link +0x34 empty) in the first free of 32 slots at 0x006fd870. The path is handed to GoalTravelPath, GoalTravelPath2 and TacticTravelPath for walks, chases and races.

Notes. Paths last until the level's flag manager is torn down (0x00415a38, which frees all 32; 0x004158f8 clears the slots at the next level). A path can be found again by name (0x00415878). No binding removes one, so a script that adds paths repeatedly runs out of slots.

  • Evidence: confirmed (code) at 0x00415740; detail: traced
  • Wrapper 0x0037ab38 (registered by RegisterBindings); calls 0x00415740 Path_Add
  • Used by 15 of 467 script chunks (42 references); boot to menu: no; mission 1: no; result used: yes
  • Later in the story: 10 of 28 levels, first level80 (mission 2)
  • Coney: implemented

AddVolumeBox

AddVolumeBox(name, kind, corner, size, enable, flags) -> number
# Argument Read as Meaning
1 name string Box name, for scripts' own reference (such as vFinishLine).
2 kind number, truncated to an integer Box kind: 0 a trigger box for any human, 2 a trigger box for the two players only, 3 a kind made by a factory (the turf boxes use 3); 1 is refused and returns NilHandle.
3 corner table of 3 numbers (t[1]..t[3]) Minimum corner {x, y, z} in world metres. Written back unchanged.
4 size table of 3 numbers (t[1]..t[3]) Extent {dx, dy, dz} in metres, added to the corner to give the opposite corner. Written back unchanged.
5 enable boolean (nil or 0 is false); default true True (default) creates the box enabled.
6 flags number, truncated to an unsigned integer Byte stored in the box (+0x6a); the scripts never pass it. Meaning not traced.

Returns number: Handle of the box, or NilHandle for kind 1 (and possibly when a pool is empty).

Creates an axis-aligned volume box, used to test whether characters are inside an area (IsInsideBox), to switch collision (ChangeCollision) and to mark turf. A kind-0 box is also a trigger: while enabled it tracks up to 60 humans inside it and sends itself message 3 when one enters, 5 while one stays (at most once per period) and 4 when one leaves or dies, so SetMsgHandler(box, 3, ...) fires on entry (scripting.md#triggers). A kind-2 box sends the same messages for the two players' humans only (the chase levels' camera and hint zones).

Notes. Kinds 0 and 2 come from two pools (0x0051483c, 0x00514814); kind 3 from the factory at 0x00514834. Kind 2: vtable 0x00545cb8, update 0x004134f8, candidates the player handles at 0x0051489c + 0x228; kind 3 in play is not traced. Rotate the box about the vertical axis with RotateVolumeBox. The trigger update of a kind-0 box is confirmed (code) at 0x00415378.

  • Evidence: confirmed (code) at 0x004125b8; detail: traced
  • Wrapper 0x0037ac70 (registered by RegisterBindings); calls 0x004125b8 VolumeBox_Add
  • Used by 53 of 467 script chunks (974 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

BreakGlassInRadius

BreakGlassInRadius(centre, radius)
# Argument Read as Meaning
1 centre number, truncated to an unsigned integer Handle of a flag or object giving the centre.
2 radius number (single precision) Radius in metres (scripts use 0.5-10).

Returns nothing.

Breaks every breakable pane of glass within the radius of a flag or object, for scripted smashes: each pane whose centre is within the radius gets the hit message (kind 100), and so does every object of type TYPE_GLASS (kind 101); cars' parts in range are hit as well (0x0038b0e8). No alarm, crime or statistic follows.

Notes. Implementation 0x003963b8; World objects: a pane's life.

  • Evidence: confirmed (code) at 0x003966c8; detail: traced
  • Wrapper 0x0036dc18 (registered by RegisterBindings); calls 0x003966c8 World_BreakGlassInRadius
  • Used by 6 of 467 script chunks (8 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 5 of 28 levels, first level80 (mission 2)
  • Coney: implemented

BreakObjectsInRadius

BreakObjectsInRadius(centre, radius)
# Argument Read as Meaning
1 centre number, truncated to an unsigned integer Handle of a flag or object whose position is the centre; an invalid handle does nothing.
2 radius number (single precision) Radius in metres (scripts use 0.5-1).

Returns nothing.

Breaks every world object within radius of a flag or object, the centre object included (a molotov's blast, a scripted smash): up to 384 objects found by the object search (0x0039a850) each get the destroy message 0x15 (0x003961d0). When the centre object is of type 30 (TYPE_BREAKANDENTER_DOOR), a break-in crime (type 1, severity 10) is first reported at its position.

Notes. Objects that do not handle 0x15 ignore it: glass shatters, a swinging door sends itself a hit two updates later (World objects). Humans are not world objects and are not hurt. Crime reports: Crimes.

  • Evidence: confirmed (code) at 0x00396390; detail: traced
  • Wrapper 0x0036dc90 (registered by RegisterBindings); calls 0x00396390 World_BreakObjectsInRadius
  • Used by 12 of 467 script chunks (22 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 7 of 28 levels, first level80 (mission 2)
  • Coney: implemented

CarCanBeDamagedBy

CarCanBeDamagedBy(car, who)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car.
2 who number, truncated to an integer Value stored as a 16-bit damage filter (+0x12d8); meaning not traced.

Returns nothing.

Restricts what can damage a car. No script calls it.

  • Evidence: inferred; detail: brief
  • Wrapper 0x00378790 (registered by RegisterBindings); calls 0x0038e030 Car_SetDamageFilter
  • Used by no script on the disc
  • Coney: not implemented

CarDestroy

CarDestroy(car)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car (CarCreate's or a parked car's).

Returns nothing.

Removes a car from the world at once, without an explosion or any effect: its model instance and physics bodies are released, its handle freed, it is taken off the task wheel, the objects it owns (its police lights at +0x1210 and the object at +0x1204) are released the same way, and the car goes back to the car pool.

Notes. Calls the object's virtual slot +0x4c (Car_Release, car vtable 0x00544c08); any other kind of handle gets that class's own slot +0x4c (Task_Unschedule in the base), so pass only cars. NilHandle or a stale handle does nothing.

  • Evidence: confirmed (code) at 0x0038dea8, 0x00387ad8; detail: traced
  • Wrapper 0x003784f0 (registered by RegisterBindings); calls 0x0038dea8 Car_Destroy, 0x00387ad8 Car_Release
  • Used by 5 of 467 script chunks (10 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 4 of 28 levels, first level95 (the hub)
  • Coney: implemented

CarExplode

CarExplode(car, quiet)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car; a bad handle does nothing.
2 quiet boolean (nil or 0 is false) true wrecks the car without the blast; false or nil (most calls) gives the full explosion.

Returns nothing.

Blows up a car that has not yet exploded: every part not already off takes full damage (it then draws its crumpled form; parts marked to fly off are thrown clear, or hidden when quiet) and the car is marked exploded (+0x12d5). Without quiet it also plays the fireball, screen shake, heat wave and sound, deals 300 damage to every human within 5 m with a clear line to it, breaks glass within 10 m, sends the car message 0x19 as (car, NilHandle, -1, 1) (heard only by SetGeneralCarMsgHandler), scores a statistic for whoever caused it (stat 0xb, up to 10 for the parts) and alerts the AI within 30 m.

Notes. A car with +0x1200 set is ignored (meaning not traced). Blast: Explosion_DamageHumansInRadius 0x00392638 (5 m, 300); 0x002936a8 sends AI event 0x17 within 30 m; 0x003963b8 is World_BreakGlassInRadius. What is drawn and who hears the message: Cars: explosion.

  • Evidence: confirmed (code) at 0x0038dfa0, 0x0038ab18, 0x0038ab50; detail: traced
  • Wrapper 0x003786a0 (registered by RegisterBindings); calls 0x0038dfa0 Car_Explode, 0x0038ab18 Car_TryExplode, 0x0038ab50 Car_DoExplode
  • Used by 2 of 467 script chunks (3 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 2 of 28 levels, first level34 (mission 4)
  • Coney: implemented

CarMakeGoodAsNew

CarMakeGoodAsNew(car)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car.

Returns nothing.

Repairs a car completely: every one of its 26 damageable parts is reset (0x003873c8) and its damage counters and broken flags are cleared (0x003875e8). A handle that is not a car does nothing.

  • Evidence: confirmed (code) at 0x0038e068; detail: traced
  • Wrapper 0x00378808 (registered by RegisterBindings); calls 0x0038e068 Car_Repair
  • Used by 2 of 467 script chunks (2 references); boot to menu: no; mission 1: yes; result used: no
  • Later in the story: 1 of 28 levels, first level14 (mission 12)
  • Coney: implemented

CarPlaceInTrunk

CarPlaceInTrunk(car, object)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car.
2 object number, truncated to an unsigned integer Handle of the game object (a weapon or item) put into the boot.

Returns nothing.

Puts an object into a car's boot at once (0x0038d538 with 1). No script calls it.

  • Evidence: inferred; detail: brief
  • Wrapper 0x00378840 (registered by RegisterBindings); calls 0x0038e098 Car_PlaceInTrunk
  • Used by no script on the disc
  • Coney: not implemented

CarPlaceInTrunkOnDetach

CarPlaceInTrunkOnDetach(car, object, itemKind)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car; an invalid handle does nothing.
2 object number, truncated to an unsigned integer Handle of the object (a weapon such as dyn_pipe_a) to put in the boot; ignored when itemKind is not 0.
3 itemKind number, truncated to an unsigned integer When non-zero, a sum of money (low 8 bits, so 1-255) dropped as a dyn_money pickup (template 0x0057e3d8) when the boot comes off; the pickup's +0x124 holds the amount. The scripts pass 5 (five dollars) with NilHandle.

Returns nothing.

Hides an item in a car's boot, released when the boot is knocked off the car (part 5 detached, 0x0038a4d8): the object is pinned and its handle stored (car +0x120c), or the item kind stored (+0x12e5); +0x12e4 marks the boot loaded. On release the object is moved to the boot's position, or a new pickup of the kind is made there, and the mark is cleared.

Notes. A later call replaces the earlier item. Release happens only in the part-damage step 0x0038a4d8 (amount, car, part record, part, instant, flag): a hit adds damage to the part (car +0x230 + part × 0xa0) and at 1.0 the part comes off (bit in +0x11f8); for part 5 on a non-instant call with +0x12e4 set, +0x12e4 is cleared and Car_ReleaseTrunkItem (0x0038d188) runs. Non-instant callers: the car's hit handler 0x0038bea0 (each hit on the boot's zone adds 0.34, so a held weapon knocks the boot off on the third hit; a human with flag 0x400000 adds 0.51, other humans 0.115), CarSetPartDamage (0x0038a7e8), and 0x0038b0e8 (parts in mask 0x2a80c0 only, not the boot). The car exploding (Car_DoExplode 0x0038ab50) detaches every part with instant = 1, which skips the release: the item is lost. CarRemovePart(car, 5, true) only sets the bits (0x0038c7d8) and never reaches 0x0038a4d8, so it releases nothing; it also marks the boot gone in +0x11f8, so later hits skip it and the item can no longer be released. The dyn_money pickup is a type-0x1c object: Human_PickUpObject (0x0023bf00) gives a player (not an AI) inventory item 2 (money) × +0x124 with the notify flag, so kind 5 is five dollars. It is placed at the boot's offset from the car type record (0x0057e4b0, rotated by the car), updates every 30 frames, and 0x00395d20 sets +0x120 = now + 15000 ms (inferred: it vanishes after 15 s). All confirmed (code) unless marked.

  • Evidence: confirmed (code) at 0x0038e0f0, 0x0038d538, 0x0038d528, 0x0038d188; detail: traced
  • Wrapper 0x003788b8 (registered by RegisterBindings); calls 0x0038e0f0 Car_PlaceInTrunkOnDetach, 0x0038d538 Car_SetTrunkObject, 0x0038d528 Car_SetTrunkItemKind, 0x0038d188 Car_ReleaseTrunkItem
  • Used by 12 of 467 script chunks (34 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 12 of 28 levels, first level87 (mission 3)
  • Coney: implemented

CarRemovePart

CarRemovePart(car, part, removed)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car; a handle that is not a car does nothing.
2 part number, truncated to an unsigned integer Car part id 0-25 (Cars, e.g. 5 the boot, 17/19/21 door windows, 18 a door); the scripts use 5, 17, 18 and 19.
3 removed boolean (nil or 0 is false) true removes the part (and the part linked to it, such as a door's window); false puts the part back.

Returns nothing.

Marks a part of a car as removed: with removed its bit is set in the car's removed-parts word (+0x11f0) and in the kept copy (+0x11f8), and the linked part from the car type's part record is removed with it; without, only the part's bit in +0x11f0 is cleared. A removed part can no longer be opened (CarSetPartOpen) or picked as a hit point on the car (0x0038c990), and the car's renderer reads the same word (inferred: it is no longer drawn).

Notes. Putting a part back leaves its bit in +0x11f8, which still excludes it as a hit point, and does not restore the linked part. Car explosions and contacts also write +0x11f0 (0x0038ac78, 0x0039442c).

  • Evidence: confirmed (code) at 0x0038dfe0, 0x0038c7d8; detail: traced
  • Wrapper 0x00378700 (registered by RegisterBindings); calls 0x0038dfe0 Car_RemovePart, 0x0038c7d8 Car_RemovePartBits
  • Used by 3 of 467 script chunks (7 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 2 of 28 levels, first level5 (mission 7)
  • Coney: implemented

CarSetColor

CarSetColor(car, colour)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car.
2 colour table of 4 numbers (t[1]..t[4]) Four components 0-1; the scripts pass {1, blue, green, red} (alpha first, then blue, green, red). Written back unchanged.

Returns nothing.

Sets a car's paint colour (stored at +0x12e8 / +0x12ec, with a 'colour set' flag at +0x1308).

Notes. Component order is read from the scripts' calls; the packing (0x0017aca8) is confirmed (code).

  • Evidence: confirmed (code) at 0x0038df38; detail: traced
  • Wrapper 0x003785c8 (registered by RegisterBindings); calls 0x0038df38 Car_SetColour
  • Used by 15 of 467 script chunks (23 references); boot to menu: no; mission 1: yes; result used: no
  • Later in the story: 14 of 28 levels, first level87 (mission 3)
  • Coney: implemented

CarSetPartDamage

CarSetPartDamage(car, part, damage)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car.
2 part number, truncated to an unsigned integer Car part id (see CarRemovePart).
3 damage number (single precision) Damage amount for the part; the scale is not traced.

Returns nothing.

Applies damage to one part of a car (0x0038a7e8). No script calls it.

  • Evidence: inferred; detail: brief
  • Wrapper 0x00378528 (registered by RegisterBindings); calls 0x0038dee8 Car_SetPartDamage
  • Used by no script on the disc
  • Coney: not implemented

CarSetPartOpen

CarSetPartOpen(car, part, open)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of the car object; a handle that is not a car does nothing.
2 part number, truncated to an unsigned integer Which opening: 0 boot (part 5), 1 bonnet (4), 2-5 the four doors (parts 14, 16, 18, 20). Other values do nothing.
3 open boolean (nil or 0 is false) true to open the part, false to close it.

Returns nothing.

Opens or closes a door, the bonnet or the boot of a parked car (Cars): Car_OpenPart sets the part's open bit (part state +0x96 bit 2) and, once the model is loaded, swings the part and its damaged form on their hinge (±45°, 0x0038cb70).

Notes. Nothing happens for a part the car has removed or marks as unable to open (+0x11f4). Which door each of 2-5 is (front/back, left/right) is inferred from the part boxes only.

  • Evidence: confirmed (code) at 0x0038d5b8, 0x0038d020, 0x0038cb70; detail: traced
  • Wrapper 0x0036ddc0 (registered by RegisterBindings); calls 0x0038d5b8 Car_SetPartOpen, 0x0038d020 Car_OpenPart, 0x0038cb70
  • 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 level14 (mission 12)
  • Coney: not implemented

CarSpawn

CarSpawn(typeName, pos, rot, unused, unused2) -> number
# Argument Read as Meaning
1 typeName string Car type name, such as car_van, car_osedan, car_coupe or car_wagon.
2 pos table of 3 numbers (t[1]..t[3]) World position {x, y, z} in metres. Written back unchanged.
3 rot table of 4 numbers (t[1]..t[4]) Orientation quaternion {x, y, z, w}. Written back unchanged.
4 unused number, truncated to an integer Not used by the callee; the scripts pass -1.
5 unused2 number, truncated to an unsigned integer Not used by the callee; the scripts pass 0.

Returns number: The new car's handle, or NilHandle when no car could be made.

Creates a parked car of a given type from the car pool (object manager +0x844), places it and returns its handle.

  • Evidence: confirmed (code) at 0x0038dde8; detail: traced
  • Wrapper 0x00378320 (registered by RegisterBindings); calls 0x0038dde8 Car_Spawn
  • Used by 26 of 467 script chunks (118 references); boot to menu: no; mission 1: yes; result used: yes
  • Later in the story: 19 of 28 levels, first level80 (mission 2)
  • Coney: implemented

CarSpawnRadio

CarSpawnRadio(car)
# Argument Read as Meaning
1 car number, truncated to an unsigned integer Handle of a car spawned in the level (scripts pass entries of Objects).

Returns nothing.

Puts a stealable car radio into a car (0x00389848 finds the car's part, 0x0038c868 creates the radio), so the player can break in and take it.

Notes. The 'stealable radio' meaning is inferred from the name and the game's car-radio theft; the call chain is confirmed (code).

  • Evidence: confirmed (code) at 0x0038d690; detail: traced
  • Wrapper 0x0036de50 (registered by RegisterBindings); calls 0x0038d690 Car_SpawnRadio
  • Used by 15 of 467 script chunks (37 references); boot to menu: no; mission 1: yes; result used: no
  • Later in the story: 10 of 28 levels, first level87 (mission 3)
  • Coney: implemented

ChangeBlocker

ChangeBlocker(pos, open)
# Argument Read as Meaning
1 pos table of 3 numbers (t[1]..t[3]) World position {x, y, z} inside the walkable area to change (only x and y are tested); written back unchanged.
2 open boolean (nil or 0 is false) false (or nil) blocks the area, true opens it again.

Returns nothing.

Blocks or unblocks the AI walkable area (a path polygon of the level's path data) containing a point, by setting or clearing its flag 0x08 (+0x48). A blocked polygon no longer counts for the walkable-line test, so AI humans stop steering straight through it (AI: path planning).

Notes. When several polygons contain the point, the one whose centre is nearest wins; none does nothing. Whether A* routes also avoid it (through the nodes) is not traced.

  • Evidence: confirmed (code) at 0x00252c28, 0x00250100; detail: traced
  • Wrapper 0x00379c80 (registered by RegisterBindings); calls 0x00252c28 NavLink_SetBlocked, 0x00250100 PathPolygon_FindAtPoint
  • Used by 2 of 467 script chunks (2 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 2 of 28 levels, first level34 (mission 4)
  • Coney: implemented

ChangeCollision

ChangeCollision(box, enable)
# Argument Read as Meaning
1 box number, truncated to an unsigned integer Handle of a volume box (from AddVolumeBox) or any object whose box is at +0x10 (min) and +0x20 (max); a bad handle does nothing.
2 enable boolean (nil or 0 is false) true enables, false (or nil) disables the world collision triangles inside the box.

Returns nothing.

Switches the level's static collision on or off inside a box: every collision triangle of the level's mesh whose three vertices lie in the box gets flag bit 0 set or cleared, so scripts can open a gap (or close one) where a door or barrier was.

Notes. A triangle only partly inside the box is left alone. The camera's main ray still tests disabled triangles (Collision: switching).

  • Evidence: confirmed (code) at 0x0034fba0, 0x00351160; detail: traced
  • Wrapper 0x00379c20 (registered by RegisterBindings); calls 0x0034fba0 CollisionMesh_SetEnabledInVolume, 0x00351160 CollisionMesh_SetEnabledInBox
  • Used by 5 of 467 script chunks (6 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 5 of 28 levels, first level3 (mission 6)
  • Coney: implemented

CloseDoor

CloseDoor(door)
# Argument Read as Meaning
1 door number, truncated to an unsigned integer Handle of the door.

Returns nothing.

Closes a door (state command 3): a swinging door swings back with its close sound, its collision triangles and body return and its number's navigation links get the avoid bit.

Notes. World objects: states and commands.

  • Evidence: confirmed (code) at 0x00397010; detail: traced
  • Wrapper 0x00379b78 (registered by RegisterBindings); calls 0x00397010 Door_Close
  • Used by 53 of 467 script chunks (84 references); boot to menu: no; mission 1: yes; result used: no
  • Later in the story: 26 of 28 levels, first level80 (mission 2)
  • Coney: implemented

ConvertJumpToDoor

ConvertJumpToDoor(pos)
# Argument Read as Meaning
1 pos table of 3 numbers (t[1]..t[3]) World position {x, y, z} in metres near the navigation link to change; written back unchanged.

Returns nothing.

Finds the navigation link of kind 4 (a choke point) nearest the position, within 5 m, and sets its kind word, and that of its reverse link, to 0x10, the kind DisableDoorLink and EnableDoorLink act on and that an AI follower takes by facing the waypoint and then walking or jumping (0x0029baa8). Scripts call it once a doorway has been opened up so later door-link switches find it. Nothing happens when no kind-4 link is that close.

Notes. The change lasts until the level's path data is reloaded. The doorway reading is inferred from the name and the door-link bindings; link kinds: World objects: navigation links.

  • Evidence: confirmed (code) at 0x00250db0, 0x00250bb8, 0x00250960; detail: traced
  • Wrapper 0x0036e228 (registered by RegisterBindings); calls 0x00250db0 NavLink_ConvertJumpToDoor, 0x00250bb8, 0x00250960
  • 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 level5 (mission 7)
  • Coney: implemented

DisableDoorCollision

DisableDoorCollision(door)
# Argument Read as Meaning
1 door number, truncated to an unsigned integer Handle of the door.

Returns nothing.

Turns off a door's collision (state command 5): its triangles and body, and the avoid bit on its number's navigation links. No script calls it.

  • Evidence: confirmed (code) at 0x00397338; detail: brief
  • Wrapper 0x00379bb0 (registered by RegisterBindings); calls 0x00397338 Door_DisableCollision
  • Used by no script on the disc
  • Coney: implemented
DisableDoorLink(pos)
# Argument Read as Meaning
1 pos table of 3 numbers (t[1]..t[3]) World position {x, y, z} in metres near the door link; written back unchanged.

Returns nothing.

Finds the navigation link of kind 0x10 (a doorway, as made by ConvertJumpToDoor) nearest the position within 5 m and sets its avoid bit (bit 31 of its second word), and its reverse link's: route planning then adds 1,600 to the edge's cost, so the AI goes another way when one exists but can still use the doorway. Nothing happens when no such link is that close.

Notes. The same bit that breakable doors set while closed (World objects: navigation links); EnableDoorLink clears it.

  • Evidence: confirmed (code) at 0x00250e00, 0x00250b68, 0x00250960; detail: traced
  • Wrapper 0x0036e2d8 (registered by RegisterBindings); calls 0x00250e00 NavLink_DisableDoor, 0x00250b68 NavLink_SetAvoidByKind, 0x00250960
  • Used by 2 of 467 script chunks (2 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 2 of 28 levels, first level81 (mission 8)
  • Coney: implemented

DoorOpen

DoorOpen(door, human)
# Argument Read as Meaning
1 door number, truncated to an unsigned integer Handle of the door.
2 human number, truncated to an unsigned integer Handle of the human who opens it (the player or an AI character).

Returns nothing.

Has a human open a door: the door receives message 0x0b with the human (then 0x00396d78 runs on both). A closed, unpickable swinging door swings 170 degrees away from the human, with its open sound.

Notes. The direction is the sign of the door's turned axis against the human-to-door direction (0x003f9910); World objects.

  • Evidence: confirmed (code) at 0x00396f08; detail: traced
  • Wrapper 0x00379a50 (registered by RegisterBindings); calls 0x00396f08 Door_OpenBy
  • Used by 19 of 467 script chunks (31 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 10 of 28 levels, first level34 (mission 4)
  • Coney: implemented

DoorOpenDegree

DoorOpenDegree(door, degrees)
# Argument Read as Meaning
1 door number, truncated to an unsigned integer Handle of the door.
2 degrees number, truncated to an integer Opening angle in degrees; the sign picks the swing direction (scripts use values such as -170, 130, 180).

Returns nothing.

Swings a door open to a given angle (message 0x42 with the angle), with its open sound; a closed door becomes opening (state 3). A pickable door only keeps the angle, for the human who later opens it.

Notes. World objects: states and commands.

  • Evidence: confirmed (code) at 0x00396e28; detail: traced
  • Wrapper 0x00379900 (registered by RegisterBindings); calls 0x00396e28 Door_OpenToAngle
  • Used by 50 of 467 script chunks (97 references); boot to menu: no; mission 1: yes; result used: no
  • Later in the story: 19 of 28 levels, first level80 (mission 2)
  • Coney: implemented
EnableDoorLink(pos)
# Argument Read as Meaning
1 pos table of 3 numbers (t[1]..t[3]) World position {x, y, z} in metres near the door link; written back unchanged.

Returns nothing.

Finds the kind-0x10 navigation link nearest the position within 5 m and clears its avoid bit and its reverse link's, so route planning costs the doorway normally again (undoing DisableDoorLink).

Notes. World objects: navigation links.

  • Evidence: confirmed (code) at 0x00250e48, 0x00250b10, 0x00250960; detail: traced
  • Wrapper 0x0036e388 (registered by RegisterBindings); calls 0x00250e48 NavLink_EnableDoor, 0x00250b10 NavLink_ClearAvoidByKind, 0x00250960
  • Used by 2 of 467 script chunks (2 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 2 of 28 levels, first level81 (mission 8)
  • Coney: implemented

EnableVolumeBox

EnableVolumeBox(box, enable)
# Argument Read as Meaning
1 box number, truncated to an unsigned integer Handle of the volume box (from AddVolumeBox); not checked.
2 enable boolean (nil or 0 is false) true enables the box, false disables it.

Returns nothing.

Enables or disables a volume box through its vtable +0x5c (for a plain box, 0x004152e0: byte +0x68). A disabled box stops testing who is inside, so it sends no enter (3), inside (5) or leave (4) messages; disabling also empties its occupant list without sending leave messages, so humans still inside on re-enabling get a fresh enter message.

Notes. Box behaviour: Scripts: triggers. Only the plain box's slot (vtable 0x00545df8) was read; other box kinds may differ.

  • Evidence: confirmed (code) at 0x00412bf8, 0x004152e0; detail: traced
  • Wrapper 0x0037af58 (registered by RegisterBindings); calls 0x00412bf8 VolumeBox_Enable, 0x004152e0 VolumeBox_SetEnabled
  • Used by 43 of 467 script chunks (173 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 17 of 28 levels, first level87 (mission 3)
  • Coney: implemented

FindFlag

FindFlag(name) -> number
# Argument Read as Meaning
1 name string Flag name given to AddFlag (compared case-sensitively with the stored 15-character name).

Returns number: Handle of the first flag with that name, or NilHandle.

Looks up a world flag by name: a linear search over the flags in creation order, returning the first whose name equals name (plain strcmp). Three scripts call it, once each.

Notes. A name longer than the 15 characters a flag keeps never matches. Converted as unsigned.

  • Evidence: confirmed (code) at 0x00415c48; detail: traced
  • Wrapper 0x0037a770 (registered by RegisterBindings); calls 0x00415c48 Flag_FindByName
  • Used by 3 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

FlagEnable

FlagEnable(flag, enable)
# Argument Read as Meaning
1 flag number, truncated to an unsigned integer Handle of the flag; any other object (type bit 0x80 clear) is ignored.
2 enable boolean (nil or 0 is false) true to enable the flag, false (or nil) to disable it.

Returns nothing.

Writes the flag's enabled word (+0xd4, 1 from AddFlag). A disabled flag is refused by the may-use test (0x00416718) and skipped by the nearest-flag search (0x00416f08), so AI humans stop picking it for their activities; a human already using it is not moved (Flags).

Notes. Goals given the flag directly by a script (GoalMoveToFlag and the like) do not check it (inferred). Store groups switch their flags off through 0x00417540, the same writer.

  • Evidence: confirmed (code) at 0x00415ce8, 0x00415dc8; detail: traced
  • Wrapper 0x0037a228 (registered by RegisterBindings); calls 0x00415ce8 Flag_Enable, 0x00415dc8 Flag_SetEnabled
  • Used by 2 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 level2 (mission 5)
  • Coney: implemented

FlagGetOwner

FlagGetOwner(flag) -> number
# Argument Read as Meaning
1 flag number, truncated to an unsigned integer Handle of a flag (marker) or of an object whose type bits include a flag (AsFlag, 0x00417a60).

Returns number: Handle of the human using the flag now (record +0xdc), or NilHandle when no one is or the handle is not a flag.

Returns who is using a flag now, for example which human is sitting at a chair marker, serving at a shop or tagging a wall. The AI goals that use a flag set the user when a human takes it and clear it when that human leaves (Flag_ReleaseUser, 0x004161b8, from MoveToUseFlag 0x002dbaa0, the shopkeeper goal and Tag_End).

Notes. The release only clears the user when it is the leaving human. The store that sets the user was not found as a direct write (inferred: an inlined write in the goals).

  • Evidence: confirmed (code) at 0x00416ed0; detail: traced
  • Wrapper 0x00378160 (registered by RegisterBindings); calls 0x00416ed0 Flag_GetOwner
  • Used by 9 of 467 script chunks (29 references); boot to menu: no; mission 1: no; result used: yes
  • Later in the story: 4 of 28 levels, first level87 (mission 3)
  • Coney: implemented
FlagNetAddLink(flag, link1, link2, link3, link4)
# Argument Read as Meaning
1 flag number, truncated to an unsigned integer Handle of the flag that becomes a node of the flag network.
2 link1 number, truncated to an unsigned integer Handle of a linked flag, or NilHandle.
3 link2 number, truncated to an unsigned integer Handle of a linked flag, or NilHandle.
4 link3 number, truncated to an unsigned integer Handle of a linked flag, or NilHandle.
5 link4 number, truncated to an unsigned integer Handle of a linked flag, or NilHandle.

Returns nothing.

Adds a node with up to four neighbours to the level's flag network, the graph of flags that wandering pedestrians and gang members walk along. The network holds at most 128 nodes; extra nodes are ignored.

Notes. Nodes are 20-byte records at 0x006e9440 (flag plus four links), with a 16-bit field per node at 0x006e9e40 and the last index at 0x006e9f40.

  • Evidence: confirmed (code) at 0x002a7458; detail: traced
  • Wrapper 0x0037a7e0 (registered by RegisterBindings); calls 0x002a7458 FlagNet_AddNode
  • Used by 29 of 467 script chunks (774 references); boot to menu: no; mission 1: yes; result used: no
  • Later in the story: 20 of 28 levels, first level87 (mission 3)
  • Coney: implemented

FlagNetClear

FlagNetClear()

No arguments.

Returns nothing.

Empties the flag network that FlagNetAddLink builds: the node count (0x006e9f40) goes to 0, and all 128 nodes' flag and four links become NilHandle with their 16-bit field (0x006e9e40) set to 0xffff. The level teardown does the same, so scripts need it only to rebuild a network within a level.

Notes. What happens to humans already walking the network (FlagNetTraverse) is not traced.

  • Evidence: confirmed (code) at 0x002a7328; detail: traced
  • Wrapper 0x0037ab18 (registered by RegisterBindings); calls 0x002a7328 FlagNet_Clear
  • 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 level95 (the hub)
  • Coney: implemented

FlagNetTraverse

FlagNetTraverse(human, mode, chance, flagA, flagB)
# Argument Read as Meaning
1 human number, truncated to an unsigned integer Handle of the human who starts walking the flag network.
2 mode number, truncated to an integer Movement mode: 0 keeps the human's current one; 1 (and 6-9) walk, 2 a faster pace (speed value 20), 3 a third mode. The scripts pass 1 or 7.
3 chance number, truncated to an unsigned integer Percentage 0-100: a random number below it picks one traversal variant, otherwise another (0x002aae30 gets 2 or 4).
4 flagA boolean (nil or 0 is false) Boolean passed to the traversal; meaning not traced.
5 flagB boolean (nil or 0 is false) Boolean passed to the traversal; meaning not traced.

Returns nothing.

Sends a human wandering along the flag network built with FlagNetAddLink. The player's own character (brain type 1) is handled separately and is not sent wandering.

Notes. Both forms release the human's current goal (0x0028d758). The mode-to-speed reading is inferred from the stored values.

Overload (registered first; the wrapper above checks its argument types and calls this one when they do not match): Used when the arguments do not fit the first form (argument 1 a number, 2-3 numbers or absent, 4-5 booleans or absent, nothing after 5). Starts the traversal with default settings.

FlagNetTraverse(human, flag, n)
# Argument Read as Meaning
1 human number, truncated to an unsigned integer Handle of the human.
2 flag boolean (nil or 0 is false) Read but not used.
3 n number, truncated to an integer Read but not used.

Returns nothing.

Wrapper 0x0037a8d0; calls 0x002a7810.

  • Evidence: confirmed (code) at 0x002a78c8; detail: traced
  • Wrapper 0x0037a968 (registered by RegisterBindings); calls 0x002a78c8 FlagNet_StartTraverse
  • Used by 27 of 467 script chunks (60 references); boot to menu: yes; mission 1: yes; result used: no
  • Later in the story: 19 of 28 levels, first level87 (mission 3)
  • Coney: implemented

FlagNetValidate

FlagNetValidate()

No arguments.

Returns nothing.

Does nothing visible: it walks the flag network (128 nodes of 0x14 bytes at 0x006e9440, each a flag handle and up to four linked flag handles) and looks up the node of every non-empty link, discarding the result. A debugging check whose reporting was compiled out; used once, by level 82.

Notes. A link to a flag with no node gives -1 from 0x002a73a8 and is silently ignored. No arguments, no results, no state changes.

  • Evidence: confirmed (code) at 0x002a7c48, 0x002a73a8; detail: traced
  • Wrapper 0x0037aaf8 (registered by RegisterBindings); calls 0x002a7c48 FlagNet_Validate, 0x002a73a8 FlagNet_FindNode
  • 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 level82 (flashback 1)
  • Coney: not implemented

FreezeWorld

FreezeWorld(value, name)
# Argument Read as Meaning
1 value number, truncated to an unsigned integer Number stored at 0x005e5690 for the freeze game mode before it is pushed; its meaning is not traced.
2 name string String argument; not used by the callee as decompiled.

Returns nothing.

Pushes the game mode object at 0x005e5670 (a freeze or pause mode) onto the game-mode stack after storing the first argument in it. No script calls it.

Notes. Unused by the shipped scripts. What the pushed mode does on screen is not traced.

  • Evidence: inferred; detail: brief
  • Wrapper 0x0036c740 (registered by RegisterBindings); calls 0x00158218 GameMode_PushFreeze
  • Used by no script on the disc
  • Coney: not implemented

GetFlagPos

GetFlagPos(flag) -> usertype
# Argument Read as Meaning
1 flag number, truncated to an unsigned integer Handle of the flag.

Returns tolua object (nil for none): The flag's position as an M_Vector4 (x y z w); when the flag has a live parent object (+0x48), that object's current position instead.

Returns where a flag is, following its parent object when it has one. The global.lua helper FlagPos(flag) turns the result into the table {x, y, z} that HuCreate and Teleport take.

  • Evidence: confirmed (code) at 0x00416bb8; detail: traced
  • Wrapper 0x0037a288 (registered by RegisterBindings); calls 0x00416bb8 Flag_GetPosition
  • Used by 14 of 467 script chunks (25 references); boot to menu: yes; mission 1: no; result used: yes
  • Later in the story: 4 of 28 levels, first level95 (the hub)
  • Coney: implemented

GetHitpoints

GetHitpoints(object) -> number
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of a world object (a breakable or damageable object, not a human).

Returns number: The object's remaining hitpoints (+0x128), or 0 when the handle does not resolve or the object is not damageable (its type-flags call lacks bit 8).

Returns a world object's remaining hitpoints, for scripts that wait for something to be broken. The handle is resolved, the object is checked to be of the damageable kind (vtable +0x24 flags & 8, 0x00395f38), and its hitpoints word is returned.

Notes. Doors and barriers keep their hitpoints in their data and mirror them at +0x128 after every hit (0x003a6ec8), so this reads a door's too (World objects: breaking a door). The value is pushed as unsigned (a negative word would read as 2^32 minus it).

  • Evidence: confirmed (code) at 0x00385918; detail: traced
  • Wrapper 0x0036c900 (registered by RegisterBindings); calls 0x00385918 Object_GetHitpoints
  • Used by 2 of 467 script chunks (3 references); boot to menu: no; mission 1: no; result used: yes
  • Later in the story: 1 of 28 levels, first level55 (mission 17)
  • Coney: implemented

GetLeftDoorHandle

GetLeftDoorHandle(door) -> number
# Argument Read as Meaning
1 door number, truncated to an unsigned integer Handle of a door made with SpawnDoor.

Returns number: Handle of the door's left leaf object (from the reply to message 0x10).

Returns the left leaf of a double door, which scripts then open, close or attach cameras to.

Notes. If the door does not resolve, the reply object of the previous query is read (0x003a50c0); a NilHandle result is not guaranteed.

  • Evidence: confirmed (code) at 0x00397400; detail: traced
  • Wrapper 0x00379d50 (registered by RegisterBindings); calls 0x00397400 Door_GetLeftLeaf
  • Used by 42 of 467 script chunks (74 references); boot to menu: no; mission 1: yes; result used: yes
  • Later in the story: 15 of 28 levels, first level80 (mission 2)
  • Coney: implemented

GetObjectName

GetObjectName(object) -> string
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of a world object (prop, door, pickup...), including an ObjSpawn record handle.

Returns string (nil for none): The object's type name from the object type table (for example a dyn_... name), or <null> when the handle resolves to nothing or to something that is not a world object (a human, a flag, a car).

Returns the type name of a world object: the type table record (0x00512c04) at the object's type index (+0x112), name at +0x28. Scripts use it to tell which kind of object a message came from.

Notes. Resolving an ObjSpawn record handle spawns the object if it is not live (Objects: spawning). The world-object check is 0x00395f38.

  • Evidence: confirmed (code) at 0x003859f0; detail: traced
  • Wrapper 0x0036c9c8 (registered by RegisterBindings); calls 0x003859f0 Obj_GetTypeName
  • Used by 8 of 467 script chunks (26 references); boot to menu: no; mission 1: no; result used: yes
  • Later in the story: 7 of 28 levels, first level95 (the hub)
  • Coney: implemented

GetPTank

GetPTank(resource, pos, count, distance, capacity) -> number
# Argument Read as Meaning
1 resource number, truncated to an integer Packed resource id: the sprite sheet (particle page) index in the top 16 bits and an entry in the low bits (the front end passes 786437 and 1835027).
2 pos table of 3 numbers (t[1]..t[3]) Origin {x, y, z} of the batch. Written back unchanged.
3 count number, truncated to an integer Integer passed to the batch set-up; the front end passes 1 or 10.
4 distance number (single precision) Number passed to the batch set-up; the front end passes 9000 or 100000 (a draw distance or lifetime; not traced).
5 capacity number, truncated to an integer Integer the scripts pass as 256; read but the callee passes a fixed 0xff in its place.

Returns number: Handle of the sprite batch (its slot index shifted left 16 bits); keep it for ReleasePTank.

Creates a PTank, a RenderWare particle-tank sprite batch, from a sprite sheet. The front end uses two for the menu background and releases them when it finishes.

Notes. Callee 0x0039c388 → 0x003a4e88 → 0x0018aec0 on the resource manager (0x0050cd4c). See GUI for PTank instances. The meaning of count and distance is not traced.

  • Evidence: confirmed (code) at 0x0039c388; detail: traced
  • Wrapper 0x00378bf8 (registered by RegisterBindings); calls 0x0039c388 PTank_Create
  • Used by 4 of 467 script chunks (7 references); boot to menu: yes; mission 1: no; result used: yes
  • Later in the story: 1 of 28 levels, first level95 (the hub)
  • Coney: implemented

GetRightDoorHandle

GetRightDoorHandle(door) -> number
# Argument Read as Meaning
1 door number, truncated to an unsigned integer Handle of a swinging door (dyn_door_*, made with SpawnDoor or from the level).

Returns number: Handle of the door's right leaf object (data +0x18), or NilHandle when the door has one leaf, the handle is invalid or the object is not a door.

Asks a swinging door for its right leaf: message 0x10 makes the door put its leaf in the message scratch, which is read back (0x003a50d0). Scripts use the leaf handle to break, hide or test one half of a double door; a single-leaf door has only a left leaf (GetLeftDoorHandle).

Notes. Door data and leaves: World objects.

  • Evidence: confirmed (code) at 0x00397478; detail: traced
  • Wrapper 0x00379dc8 (registered by RegisterBindings); calls 0x00397478 Door_GetRightLeaf
  • Used by 29 of 467 script chunks (47 references); boot to menu: no; mission 1: no; result used: yes
  • Later in the story: 12 of 28 levels, first level80 (mission 2)
  • Coney: implemented

IsDoorOpen

IsDoorOpen(door) -> boolean
# Argument Read as Meaning
1 door number, truncated to an unsigned integer Handle of the door object.

Returns boolean (1 for true, nil for false): true when the door answers open; nil while it is closed, still swinging, broken, for a non-door object or for a bad handle.

Asks a door whether it is open: a query message 0x0c is delivered at once to the object's message handler, and a swinging door answers yes only in state 5, fully open with its collision removed (about 29 ticks after the swing starts) (World objects: swinging doors). Scripts poll it to wait until a door they opened can be walked through.

Notes. The answer is read from the message's reply (0x003a8518); objects that do not handle 0x0c leave it 0.

  • Evidence: confirmed (code) at 0x00397508, 0x003fb8d0; detail: traced
  • Wrapper 0x00379f80 (registered by RegisterBindings); calls 0x00397508 Door_IsOpen, 0x003fb8d0
  • 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 level81 (mission 8)
  • Coney: implemented

IsInsideBox

IsInsideBox(box, object) -> boolean
# Argument Read as Meaning
1 box number, truncated to an unsigned integer Handle of the volume box.
2 object number, truncated to an unsigned integer Handle of a human or other game object.

Returns boolean (1 for true, nil for false): True when the object's position is inside the box (taking its rotation into account); false (nil) otherwise or when either handle is invalid.

Tests whether a character or object stands inside a volume box.

  • Evidence: confirmed (code) at 0x00413198; detail: traced
  • Wrapper 0x0037afb8 (registered by RegisterBindings); calls 0x00413198 VolumeBox_ContainsObject
  • Used by 75 of 467 script chunks (297 references); boot to menu: yes; mission 1: no; result used: yes
  • Later in the story: 23 of 28 levels, first level80 (mission 2)
  • Coney: implemented

ObjColor

ObjColor(object, colour)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the game object.
2 colour table of 4 numbers (t[1]..t[4]) Colour {r, g, b, a} as whole numbers 0-255. The binding and the packer each multiply by 255 and keep the low 8 bits, so a whole 0-255 component comes out as itself and a 0-1 one does not (1.0 gives 1). Written back unchanged.

Returns nothing.

Sets a tint colour on a game object (stored twice in the object, +0xc8 and +0xcc).

Notes. The components are passed to the colour packer 0x0017aca8 in reverse order (a, b, g, r), giving the word 0xRRGGBBAA that ObjSpawn's tint also sets (Object tints).

  • Evidence: confirmed (code) at 0x00396bd0; detail: brief
  • Wrapper 0x00378088 (registered by RegisterBindings); calls 0x00396bd0 Obj_SetColour
  • Used by 1 of 467 script chunks (3 references); boot to menu: no; mission 1: no; result used: no
  • Coney: implemented

ObjDestroy

ObjDestroy(object, viaMessage)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the game object.
2 viaMessage boolean (nil or 0 is false) False deletes the object at once; true sends it the destroy message (0x15) so it is removed through its own handling (scripts usually omit it).

Returns nothing.

Removes a game object. If a human is holding it, the human first lets go of it. Without viaMessage an objective marker and its column vanish at once; with it they fade out over about 1 s first (Objects: objective markers).

Notes. The release path chooses by the object type's class byte (+0x65): 6 and 5 call different release routines (0x00258330, 0x0024ce40), others 0x00257f38.

  • Evidence: confirmed (code) at 0x00396c58; detail: traced
  • Wrapper 0x00377f18 (registered by RegisterBindings); calls 0x00396c58 Obj_Destroy
  • Used by 93 of 467 script chunks (265 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

ObjectChangeState

ObjectChangeState(object, state)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the game object.
2 state number, truncated to an integer State number for the object's state command (message 0x22); for swinging doors 2 or 8 open, 3 or 7 close, 5 removes collision, 6 restores it, 10 makes it pickable and 0 or 11 not (World objects).

Returns nothing.

Sends message 0x22 (state command) carrying state to the object through the task manager; what happens depends on the object's type, and for doors it is the command the door bindings (OpenDoor, CloseDoor and the rest) send. One script calls it directly.

Notes. The handle is resolved at send time; an unresolved handle sends to nothing; object types other than doors that handle 0x22 were not surveyed.

  • Evidence: confirmed (code) at 0x003976c8, 0x003a2e00; detail: traced
  • Wrapper 0x00379210 (registered by RegisterBindings); calls 0x003976c8 Obj_ChangeState, 0x003a2e00 Task_SendMessage
  • 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 level86 (mission 9)
  • Coney: implemented

ObjEnablePhysics

ObjEnablePhysics(object, enable)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the game object; a handle that does not resolve to a live object does nothing.
2 enable boolean (nil or 0 is false) true gives the object a physics (collision) body; false removes it.

Returns nothing.

Gives a game object a body in the physics system or takes it away (object +0x118). On: if it has none, a body is made with the shape its object type asks for (type +0x84: 1 a box of the type's sizes +0x78/+0x7c/+0x80, 2 a sphere of half +0x78, otherwise a default shape of radius 0.75 unless the model forbids it), the object's static flag (0x200 in +0x54) is cleared, body flags are set from the type's class and flags, and the body is marked moved and made to follow the object; an existing body is re-enabled. Off: the body is freed, so humans and objects no longer collide with it.

Notes. The physics system is collision bodies, not free rigid-body motion (Physics); "on" does not by itself make the object fall. Off does not set the static flag back. Class 0x30 also gets a state command 2 (vtable +0x124), not traced.

  • Evidence: confirmed (code) at 0x00396a90, 0x00391d48, 0x003924d8; detail: traced
  • Wrapper 0x00377f78 (registered by RegisterBindings); calls 0x00396a90 Obj_EnablePhysics, 0x00391d48 Obj_CreatePhysicsBody, 0x003924d8 Obj_FreePhysicsBody
  • Used by 12 of 467 script chunks (73 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 7 of 28 levels, first level5 (mission 7)
  • Coney: implemented

ObjEnableZone

ObjEnableZone(zone, enable)
# Argument Read as Meaning
1 zone number, truncated to an unsigned integer Zone number (the scripts use globals such as Zone31). Zones group the level's placed objects so whole areas can be switched in and out.
2 enable boolean (nil or 0 is false) True to enable the zone, false to disable it.

Returns nothing.

Enables or disables an object zone: sets or clears bit zone of the spawn table's zone mask (object manager +0x840, mask at +0x20) and marks the table for an update, so the objects of that zone are spawned or removed.

Notes. That the dirty flag (+0x67e8) causes spawning or removal is inferred from the names; the bit operation is confirmed (code) at 0x00398348.

  • Evidence: confirmed (code) at 0x00396778; detail: traced
  • Wrapper 0x00377b20 (registered by RegisterBindings); calls 0x00396778 ObjZone_Enable
  • Used by 95 of 467 script chunks (305 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

ObjGetIndex

ObjGetIndex(typeName) -> number
# Argument Read as Meaning
1 typeName string Object type name, such as a dyn_... name from the object configuration; case-sensitive.

Returns number: The type's index (record +0x60) in the object type database (0x00512c04), or -1 for an unknown or nil name.

Looks up an object type by name in the object database's hash table and returns its index, the id other bindings take for a kind of object (such as the throwables of GoalStationaryThrower and GoalBigLedgeThrower).

  • Evidence: confirmed (code) at 0x00397780, 0x003913d8; detail: traced
  • Wrapper 0x0036ded8 (registered by RegisterBindings); calls 0x00397780 ObjType_FindIndex, 0x003913d8 ObjectDb_FindByName
  • Used by 7 of 467 script chunks (51 references); boot to menu: no; mission 1: no; result used: yes
  • Later in the story: 5 of 28 levels, first level34 (mission 4)
  • Coney: implemented

ObjGetZone

ObjGetZone(object) -> number
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of a game object (a dynamic object from ObjSpawn or a placed one).

Returns number: The object zone (0-1023) stored in the object's spawn record, or -1 when the handle does not resolve to an object or no spawn record carries its id.

Returns the object zone a game object was spawned into: the top 10 bits of its spawn record's type-and-zone word (+0x20, shifted right by 22), the same zone ObjSpawn takes and ObjEnableZone switches on and off (World objects).

Notes. The lookup scans the ObjectTaskManager's spawn records (+0x14, count +0x18, 0x28 bytes each) for the one whose u16 +0x24 matches the object's id (vtable +0x2c); linear in the record count.

  • Evidence: confirmed (code) at 0x00396810, 0x00398f60; detail: traced
  • Wrapper 0x00377c70 (registered by RegisterBindings); calls 0x00396810 Obj_GetZone, 0x00398f60 ObjectManager_GetSpawnZone
  • 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 level86 (mission 9)
  • Coney: not implemented

ObjHide

ObjHide(object)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the game object.

Returns nothing.

Hides a game object without destroying it (show/hide message 0x0a with 0). An objective marker fades out over about 1 s (Objects: objective markers).

  • Evidence: confirmed (code) at 0x00396b68; detail: traced
  • Wrapper 0x00378050 (registered by RegisterBindings); calls 0x00396b68 Obj_Hide
  • Used by 50 of 467 script chunks (154 references); boot to menu: yes; mission 1: no; result used: no
  • Later in the story: 24 of 28 levels, first level80 (mission 2)
  • Coney: implemented

ObjIsA

ObjIsA(object, typeName) -> boolean
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of a game object.
2 typeName string Object type name to compare with, such as dyn_speaker.

Returns boolean (1 for true, nil for false): True when the object's type id equals the id the name hashes to (0x00143f68 on the table at 0x005d91e0); false (nil) otherwise or for an invalid handle.

Tests whether a game object is of a given type.

  • Evidence: confirmed (code) at 0x00397838; detail: brief
  • Wrapper 0x00377ab0 (registered by RegisterBindings); calls 0x00397838 Obj_IsType
  • Used by 1 of 467 script chunks (20 references); boot to menu: no; mission 1: no; result used: yes
  • Coney: not implemented

ObjIsAlive

ObjIsAlive(object) -> boolean
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of any game object (world object, human, car, flag...).

Returns boolean (1 for true, nil for false): true (1) when the handle resolves to a live object; nil for NilHandle, a stale handle (the object destroyed and its slot reused) or a removed spawn record.

Tests whether a handle still names an object, for example whether a breakable prop has been destroyed. It works for every kind of handle, not only world objects.

Notes. For an ObjSpawn record handle, resolving spawns the object when it is not live, so the call answers true (and brings it into the world) unless the record is removed (Tasks: handles).

  • Evidence: confirmed (code) at 0x00397598; detail: traced
  • Wrapper 0x0036de88 (registered by RegisterBindings); calls 0x00397598 Obj_Exists
  • Used by 5 of 467 script chunks (6 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 3 of 28 levels, first level95 (the hub)
  • Coney: implemented

ObjIsZoneEnabled

ObjIsZoneEnabled(zone) -> boolean
# Argument Read as Meaning
1 zone number, truncated to an unsigned integer Object zone number 0-254 (Object zones); not range-checked.

Returns boolean (1 for true, nil for false): true when the zone is enabled: its bit is set in the object manager's zone mask (+0x20, eight words).

Tests whether an object zone is enabled, i.e. whether ObjEnableZone last switched it on (zone 0 is on and 1-254 off when a level starts, Tasks). Enabled zones are those whose spawn records the object manager creates.

  • Evidence: confirmed (code) at 0x003967a8; detail: traced
  • Wrapper 0x00377b80 (registered by RegisterBindings); calls 0x003967a8 ObjZone_IsEnabled
  • 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 level14 (mission 12)
  • Coney: not implemented

ObjMarkZone

ObjMarkZone(zone, kind, removed)
# Argument Read as Meaning
1 zone number, truncated to an unsigned integer Object zone number (the zone ObjSpawn gave the records, Object zones).
2 kind number, truncated to an integer Must be 0; any other value makes the call do nothing.
3 removed number, truncated to an integer Non-zero marks every record of the zone removed; 0 restores them (the scripts always pass 0).

Returns nothing.

Marks or unmarks every spawn record of an object zone as removed (record +0x24 bit 0x40000): a removed record is never spawned again and its handle resolves to NilHandle. With 0, the zone's records come back, and live objects that were stored hidden are stored back into their records (shown again when next spawned). Scripts call ObjMarkZone(zone, 0, 0) to bring a zone's objects back.

Notes. The record bits are on Objects: spawn records. Unmarking also clears the stored-hidden bit 0x100000 and stores (0x00399428) a live record whose object has flag 0x800000. Whether marking removes objects already live is not traced. Different from ObjEnableZone, which switches the zone's streaming bit.

  • Evidence: confirmed (code) at 0x003967e0, 0x003983b0; detail: traced
  • Wrapper 0x00377bd0 (registered by RegisterBindings); calls 0x003967e0 ObjZone_Mark, 0x003983b0
  • Used by 12 of 467 script chunks (27 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 6 of 28 levels, first level95 (the hub)
  • Coney: implemented

ObjScriptArgEnd

ObjScriptArgEnd()

No arguments.

Returns nothing.

Finishes the message argument list started by ObjScriptArgStart (object manager message end, 0x003a2d40).

  • Evidence: confirmed (code) at 0x003a2628; detail: brief
  • Wrapper 0x0036db10 (registered by RegisterBindings); calls 0x003a2628 ObjMsg_End
  • Used by no script on the disc
  • Coney: not implemented

ObjScriptArgStart

ObjScriptArgStart()

No arguments.

Returns nothing.

Starts building an argument list for a message to a game object (object manager message begin, 0x003a2d20). Follow with ObjScriptPushInt / ObjScriptPushObject, then ObjScriptSignal, then ObjScriptArgEnd.

Notes. No shipped script uses the ObjScript family; it exposes the object message mechanism the other object bindings use internally.

  • Evidence: confirmed (code) at 0x003a2600; detail: brief
  • Wrapper 0x0036daf0 (registered by RegisterBindings); calls 0x003a2600 ObjMsg_Begin
  • Used by no script on the disc
  • Coney: not implemented

ObjScriptPushInt

ObjScriptPushInt(value)
# Argument Read as Meaning
1 value number, truncated to an integer Integer to append to the message's argument list.

Returns nothing.

Appends an integer to the object message being built.

  • Evidence: confirmed (code) at 0x003a2660; detail: brief
  • Wrapper 0x0036db30 (registered by RegisterBindings); calls 0x003a2660 ObjMsg_PushInt
  • Used by no script on the disc
  • Coney: not implemented

ObjScriptPushObject

ObjScriptPushObject(object)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of a game object to append as an argument; skipped if it does not resolve.

Returns nothing.

Appends an object reference to the object message being built.

  • Evidence: confirmed (code) at 0x003a26e0; detail: brief
  • Wrapper 0x0036dbe0 (registered by RegisterBindings); calls 0x003a26e0 ObjMsg_PushObject
  • Used by no script on the disc
  • Coney: not implemented

ObjScriptSignal

ObjScriptSignal(object, message)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the game object that receives the message; nothing happens if it does not resolve.
2 message number, truncated to an integer Message id. Ids used by other bindings include 0x0a show/hide, 0x12 start particle, 0x13 end particle, 0x15 destroy, 0x22 state command and 0x42 open a door to an angle.

Returns nothing.

Sends a message with the arguments built so far to a game object, which handles it according to its type.

  • Evidence: confirmed (code) at 0x003a2688; detail: brief
  • Wrapper 0x0036db68 (registered by RegisterBindings); calls 0x003a2688 ObjMsg_Send
  • Used by no script on the disc
  • Coney: not implemented

ObjSetTrainPoint

ObjSetTrainPoint(train, object, index, gap)
# Argument Read as Meaning
1 train number, truncated to an unsigned integer Train slot 0-3 (scripts use 0 and 1); each is a 0x150-byte record at 0x006f3a10. Not range-checked.
2 object number, truncated to an unsigned integer Handle of an object riding the train (a prop or particle object moved with it); its position is read every update.
3 index number, truncated to an unsigned integer Point index 0-11 along the train (record +0xe0 + 4 × index); the point count becomes at least index + 1.
4 gap number, truncated to an integer 0: the segment from this point to the next is part of the train; non-zero: no segment starts here (scripts set 1 on the last point). Record +0x110 + 4 × index.

Returns nothing.

Sets one point of a train hazard: a moving line of objects (a subway train's cars) that AI humans must keep clear of. While the train runs (ObjStartTrain), every update re-reads the points' positions, and any AI human (not down or out) within the train's width of a segment is marked unreachable for that frame and, unless it already has one, gets a RunFromTrain goal (type 7) to get off the line; route following (0x00414188) also stops and waits 1 s at a blocked segment.

Notes. Update 0x00413d90 (all four slots via 0x00413728); the highest index with gap 0 is kept at +0x149. Moving the objects is the scripts' job (inferred). Index above 11 overruns into the gap table.

  • Evidence: confirmed (code) at 0x00413770, 0x004138a8; detail: traced
  • Wrapper 0x0036e0b0 (registered by RegisterBindings); calls 0x00413770 Train_SetPoint, 0x004138a8 TrainRecord_SetPoint
  • Used by 7 of 467 script chunks (68 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 4 of 28 levels, first level81 (mission 8)
  • Coney: not implemented

ObjShow

ObjShow(object, fadeDist)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the game object.
2 fadeDist number (single precision) Draw distance in metres (stored at +0x138): beyond it minus 2 m the object fades out over 2 m; 0 or nothing for none. The scripts pass a FadeInDist field or nothing.

Returns nothing.

Makes a hidden game object visible again (show/hide message 0x0a with 1); resolving the handle spawns the object first if it is not live. An objective marker (dyn_w_mission and the other dyn_objective types) fades its disc and column in over about 1 s (Objects: objective markers).

Notes. The renderer's use of +0x138 is ObjectRender_ApplyFadeDistance (0x0017fa80): alpha × (distance − camera distance) / 2 once the camera is within 2 m of the distance; an attached object uses its parent's and is not drawn beyond it.

  • Evidence: confirmed (code) at 0x00396a08; detail: traced
  • Wrapper 0x00377fd8 (registered by RegisterBindings); calls 0x00396a08 Obj_Show
  • Used by 70 of 467 script chunks (181 references); boot to menu: yes; mission 1: yes; result used: no
  • Later in the story: 24 of 28 levels, first level80 (mission 2)
  • Coney: implemented

ObjSpawn

ObjSpawn(typeName, pos, rot, unused, zone, flags, extra, flagName) -> number
# Argument Read as Meaning
1 typeName string Object type name from the object configuration (config_preload3.lua's CfgObj entries), such as dyn_w_mission or dyn_s_neon_a.
2 pos table of 3 numbers (t[1]..t[3]) World position {x, y, z} in metres. Written back unchanged.
3 rot table of 4 numbers (t[1]..t[4]) Orientation as a quaternion {x, y, z, w} (the scripts pass {0, 0, 0, -1} or rotations about z). Written back unchanged.
4 unused number, truncated to an integer Not used by the callee; the scripts always pass -1.
5 zone number, truncated to an unsigned integer Object zone number the object belongs to (stored in the spawn record's top bits); 0 for none.
6 flags number, truncated to an unsigned integer Spawn flags: bit 0 (1) makes the record take an id the caller passes (the binding passes none), bit 1 (2) a physics-related bit for most types, bit 6 (64) another record bit; the scripts pass 0, 64 and similar.
7 extra number, truncated to an unsigned integer; default 4294967295 The object's tint, a colour word 0xRRGGBBAA (record +0x14, then object +0xc8); default 4294967295, white, no tint (Object tints).
8 flagName string Optional name of a flag (marker) the object is linked to; nil for none.

Returns number: A handle to the new spawn record (record index << 16, serial 0), or NilHandle when it was suppressed. Resolving it spawns the object if it is not live.

Places a game object of a configured type at a position and orientation and returns its handle. It adds a spawn record; the object itself is made when the handle is first resolved (any binding taking it, such as SceneAddObject) or when a camera comes within 70 m, and its model is the Object List record of the type's name. Key pickups (dyn_key...) and the power cuffs (dyn_powercuffs) are suppressed unless the matching unlockable is set (0x00424130 on the unlockables manager at 0x006fe998).

Notes. Callee 0x00396858 builds a spawn record through 0x00398940 (ObjRecord_Add); 0x00398fe0 spawns a record's object on resolve, 0x00399d88 streams records in and out, 0x00399080 makes the object by the type's name and 0x003a44c8 attaches its model (Objects: dynamic objects). extra goes to the record (+0x14) and from there to the object's tint (0x003992a4, Object tints), confirmed (code); the flag bits' meaning is inferred from how the record is filled. The power cuffs are additionally suppressed when 0x0041d160 on the game state is non-zero.

  • Evidence: confirmed (code) at 0x00396858; detail: traced
  • Wrapper 0x00377cc8 (registered by RegisterBindings); calls 0x00396858 Obj_Spawn
  • Used by 123 of 467 script chunks (2875 references); boot to menu: yes; mission 1: yes; result used: yes
  • Later in the story: 28 of 28 levels, first level80 (mission 2)
  • Coney: implemented

ObjStartTrain

ObjStartTrain(train, width)
# Argument Read as Meaning
1 train number, truncated to an unsigned integer Train slot 0-3 to start.
2 width number (single precision) Half-width of the danger zone in metres (record +0x144): humans within this distance of a train segment run from it. Scripts pass 1.4 and 2.5.

Returns nothing.

Starts a train hazard: it clears the slot's point count and highest-point byte, stores width and sets the running flag (+0x148), so from the next update AI humans near its segments run from it (see ObjSetTrainPoint). ObjStopTrain stops it.

Notes. The reset zeroes the point count, so points must be set (again) after this call; the point handles themselves stay. Avoidance itself: RunFromTrain goal (Process 0x002f9c88), not traced here.

  • Evidence: confirmed (code) at 0x004137d8, 0x00413890; detail: traced
  • Wrapper 0x0036e178 (registered by RegisterBindings); calls 0x004137d8 Train_Start, 0x00413890 TrainRecord_Reset
  • Used by 7 of 467 script chunks (8 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 4 of 28 levels, first level81 (mission 8)
  • Coney: not implemented

ObjStopTrain

ObjStopTrain(train)
# Argument Read as Meaning
1 train number, truncated to an unsigned integer Train slot index 0-3 (0x150-byte records at 0x006f3a10); not range-checked.

Returns nothing.

Clears the running byte (+0x148) of a scripted train slot. A running train is a chain of points (ObjSetTrainPoint) with a radius (+0x144, ObjStartTrain's second argument) that AI movement treats as a barrier: Trains_IsPathClear (0x00414188, from MoveAction_Update and 0x002221e0) rejects a human-sized step that passes within the radius of any segment. Once stopped, AI humans may cross the line again; the points stay set.

Notes. Nothing visible moves or stops: the slot holds no objects of its own beyond the points (inferred: the subway train's danger zone). ObjStartTrain resets the slot and runs it again.

  • Evidence: confirmed (code) at 0x00413828, 0x00414188, 0x00413c48; detail: traced
  • Wrapper 0x0036e1f0 (registered by RegisterBindings); calls 0x00413828 Train_Stop, 0x00414188 Trains_IsPathClear, 0x00413c48 TrainRecord_IsPathClear
  • Used by 3 of 467 script chunks (3 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

OpenDoor

OpenDoor(door)
# Argument Read as Meaning
1 door number, truncated to an unsigned integer Handle of a swinging door.

Returns nothing.

Swings a door open with no one opening it: state command 2 (message 0x22). A door that is not pickable resets its leaves, swings to 170 degrees with its open sound, and its collision goes about half a second later; a pickable (locked) door ignores it.

Notes. The door's side of it: Objects: door states. Any object that answers message 0x22 receives command 2; NilHandle does nothing.

  • Evidence: confirmed (code) at 0x00396ea0; detail: traced
  • Wrapper 0x00379ac8 (registered by RegisterBindings); calls 0x00396ea0 Door_Open
  • Used by 46 of 467 script chunks (85 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 23 of 28 levels, first level95 (the hub)
  • Coney: implemented

OpenDoorAnimated

OpenDoorAnimated(object, human)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the door or button object to use.
2 human number, truncated to an unsigned integer Handle of the human who uses it.

Returns nothing.

Makes a human use a door or button with an animation: the human's object target becomes the object (0x00227080) and its state code becomes 26 (0x002266a8), the door-opening action; the door itself is not sent anything here. This is the same path a player's triangle press on a door takes.

Notes. Does nothing unless the second handle is a human and the first resolves. What state 26 plays and how it opens the door (anim 666, inferred) is not traced (Objects: opening).

  • Evidence: confirmed (code) at 0x00396fa8; detail: traced
  • Wrapper 0x00379b00 (registered by RegisterBindings); calls 0x00396fa8 Door_OpenAnimated
  • Used by 6 of 467 script chunks (7 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

OrientObject

OrientObject(object, degrees, axis)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the game object to rotate.
2 degrees number (single precision) Rotation angle in degrees.
3 axis table of 3 numbers (t[1]..t[3]) Rotation axis as {x, y, z} (world space; z is up). Written back unchanged.

Returns nothing.

Sets a game object's orientation to a rotation of degrees about axis, keeping its position (the quaternion is built from half the angle in radians and applied through the object's set-transform method).

Notes. No script calls it.

  • Evidence: confirmed (code) at 0x00385c90; detail: brief
  • Wrapper 0x0036ccc0 (registered by RegisterBindings); calls 0x00385c90 Obj_SetAxisAngle
  • Used by no script on the disc
  • Coney: not implemented

PathValid

PathValid(from, to) -> boolean
# Argument Read as Meaning
1 from number, truncated to an unsigned integer Handle of the first game object (usually a human).
2 to number, truncated to an unsigned integer Handle of the second game object.

Returns boolean (1 for true, nil for false): True when a walkable route exists between the two objects' positions; nil when not, or when either handle is invalid.

Asks the path data whether a human could walk between two objects: true when both positions lie on walkable polygons and either the straight segment stays inside them or an A* route exists over the graph (all edge flags allowed) that passes no node 0x00251718 rejects; false otherwise or for an invalid handle.

Notes. 0x00386010 reads both positions (object vtable +0xa4) and calls 0x0024e078(from, to, 0, 0, 1, 0xffff): polygon lookup 0x00250708, straight check 0x0024fbf8, end nodes 0x00251150, search 0x002511c8, then the route is freed. What 0x00251718 tests on a node is not traced. Planning: AI.

  • Evidence: confirmed (code) at 0x00386010; detail: traced
  • Wrapper 0x0036cf88 (registered by RegisterBindings); calls 0x00386010 Obj_PathExists
  • Used by 16 of 467 script chunks (17 references); boot to menu: no; mission 1: no; result used: yes
  • Later in the story: 16 of 28 levels, first level87 (mission 3)
  • Coney: implemented

ReleasePTank

ReleasePTank(ptank)
# Argument Read as Meaning
1 ptank number, truncated to an unsigned integer Handle returned by GetPTank.

Returns nothing.

Frees a sprite batch made by GetPTank (0x003a4f78 releases the resource manager slot handle >> 16).

  • Evidence: confirmed (code) at 0x0039c3d0; detail: traced
  • Wrapper 0x00378d78 (registered by RegisterBindings); calls 0x0039c3d0 PTank_Release
  • Used by 4 of 467 script chunks (7 references); boot to menu: yes; mission 1: no; result used: no
  • Later in the story: 1 of 28 levels, first level95 (the hub)
  • Coney: implemented

RotateVolumeBox

RotateVolumeBox(box, m00, m01, m10, m11)
# Argument Read as Meaning
1 box number, truncated to an unsigned integer Handle of the volume box.
2 m00 number (single precision) First element of a 2 × 2 rotation about the vertical axis (cos of the angle).
3 m01 number (single precision) Second element (-sin).
4 m10 number (single precision) Third element (sin).
5 m11 number (single precision) Fourth element (cos). The scripts pass values like 0, -1, 1, 0 (90 degrees) or 0.707, -0.707, 0.707, 0.707 (45 degrees).

Returns nothing.

Gives a volume box a rotation about the vertical axis, stored as a 2 × 2 matrix in the box (+0x48 to +0x54).

Notes. The inside test (0x00412a18) rotates the box's four corners about its centre by this matrix (x' = m00 dx + m01 dy, y' = m10 dx + m11 dy), confirmed (code); that the values are a cos/sin pair follows from the scripts' values.

  • Evidence: confirmed (code) at 0x00412c40; detail: traced
  • Wrapper 0x0037ae68 (registered by RegisterBindings); calls 0x00412c40 VolumeBox_SetRotation
  • Used by 31 of 467 script chunks (211 references); boot to menu: no; mission 1: yes; result used: no
  • Later in the story: 21 of 28 levels, first level80 (mission 2)
  • Coney: implemented

SetDoorPickable

SetDoorPickable(door, pickable)
# Argument Read as Meaning
1 door number, truncated to an unsigned integer Handle of the swinging door; an invalid handle does nothing.
2 pickable boolean (nil or 0 is false); default true true (the default) makes the lock pickable (state command 10); false makes it unpickable (state command 11), first ending the lock-pick game of any player picking it.

Returns nothing.

Sets whether the player can pick a door's lock. Pickable (only while the door is shut) shows a glint on it, removes its collision body, offers the lock-pick action and refuses OpenDoor, DoorOpen and DoorOpenDegree. Unpickable removes the glint and restores the collision body; any player whose object target is the door has the mini-game ended (MiniGame_End) and state flag 0x20000000 cleared first.

Notes. The command goes as message 0x22. Three door types start pickable. Door side: World objects: lock picking; the game: Crimes: lock picking.

  • Evidence: confirmed (code) at 0x00397078; detail: traced
  • Wrapper 0x00379e40 (registered by RegisterBindings); calls 0x00397078 Door_SetPickable
  • Used by 16 of 467 script chunks (24 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 9 of 28 levels, first level80 (mission 2)
  • Coney: implemented

SetFlagPos

SetFlagPos(flag, pos)
# Argument Read as Meaning
1 flag number, truncated to an unsigned integer Handle of the flag; not checked (an invalid handle writes through a null pointer).
2 pos table of 3 numbers (t[1]..t[3]) New world position {x, y, z} in metres. Written back unchanged.

Returns nothing.

Moves a flag to a new position (record +0x10, w = 1). Humans and goals that read the flag afterwards use the new spot; a flag that follows a parent keeps reporting the parent's position.

Notes. No type check: a handle of another object writes that object's +0x10. The heading is unchanged.

  • Evidence: confirmed (code) at 0x00416b68, 0x004161d8; detail: traced
  • Wrapper 0x0037a150 (registered by RegisterBindings); calls 0x00416b68 Flag_SetPosition, 0x004161d8 Flag_SetPositionRaw
  • Used by 19 of 467 script chunks (37 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 17 of 28 levels, first level87 (mission 3)
  • Coney: implemented

SetPositionOfWater

SetPositionOfWater(pos, rot, width, length, colour, waveHeight, waveSpeed)
# Argument Read as Meaning
1 pos table of 3 numbers (t[1]..t[3]) Origin {x, y, z} of the water plane in world metres (z is the water height); the 0-1 grid runs from here, so it is a corner (inferred).
2 rot table of 4 numbers (t[1]..t[4]) Orientation quaternion {x, y, z, w}, normalised; all zeros means none. The scripts pass {0, 0, 0, -1} (none) or {-0.01, -0.01, -1, 1}.
3 width number (single precision) Size of the plane along its x in metres (110-300 in the scripts).
4 length number (single precision) Size of the plane along its y in metres (110-1339).
5 colour table of 3 numbers (t[1]..t[3]) Water colour {r, g, b}, components 0-1.
6 waveHeight number (single precision) Wave amplitude in metres: each grid column's vertices rise and fall by sin(time × waveSpeed + column) × this (scripts 0, 0.1 or 1).
7 waveSpeed number (single precision) Time multiplier of the waves; it also scrolls the texture along x (scripts 0.1 or 0.25).

Returns nothing.

Places, sizes and colours the level's water surface: a grid of 3 vertices across its width by 9 along its length (2 × 8 cells, z up, wave height in metres), textured with the single texture water (256 × 256) of the WAD file named after the CRC-32 of water_tex, repeated 4 times across and 16 times along. The first call creates the WaterEffect (kept at 0x005147c4 + 0x5c); later calls move it, resize it, recolour it and change its waves. Used by the river and dock levels. Details: Graphics: the water surface.

Notes. The wrapper writes the three tables back unchanged. The wave also modulates each vertex's alpha (225 + 5 sin). The update (0x00191dd8) runs when the phase has moved more than 0.3 (0x0050cd84), every second frame. A second name, ocean_tex, is hashed but the hash is overwritten by the file size, so its file (texture ocean, 128 × 128) is never loaded. There is no binding to remove the water.

  • Evidence: confirmed (code) at 0x0040ca18, 0x00191230, 0x001915a0, 0x00191dd8; detail: traced
  • Wrapper 0x0037ba48 (registered by RegisterBindings); calls 0x0040ca18 Water_Set, 0x00191230 WaterEffect_Init, 0x001915a0 WaterEffect_SetFrame, 0x00191dd8 WaterEffect_Update
  • Used by 4 of 467 script chunks (4 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 4 of 28 levels, first level84 (mission 18)
  • Coney: implemented

SpawnBreakableGlass

SpawnBreakableGlass(glassType, corner, cornerU, cornerV, uv0, uv1, flag, triangle1, triangle2) -> number
# Argument Read as Meaning
1 glassType number, truncated to an integer Glass type 0-18; the pane task is named by the number as text (format %d).
2 corner table of 3 numbers (t[1]..t[3]) First corner {x, y, z} of the pane in world metres.
3 cornerU table of 3 numbers (t[1]..t[3]) Corner along the pane's width {x, y, z}.
4 cornerV table of 3 numbers (t[1]..t[3]) Corner along the pane's height {x, y, z}.
5 uv0 table of 2 numbers (t[1]..t[2]) Texture coordinates {u, v} at the first corner.
6 uv1 table of 2 numbers (t[1]..t[2]) Texture coordinates {u, v} at the opposite corner.
7 flag number, truncated to an integer Pushed with the pane but discarded by its initialiser (0x003e29e8); the scripts pass 0.
8 triangle1 number, truncated to an integer First collision triangle the pane covers (pane +0xd8): made two-sided, disabled when it breaks.
9 triangle2 number, truncated to an integer Second collision triangle (+0xdc).

Returns number: Handle of the glass object.

Creates a breakable glass pane from three corners and texture coordinates and returns its handle; levels place hundreds of these for windows and shop fronts.

Notes. The two numbers are collision triangle indices (0x003a4768, 0x003a46c8); the types and what breaking a pane does: World objects.

  • Evidence: confirmed (code) at 0x0039c0e0; detail: traced
  • Wrapper 0x00378db0 (registered by RegisterBindings); calls 0x0039c0e0 Glass_Spawn
  • Used by 32 of 467 script chunks (929 references); boot to menu: no; mission 1: yes; result used: yes
  • Later in the story: 24 of 28 levels, first level80 (mission 2)
  • Coney: implemented

SpawnDoor

SpawnDoor(typeName, pos, rot, triangles, number) -> number
# Argument Read as Meaning
1 typeName string Door type name, such as dyn_door_cabin_a or dyn_door_store.
2 pos table of 3 numbers (t[1]..t[3]) World position {x, y, z} of the door. Written back unchanged.
3 rot table of 4 numbers (t[1]..t[4]) Orientation quaternion {x, y, z, w}. Written back unchanged.
4 triangles table of 2 numbers (t[1]..t[2]) The two collision triangles the door owns {a, b} (door +0xd8, +0xdc). Written back unchanged.
5 number number, truncated to an unsigned integer The door's number in its level (1-27, unique per level; door +0xe0): the level's navigation links carrying it belong to the door (Doors).

Returns number: Handle of the door object; GetLeftDoorHandle / GetRightDoorHandle give its leaves.

Creates a door object of a configured type at a position and returns its handle.

Notes. The spawn passes position, rotation and the three integers as message arguments to 0x003a2e60; the door's initialiser (0x003fb5f8 for dyn_door_swinging) reads them back (World objects).

  • Evidence: confirmed (code) at 0x00397230; detail: traced
  • Wrapper 0x003796b8 (registered by RegisterBindings); calls 0x00397230 Door_Spawn
  • Used by 46 of 467 script chunks (484 references); boot to menu: no; mission 1: yes; result used: yes
  • Later in the story: 27 of 28 levels, first level80 (mission 2)
  • Coney: implemented

TriggerSphereCfg

TriggerSphereCfg(object, enable, radius, mode, interval)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the object that gets the sphere (a flag, human or prop).
2 enable boolean (nil or 0 is false) True to arm the sphere at once, false to configure it disarmed.
3 radius number (single precision) Radius in metres around the object.
4 mode number, truncated to an integer How a human inside the radius is accepted (+0x17c): 0 on distance alone, 1 also needs a clear test from the sphere's centre to the human, 2 the same test from raised points (the test is inferred to be line of sight); the scripts pass 0, 1 (true) or 2.
5 interval number, truncated to an unsigned integer Stored as the repeat period (ms) of the object's message-handler component (+0x74), the period of message 5 (still inside); the scripts pass 1, 100, 250, 500 or 1000.

Returns nothing.

Creates or reconfigures the trigger sphere of an object (a pool of 100): its radius, whether it is armed, the acceptance mode and the repeat period. Each sphere is checked every fifth frame; a human coming inside sends the object message 3, staying inside message 5, leaving or dying message 4, so SetMsgHandler(object, 3, ...) hears it. Scripts use it for objectives, talk-to points and pickups.

Notes. Stores and the update are confirmed (code) at 0x00414bc0 and 0x004146e0 (scripting.md#triggers). The sphere's own message-5 period is its +0x164 (1000 by default); that interval reaches it is not traced.

  • Evidence: confirmed (code) at 0x00414bc0; detail: traced
  • Wrapper 0x0036d0e0 (registered by RegisterBindings); calls 0x00414bc0 TriggerSphere_Configure
  • Used by 70 of 467 script chunks (172 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

TriggerSphereEnable

TriggerSphereEnable(object, enable)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the object (a flag, human or prop) that carries the trigger sphere.
2 enable boolean (nil or 0 is false) True arms the sphere (creating one with the defaults of 0x00414480 if the object's handler component has none); false disarms it and forgets who is inside, keeping the sphere attached.

Returns nothing.

Switches an object's trigger sphere on or off. A trigger sphere is a radius around an object that reports to the scripts when something enters it; TriggerSphereCfg sets it up.

Notes. On: armed word +0x180 = 1. With no sphere yet, one is taken from the pool of 100 (0x004142d0) and set up by 0x00414480: object +0x170, radius +0x174 = 0, next message-5 time +0x178 = 0, mode +0x17c = 1 (the line-of-sight test), message-5 period +0x164 = 1000 ms, inside list empty. A radius of 0 accepts no human (the test is distance squared <= radius squared), so such a sphere fires only after TriggerSphereSetRadius or TriggerSphereCfg. Off (0x004144d0): fills the 60-handle inside list (+0x00-+0xef) with 0xff bytes (no handle) and clears +0x180; no message 4 is sent, and the sphere, its radius and mode, its pool slot, the object's handler component and its SetMsgHandler handlers all stay, so a later true re-arms the same sphere and a human still inside gets a fresh message 3. The sphere's pool slot is freed only when the handler component is cleared (0x00384a50). Does nothing for an object without a handler component. All confirmed (code).

  • Evidence: confirmed (code) at 0x00414ae0; detail: traced
  • Wrapper 0x0036d008 (registered by RegisterBindings); calls 0x00414ae0 TriggerSphere_Enable
  • Used by 30 of 467 script chunks (58 references); boot to menu: yes; mission 1: no; result used: no
  • Later in the story: 18 of 28 levels, first level87 (mission 3)
  • Coney: implemented

TriggerSphereSetRadius

TriggerSphereSetRadius(object, radius)
# Argument Read as Meaning
1 object number, truncated to an unsigned integer Handle of the object carrying the trigger sphere; it must already have a message-handler component (a SetMsgHandler or TriggerSphereCfg), else nothing happens.
2 radius number (single precision) New radius in metres (sphere +0x174).

Returns nothing.

Changes the radius of an object's trigger sphere, the range within which humans make the object get messages 3, 4 and 5 (Scripts: triggers). When the object's handler component has no sphere yet, one is taken from the pool of 100 and attached first, with the defaults of 0x00414480.

Notes. With the pool full the allocation returns null and the store would write through it (no check in 0x00414a28).

  • Evidence: confirmed (code) at 0x00414a28, 0x004142d0; detail: traced
  • Wrapper 0x0036d068 (registered by RegisterBindings); calls 0x00414a28 TriggerSphere_SetRadius, 0x004142d0 TriggerSphere_Alloc
  • Used by 2 of 467 script chunks (3 references); boot to menu: no; mission 1: no; result used: no
  • Later in the story: 2 of 28 levels, first level2 (mission 5)
  • Coney: implemented

UnloadTimedObjects

UnloadTimedObjects()

No arguments.

Returns nothing.

Removes the live objects that the object manager's spawn table (object manager +0x840) placed with a timer: for each spawned object whose timer word (+0x120) is non-zero and that still has a spawn record (matched by its 16-bit id), the record is marked done (bit 0x40000 of record +0x24, so it is not spawned again) and the object is told to unload itself (its vtable +0x4c). Used once, by the final level.

Notes. What sets an object's +0x120 (the 'timed' mark) is not traced; inferred: objects placed to appear or vanish at a scripted time. Records are 0x28 bytes at table +0x14, count +0x18.

  • Evidence: confirmed (code) at 0x003978a8, 0x00399b20, 0x00399cd0; detail: traced
  • Wrapper 0x0036dda0 (registered by RegisterBindings); calls 0x003978a8 ObjMgr_UnloadTimed, 0x00399b20 SpawnTable_UnloadTimed, 0x00399cd0 SpawnTable_FindRecord
  • 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 level84 (mission 18)
  • Coney: not implemented