Amon_PRC8/_module/nss/pcnt_open.nss
Jaysyn904 c5cffc37af Initial Commit
Initial Commit [v1.01]
2025-04-03 19:00:46 -04:00

52 lines
1.5 KiB
Plaintext

//*****************************************************************************
/*
Filename: pcnt_close
To Use:
attach this script to the OnClose event of a container
you can customize several parameters:
choose object TAG for ID generation (ReflexSafe != 2)
!! use this to share inventories
!! use this for moving inventories (like creatures)
use player for ID generation (ReflexSafe = 2)
!! use this for player vaults. each player gets his own inventory
!! from a single container
Created By: Unknown??
Modified By: Gregg Anderson
10/9/2006
*/
//*****************************************************************************
#include "horse_include"
void main()
{
if (GetLocalInt(OBJECT_SELF, "iFirstOpen") == 0)
{
string sTag = GetTag(OBJECT_SELF);
int nType = GetReflexSavingThrow(OBJECT_SELF);
if(nType == 2)
sTag = GetPCPlayerName(GetLastOpenedBy());
object oItem = OBJECT_SELF;
string sVarName;
int i = 0;
int iMax = GetCampaignInt(CAMPAIGN_DATABASE, sTag + "_n");
while ((oItem != OBJECT_INVALID) && (i < iMax))
{
sVarName = sTag + "_" + IntToString(i);
oItem = RetrieveCampaignObject(CAMPAIGN_DATABASE, sVarName, GetLocation(OBJECT_SELF), OBJECT_SELF);
SetLocalObject(OBJECT_SELF, sVarName, oItem);
i++;
}
SetLocalInt(OBJECT_SELF, "iFirstOpen", 1);
}
}