TakeNumItems(object, string, int)

Takes the number of items specified from the target.

void TakeNumItems(
    object oTarget,
    string sItem,
    int nNumItems



The object to remove the multiple items from.


The Tag of the Items to remove.


The maximum number of items found in the objects inventory, to remove.


Loops through the inventory of oTarget looking for objects with the Tag sItem and places them into the calling objects inventory. The loop will continue until nNumItems have been found and removed or all the items in the objects inventory have already been gone through.


Function can be found in nw_i0_plot.nss on line 847.

The function simply uses a loop based on GetFirstItemInInventory and GetNextItemInInventory combined with ActionTakeItem. Thus, it won't take items equipped by oTarget.

Known Bugs

If the object calling this function has no inventory then the game will crash.

This function doesn't handle stacks of items correctly, it will simply delete the required number of stacks of items regardless of how many items each stack holds.


#include "nw_i0_plot"



See Also

functions: ActionTakeItem | GiveNumItems | SetItemStackSize | TakeGold | TakeGoldFromCreature
categories: Inventory Functions

 author: John Shuell, editors: Grimlar, Kolyana