benilla-re systems structs docs

Script::GetInventoryItemCount

function · ui · primitive

Address
0x4c8680 · 592 bytes, up to 0x4c88cf
Signature
int __fastcall (lua_State *L)
Meaning
Returns a stack count, an ammunition total or a bag's contents count for a unit's inventory slot
Confidence
verified, proof one
Name from
the community database (idb)
Finding
ui/inventory#item-counts

Finding: Item counts in ui: inventory queries and alerts

GetInventoryItemCount(unit, slot) is 0x4c8680 and always returns one number. A first argument that is neither string nor number raises Usage: GetInventoryItemCount(unit, slot); a slot the reader refuses raises Invalid inventory slot in GetInventoryItemCount. The unit must resolve to a player the active player may read (itself, or a player it can cooperate with, 0x606ba0, within 10 yards, 0x4944a0); else the result is 1. So is an empty slot. An item that is not a container returns its stack count. Slot 0 (ammo) is read for the active player only, with PLAYER_AMMO_ID set: the total stack count of that ammo over the equipment, equipped bags, backpack, their contents and the keyring, not the bank; otherwise 1.

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 12

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