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#
host.trig_create(sourceObj, callback, templateName, radius, hemispherical, data[, alwaysTrigger])| Fact | Detail |
|---|---|
| Arguments (as parsed) | args[1] raw, args[5] raw, f@3 i@4 s@2 T@0 [i@6 if len>=7] |
| Returns | int |
| Errors | TypeError (wrong arg type),missing arg,"trigger source object no longer exists","expected a callable","unknown object template '%s'" |
| Original code | bf2_w32ded.exe!0x00532160, BF2.exe!0x0058e980, BFHeroes.exe (1.89)!0x0066be99 |
| bf2-rs | crates/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:
return host.trig_create(object, callback, objName, radius, 0, data)return host.trig_create(object, callback, objName, radius, 0, data)return host.trig_create(object, callback, objName, radius, 0, data)trig_getObjects#
host.trig_getObjects(id)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@0 |
| Returns | tuple(host.Object) |
| Errors | TypeError (wrong arg type),missing arg,"no such trigger" |
| Original code | bf2_w32ded.exe!0x00532080, BF2.exe!0x0058e670, BFHeroes.exe (1.89)!0x0066bdd7 |
| bf2-rs | crates/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:
return host.trig_getObjects(trig_id)return host.trig_getObjects(trig_id)return host.trig_getObjects(trig_id)trig_destroy#
host.trig_destroy(id)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@0 |
| Returns | None |
| Errors | TypeError (wrong arg type),missing arg,"no such trigger" |
| Original code | bf2_w32ded.exe!0x00532460, BF2.exe!0x0058edb0, BFHeroes.exe (1.89)!0x0066c0e4 |
| bf2-rs | crates/bf2-python/src/host_state.rs:557 |
What it does (from the original code). Erases trigger, resets cursor.
Shipped scripts use it like this:
host.trig_destroy(trig_id)host.trig_destroy(trig_id)host.trig_destroy(trig_id)trig_destroyAll#
host.trig_destroyAll()| Fact | Detail |
|---|---|
| Arguments (as parsed) | - |
| Returns | None |
| Original code | bf2_w32ded.exe!0x00532520, BF2.exe!0x0058ee90, BFHeroes.exe (1.89)!0x0066c185 |
| bf2-rs | crates/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:
host.trig_destroyAll()host.trig_destroyAll()host.trig_destroyAll()tools/devwiki/refs_python.py · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.