Aschbourne_PRC8/_module/nss/_open_chest2.nss

38 lines
1.1 KiB
Plaintext
Raw Normal View History

2024-06-14 10:48:20 -04:00
void MakeCopy(object oItem, object oSelf);
void main()
{
object oSelf = OBJECT_SELF;
object oItem = GetFirstItemInInventory(oSelf);
string sItemTag;
string sItemName;
if (oItem!=OBJECT_INVALID)
{
while (oItem!=OBJECT_INVALID)
{
sItemTag = GetTag(oItem);
sItemName = GetName(oItem);
if (GetStringRight(sItemTag,6)=="_Store")
{
AssignCommand(oItem,DelayCommand(8.0,MakeCopy(oItem,oSelf)));
//SendMessageToPC(GetFirstPC(),"Making New Scroll");
}
if (GetStringLowerCase(GetStringLeft(sItemName,7))=="pattern") DestroyObject(oItem,10.0);
if (GetStringLowerCase(GetStringLeft(sItemName,6))=="recipe") DestroyObject(oItem,10.0);
oItem=GetNextItemInInventory(oSelf);
if (oItem==OBJECT_INVALID) return;
}
}
}
void MakeCopy (object oItem, object oSelf)
{
string sItemTag = GetTag(oItem);
int iTagLength = GetStringLength(sItemTag)-6;
string sNewTag = GetStringLeft(sItemTag,iTagLength)+"a";
CopyObject(oItem,GetLocation(oSelf),oSelf,sNewTag);
DestroyObject(oItem,2.0);
return;
}