RoT2_PRC8/_module/nss/1_clean_store.nss
Jaysyn904 499aba4eb3 Initial upload
Initial upload
2023-09-25 18:13:22 -04:00

54 lines
1.4 KiB
Plaintext

void main()
{ // start main
object oPC = GetExitingObject();
object oArea = GetArea(OBJECT_SELF);
int nPCFlag = FALSE;
if(GetIsPC(oPC))
{ // start main if
object oObject = GetFirstObjectInArea(oArea);
while(GetIsObjectValid(oObject))
{ //start while loop
if(GetIsPC(oObject))
{ //start if
nPCFlag = TRUE;
break; // leave while loop if a PC is in the area
} // end if
else
{ //start else
oObject = GetNextObjectInArea(oArea);
} // end else
} // end while
if(nPCFlag == FALSE)
{
object oStore = GetFirstObjectInArea(oArea);
while(GetIsObjectValid(oStore))
{
int nObjectType = GetObjectType(oStore);
if(nObjectType == OBJECT_TYPE_STORE)
{
object oItem = GetFirstItemInInventory(oStore);
while(GetIsObjectValid(oItem))
{
int nItemFlag = GetLocalInt(oItem, "PCItem");
if(nItemFlag != 0)
{
if(nItemFlag < 1)
{
nItemFlag++;
SetLocalInt(oItem, "PCItem", nItemFlag);
}
else
{
DestroyObject(oItem);
}
}
oItem = GetNextItemInInventory(oStore);
} // end second while
} // end if
oStore = GetNextObjectInArea(oArea);
} // end first while
} // end if
} // end main if
} // end main