Aschbourne_PRC8/_module/nss/per_safe_item_st.nss
GetOffMyYarn 69879d6957 Areas and Fixes
Added CCOH and missing areas
Changed some areas to be craftable,
Fixed some on death issues,
Fixed the Gaurd
2024-08-30 11:38:44 -04:00

51 lines
1.2 KiB
Plaintext

//ScarFace's Persistent Baking system -OnClose-
void main()
{
ActionLockObject(OBJECT_SELF);
object oPC = GetLastUsedBy();
string sKey = GetPCPublicCDKey(oPC);
object oItem = GetFirstItemInInventory(OBJECT_SELF);
int iCount = 1;
while (GetIsObjectValid(oItem))
{
oItem = GetNextItemInInventory(OBJECT_SELF);
iCount++;
}
if (iCount >=101)
{
FloatingTextStringOnCreature("**WARNING** You can't store more than 100 items. You have "+IntToString(iCount)+" items in the chest. No items were saved. Please remove some items", oPC);
ActionUnlockObject(OBJECT_SELF);
return;
}
iCount = 1;
oItem = GetFirstItemInInventory(OBJECT_SELF);
if (!GetIsObjectValid(oItem))
{
iCount = 0;
}
string sCount;
while (GetIsObjectValid(oItem))
{
sCount = IntToString(iCount);
StoreCampaignObject("STORAGE", sKey+sCount, oItem, oPC);
DestroyObject(oItem);
oItem = GetNextItemInInventory(OBJECT_SELF);
iCount++;
}
if (iCount == 0)
{
FloatingTextStringOnCreature("Chest empty, No items saved", oPC);
ActionUnlockObject(OBJECT_SELF);
return;
}
FloatingTextStringOnCreature("Items successfully saved", oPC);
ActionUnlockObject(OBJECT_SELF);
}