GetItemStackSize
From NWN Lexicon
Contents |
[edit] GetItemStackSize(object)
Determines the number of stacked items contained within an inventory object.
int GetItemStackSize( 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 GetNumStackedItems .
[edit] Version
1.30
[edit] Example
//Returns TRUE if oItem is stackable int GetIsStackableItem(object oItem) { //Must have a chest tagged checkchest object oCopy=CopyItem(oItem, GetObjectByTag("checkchest")); //Set the stacksize to two SetItemStackSize(oCopy, 2); //Check if it really is two - otherwise, not stackable! int bStack=GetItemStackSize(oCopy)==2; //Destroy the test copy DestroyObject(oCopy); //Return bStack which is TRUE if item is stackable return bStack; }
[edit] See Also
functions: |
author: Charles Feduke, editors: Lilac Soul, Mistress, contributor: Fireboar