#include "nw_i0_plot" void main() { object oPC = GetPCSpeaker(); object oDeed = GetLocalObject(oPC,"oDeed"); DeleteLocalObject(oPC,"oDeed"); string sItemTag = GetLocalString(oDeed,"sItemTag"); string sItemResRef = GetLocalString(oDeed,"sItemResRef"); string sItemName = GetLocalString(oDeed,"sItemName"); int iTotal = GetLocalInt(oDeed,"iNumberStored"); int iTemp = GetNumItems(oPC,sItemTag); SendMessageToPC(oPC,"Attempting to add "+IntToString(iTemp)+" "+sItemName+" to this bundle."); object oGone = GetFirstItemInInventory(oPC); float fDelay = 2.0; int iCounter; if (oGone!=OBJECT_INVALID) { while (oGone!=OBJECT_INVALID) { if (GetTag(oGone)==sItemTag) { if (GetLocalInt(oGone,"iAmCounted")==0) { SetLocalInt(oGone,"iAmCounted",99); iCounter=iCounter+GetNumStackedItems(oGone); DestroyObject(oGone,fDelay); fDelay=fDelay+0.2; } } oGone = GetNextItemInInventory(oPC); if (oGone==OBJECT_INVALID) break; } } iTotal = iTotal+iCounter; SetLocalInt(oDeed,"iNumberStored",iTotal); DelayCommand(fDelay+0.5,SendMessageToPC(oPC,"Successfully added "+IntToString(iCounter)+" "+sItemName+" to the bundle.")); DelayCommand(fDelay+0.6,SendMessageToPC(oPC,"There are now a total of "+IntToString(iTotal)+" "+sItemName+" in this bundle.")); }