BF2.US bf2-rsdeveloper wiki Parity Discord bf2.us
generated from the code
On this page

Triggers (trig_)

4 functions of the host module. Generated from the bf2-rs sources; see the reference index for the cross-game table.

trig_create#

BF22142Heroes
python
host.trig_create(sourceObj, callback, templateName, radius, hemispherical, data[, alwaysTrigger])
FactDetail
Arguments (as parsed)args[1] raw, args[5] raw, f@3 i@4 s@2 T@0 [i@6 if len>=7]
Returnsint
ErrorsTypeError (wrong arg type),missing arg,"trigger source object no longer exists","expected a callable","unknown object template '%s'"
Original codebf2_w32ded.exe!0x00532160, BF2.exe!0x0058e980, BFHeroes.exe (1.89)!0x0066be99
bf2-rscrates/bf2-python/src/host_state.rs:553

What it does (from the original code). templateName "<<PCO>>" = any player control object, else must be a known template (DAT_0089ae4c vt+0x34). data None stored as NULL. id = ++s_lastTriggerId (starts 4000, never reset). Appends trigger to state list (+0x4c) and resets the round-robin cursor (+0x58).

Shipped scripts use it like this:

BF2: python/bf2/TriggerManager.py:6
return host.trig_create(object, callback, objName, radius, 0, data)
2142: python/bf2/TriggerManager.py:6
return host.trig_create(object, callback, objName, radius, 0, data)
Heroes: python/bf2/TriggerManager.py:6
return host.trig_create(object, callback, objName, radius, 0, data)

trig_getObjects#

BF22142Heroes
python
host.trig_getObjects(id)
FactDetail
Arguments (as parsed)i@0
Returnstuple(host.Object)
ErrorsTypeError (wrong arg type),missing arg,"no such trigger"
Original codebf2_w32ded.exe!0x00532080, BF2.exe!0x0058e670, BFHeroes.exe (1.89)!0x0066bdd7
bf2-rscrates/bf2-python/src/host_state.rs:555

What it does (from the original code). Objects currently inside the trigger (its std::set).

Shipped scripts use it like this:

BF2: python/bf2/TriggerManager.py:18
return host.trig_getObjects(trig_id)
2142: python/bf2/TriggerManager.py:18
return host.trig_getObjects(trig_id)
Heroes: python/bf2/TriggerManager.py:18
return host.trig_getObjects(trig_id)

trig_destroy#

BF22142Heroes
python
host.trig_destroy(id)
FactDetail
Arguments (as parsed)i@0
ReturnsNone
ErrorsTypeError (wrong arg type),missing arg,"no such trigger"
Original codebf2_w32ded.exe!0x00532460, BF2.exe!0x0058edb0, BFHeroes.exe (1.89)!0x0066c0e4
bf2-rscrates/bf2-python/src/host_state.rs:557

What it does (from the original code). Erases trigger, resets cursor.

Shipped scripts use it like this:

BF2: python/bf2/TriggerManager.py:15
host.trig_destroy(trig_id)
2142: python/bf2/TriggerManager.py:15
host.trig_destroy(trig_id)
Heroes: python/bf2/TriggerManager.py:15
host.trig_destroy(trig_id)

trig_destroyAll#

BF22142Heroes
python
host.trig_destroyAll()
FactDetail
Arguments (as parsed)-
ReturnsNone
Original codebf2_w32ded.exe!0x00532520, BF2.exe!0x0058ee90, BFHeroes.exe (1.89)!0x0066c185
bf2-rscrates/bf2-python/src/host_state.rs:559

What it does (from the original code). Clears trigger list, resets cursor.

Shipped scripts use it like this:

BF2: python/bf2/TriggerManager.py:12
host.trig_destroyAll()
2142: python/bf2/TriggerManager.py:12
host.trig_destroyAll()
Heroes: python/bf2/TriggerManager.py:12
host.trig_destroyAll()
Source: tools/devwiki/refs_python.py · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.