Files
HeroesStone_PRC8/_module/nss/q6d_area_ox.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

135 lines
3.8 KiB
Plaintext

// Wizard tower any level on-enter
// - Activate wild-magic zone
#include "x2_inc_switches"
#include "nw_i0_generic"
/*******************************************************************************
* lc_area_exit
*
* by LasCivious Sept 2004
* modified by Vuldrick to allow more control of what gets cleaned
*
* Called by area's OnExit event. Clears area encounters, dropped items,
* stores & cleans placeable inventories if no PC is present for a length of time.
*******************************************************************************/
// Set this to FALSE if you do not want encounters to be clearned
int nClearEncounters = GetLocalInt(OBJECT_SELF,"ClearEncounters");
// Set this to FALSE if you do not want dropped items to be clearned
int nClearItems = GetLocalInt(OBJECT_SELF,"ClearItems");
// Set this to FALSE if you do not want stores cleared
int nClearStores = GetLocalInt(OBJECT_SELF,"ClearStores");
// Set this to FALSE if you do not want placeable inventories cleared
int nClearPlaceInv = GetLocalInt(OBJECT_SELF,"ClearPlaceInv");
// Set the amount of time to wait for cleaning here in seconds
float fDelayTime = GetLocalFloat(OBJECT_SELF,"ClearDelay");
void CleanArea(object oArea)
{
object oTrash = GetFirstObjectInArea(oArea);
object oInvItem;
//Check for PCs
object oPC = GetFirstPC();
while (GetIsObjectValid(oPC))
{
if (GetArea(oPC) == oArea)
{
DeleteLocalInt(oArea, "CleanArea");
return;
}
oPC = GetNextPC();
}
while(GetIsObjectValid(oTrash))
{
string sTagPrefix = GetStringLeft(GetTag(oTrash), 15);
// Clear encounters
if(GetIsEncounterCreature(oTrash) || sTagPrefix == "PWFSE_SPAWNERID" && nClearEncounters == 1)
{
AssignCommand(oTrash, SetIsDestroyable(TRUE));
DestroyObject(oTrash, 0.0);
}
// Clear remains, dropped items
if(GetObjectType(oTrash)==OBJECT_TYPE_ITEM || GetStringLowerCase(GetName(oTrash)) == "remains" && nClearItems == 1)
{
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 Stores
if(GetObjectType(oTrash)==OBJECT_TYPE_STORE && nClearStores == 1)
{
AssignCommand(oTrash, SetIsDestroyable(TRUE));
DestroyObject(oTrash, 0.0);
}
// Clear placeable inventories
if(GetObjectType(oTrash)==OBJECT_TYPE_PLACEABLE && nClearPlaceInv == 1)
{
if (GetHasInventory(oTrash))
{
object oInvItem = GetFirstItemInInventory(oTrash);
while(GetIsObjectValid(oInvItem))
{
DestroyObject(oInvItem,0.0);
oInvItem = GetNextItemInInventory(oTrash);
}
}
}
oTrash = GetNextObjectInArea(oArea);
}
DeleteLocalInt(oArea, "CleanArea");
}
void main()
{
object oPC = GetExitingObject();
if(!GetIsPC(oPC))
return;
SetModuleOverrideSpellscript("q6_wild_magic");
SetLocalInt(OBJECT_SELF, "X2_L_WILD_MAGIC", 0);
{
object oPC = GetExitingObject();
if(!GetIsPC(oPC))
return;
DeleteLocalString(GetModule(),MODULE_VAR_OVERRIDE_SPELLSCRIPT);
object oArea = OBJECT_SELF;
if (!GetIsPC(oPC)) return;
if (GetLocalInt(oArea, "CleanArea") != 1)
{
DelayCommand(fDelayTime, CleanArea(oArea));
SetLocalInt(oArea, "CleanArea", 1);
}
}}