Changed folder name.
Changed folder name.
This commit is contained in:
170
_module/nss/cleanarea.nss
Normal file
170
_module/nss/cleanarea.nss
Normal file
@@ -0,0 +1,170 @@
|
||||
//Place on exit of an area
|
||||
|
||||
//Note: This is a very important script, it should go on the exit event of
|
||||
//all area you create. (with some exceptions) This reduces lagg too!
|
||||
|
||||
// Set this to FALSE if you do not want placeable inventories cleared
|
||||
int nClearPlaceInv = TRUE;
|
||||
// Set the amount of time to wait for cleaning here in seconds
|
||||
float fDelayTime = 1.0;
|
||||
|
||||
void CleanArea(object oArea)
|
||||
{
|
||||
object oTrash = GetFirstObjectInArea(oArea);
|
||||
object oInvItem;
|
||||
|
||||
//Check for PCs
|
||||
object oPC = GetFirstPC();
|
||||
while (GetIsObjectValid(oPC)) {
|
||||
if(!GetIsDM(oPC)||!GetIsDMPossessed(oPC))
|
||||
{
|
||||
if (GetArea(oPC) == oArea) {
|
||||
DeleteLocalInt(oArea, "CleanArea");
|
||||
return;
|
||||
}
|
||||
}
|
||||
oPC = GetNextPC();
|
||||
}
|
||||
|
||||
while(GetIsObjectValid(oTrash)) {
|
||||
string sTagPrefix = GetStringLeft(GetTag(oTrash), 15);
|
||||
// Clear remains, dropped items
|
||||
if(GetObjectType(oTrash)==OBJECT_TYPE_ITEM ||
|
||||
GetStringLowerCase(GetName(oTrash)) == "remains") {
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
if (GetHasInventory(oTrash)) {
|
||||
oInvItem = GetFirstItemInInventory(oTrash);
|
||||
while(GetIsObjectValid(oInvItem)) {
|
||||
DestroyObject(oInvItem,0.0);
|
||||
oInvItem = GetNextItemInInventory(oTrash);
|
||||
}
|
||||
}
|
||||
else DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
// Clear placeable inventories
|
||||
if(GetObjectType(oTrash)==OBJECT_TYPE_PLACEABLE &&
|
||||
nClearPlaceInv == FALSE) {
|
||||
if (GetHasInventory(oTrash))
|
||||
{
|
||||
object oInvItem = GetFirstItemInInventory(oTrash);
|
||||
while(GetIsObjectValid(oInvItem)) {
|
||||
DestroyObject(oInvItem,0.0);
|
||||
oInvItem = GetNextItemInInventory(oTrash);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Clear encounters
|
||||
else if (GetIsEncounterCreature(oTrash) ||
|
||||
sTagPrefix == "PWFSE_SPAWNERID")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "ZEP_PONY_005")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "Pack_Pony")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag1")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag2")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag3")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag4")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag5")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag6")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag7")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag8")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag9")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag10")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag11")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
else if (GetTag(oTrash) == "socketbag12")
|
||||
{
|
||||
AssignCommand(oTrash, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oTrash, 0.0);
|
||||
}
|
||||
|
||||
oTrash = GetNextObjectInArea(oArea);
|
||||
}
|
||||
DeleteLocalInt(oArea, "CleanArea");
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
object oArea = OBJECT_SELF;
|
||||
object oPC = GetExitingObject();
|
||||
if (!GetIsPC(oPC)) return;
|
||||
|
||||
if (GetLocalInt(oArea, "CleanArea") != 1)
|
||||
{
|
||||
DelayCommand(fDelayTime, CleanArea(oArea));
|
||||
SetLocalInt(oArea, "CleanArea", 1);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user