Aschbourne_PRC8/_module/nss/_uoa_com_add.nss

47 lines
1.5 KiB
Plaintext
Raw Normal View History

2024-06-14 10:48:20 -04:00
#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.");
SendMessageToPC(oPC,"This will take 30 seconds.");
2024-06-14 10:48:20 -04:00
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;
AssignCommand(GetModule(),DelayCommand(30.0,SetLocalInt(oDeed,"iNumberStored",iTotal)));
DelayCommand(fDelay+30.5,SendMessageToPC(oPC,"Successfully added "+IntToString(iCounter)+" "+sItemName+" to the bundle."));
DelayCommand(fDelay+30.6,SendMessageToPC(oPC,"There are now a total of "+IntToString(iTotal)+" "+sItemName+" in this bundle."));
2024-06-14 10:48:20 -04:00
}