TakeNumItems(object, string, int)

Takes the number of items specified from the target.

void TakeNumItems(
    object oTarget,
    string sItem,
    int nNumItems
);

Parameters

oTarget

The object to remove the multiple items from.

sItem

The Tag of the Items to remove.

nNumItems

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


Description

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.



Remarks

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.


Requirements

#include "nw_i0_plot"

Version

1.61

See Also

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


 author: John Shuell, editors: Grimlar, Kolyana