GetNumStackedItems
From NWN Lexicon
Contents |
[edit] GetNumStackedItems(object)
Determines the number of stacked items contained within an inventory object.
int GetNumStackedItems( object oItem );
[edit] Parameters
oItem
The item to determine the stack count of.
[edit] Description
Returns the number of items in a stack attached to oItem. Only items that are the same may be stacked; i.e. two gems of the same name can be stacked, but a sword and an arrow cannot.
[edit] Remarks
Returns 0 if an invalid object is provided for oItem, or if oItem isn't an item (like a creature or a placeable).
This function can also be used in conjunction with SetItemStackSize to determine if an item is stackable or not.
This function is identical to GetItemStackSize .
[edit] Version
1.22
[edit] Example
// Demonstrates how to check an NPC's arrow supply and yield speech when it is depleted. void main() { // Retrieves NPC's arrow object. object oArrows = GetObjectByTag("MY_ARROWS"); if(GetNumStackedItems(oArrows) == 0) { ActionSpeakString("My arrow supply is depleted!"); } }
[edit] See Also
functions: |
author: Sarev0k, editors: Tom Cassiotis, Fireboar, Kookoo, Mistress