Skip to content

Destroy one item from a stack?

How can I have a script remove just one item from a stack? DestroyObject(oItem) treats the object as a full stack.

Comments

  • DazDaz Member Posts: 127
    Something like this:
    object oItem;
    int nStackSize = GetItemStackSize(oItem);
    
    if (nStackSize == 1)
        DestroyObject(oItem);
    else
        SetItemStackSize(oItem, nStackSize - 1);
    
  • BuddywarriorBuddywarrior Member Posts: 62
    Daz wrote: »
    Something like this:
    object oItem;
    int nStackSize = GetItemStackSize(oItem);
    
    if (nStackSize == 1)
        DestroyObject(oItem);
    else
        SetItemStackSize(oItem, nStackSize - 1);
    

    Works like a charm, thank you Daz!
Sign In or Register to comment.