benilla-re systems structs docs

Script::UnitStat

function · ui · primitive

Address
0x518600 · 516 bytes, up to 0x518803
Signature
int __fastcall (lua_State *L)
Meaning
Returns a unit's stat, its clamped value and the player's buffs, raising on an index outside 1 to 5
Confidence
verified, proof one
Name from
the community database (idb)
Finding
ui/unitstats#primary-stats

Finding: Primary stats in ui: unit stat functions

UnitStat(unit, i) returns four numbers: the stat (UNIT_FIELD_STAT0 plus i-1, fields 150 to 154, as a signed 32-bit integer), the same value with a negative one raised to 0, and the positive and negative buffs of the player block (PLAYER_FIELD_POSSTAT0 and NEGSTAT0, fields 1177 and 1182, signed 32-bit). The buffs are read only for the local player; any other unit gets 0 for both. An absent or non-unit object gives four zeros. The first value is the raw field, not the second minus the buffs.

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 9

Calls and jumps by a bare address, from tables/calls.tsv.