Initial Commit
Initial Commit
This commit is contained in:
79
_module/nss/pseudo_innonexit.nss
Normal file
79
_module/nss/pseudo_innonexit.nss
Normal file
@@ -0,0 +1,79 @@
|
||||
#include "_sh_inc_list"
|
||||
#include "69_hench_lib"
|
||||
void Body()
|
||||
{
|
||||
//A workaround to prevent the OnEnter event body from firing after loading a saved game
|
||||
if (GetLocalInt(GetModule(), "LoadCooldown") == TRUE) return;
|
||||
|
||||
string sAreaString = GetLocalString(OBJECT_SELF, "AreaString");
|
||||
//Get the outside area, too
|
||||
object oVilArea = GetArea(GetWaypointByTag("exit_wp_"+sAreaString+"_s"));
|
||||
int nPopulated = FALSE;
|
||||
object oObject;
|
||||
|
||||
if (GetLocalInt(oVilArea, "Players") > 0) nPopulated = TRUE;
|
||||
|
||||
if (nPopulated == FALSE)
|
||||
{
|
||||
DeleteLocalInt(oVilArea, "IsPopulated");
|
||||
DeleteLocalInt(oVilArea, "NO_ESCAPE");
|
||||
DeleteLocalInt(oVilArea, "ThugNoticed");
|
||||
DeleteLocalInt(oVilArea, "TributePaid");
|
||||
DeleteLocalInt(oVilArea, "Level");
|
||||
DeleteLocalInt(oVilArea, "AmbushPrepared");
|
||||
DeleteLocalInt(oVilArea, "Duel");
|
||||
DeleteLocalInt(oVilArea, "MerchantTrouble");
|
||||
DeleteLocalInt(oVilArea, "DiscoveredVillage");
|
||||
DeleteLocalInt(oVilArea, "DiscoveredDungeon");
|
||||
if (GetLocalInt(oVilArea, "Battle") != 0) MusicBattleChange(OBJECT_SELF, GetLocalInt(OBJECT_SELF, "Battle"));
|
||||
|
||||
//Delete all items and creatures in the areas and refresh the stores
|
||||
location lStore;
|
||||
int nStoreRefreshed;
|
||||
location lInnStore;
|
||||
int nInnRefreshed;
|
||||
oObject = GetFirstObjectInArea(OBJECT_SELF);
|
||||
while (GetIsObjectValid(oObject))
|
||||
{
|
||||
if (GetTag(oObject) == "anc_event_merchant" && nStoreRefreshed != TRUE)
|
||||
{
|
||||
lStore = GetLocation(oObject);
|
||||
DestroyObject(oObject);
|
||||
CreateObject(OBJECT_TYPE_STORE, "anc_event_mercha", lStore);
|
||||
nStoreRefreshed = TRUE;
|
||||
}
|
||||
if (GetTag(oObject) == "anc_tavern" && nInnRefreshed != TRUE)
|
||||
{
|
||||
lInnStore = GetLocation(oObject);
|
||||
DestroyObject(oObject);
|
||||
CreateObject(OBJECT_TYPE_STORE, "anc_tavern", lInnStore);
|
||||
nInnRefreshed = TRUE;
|
||||
}
|
||||
if (GetObjectType(oObject) == OBJECT_TYPE_TRIGGER)
|
||||
{
|
||||
DestroyObject(oObject);
|
||||
}
|
||||
if (GetObjectType(oObject) == OBJECT_TYPE_CREATURE || GetObjectType(oObject) == OBJECT_TYPE_ITEM)
|
||||
{
|
||||
if ( !GetIsPC(oObject) && !GetIsPC(GetMaster(oObject)) && !GetIsPC(GetMaster(GetMaster(oObject))) && !GetIsPC(GetLastMaster(oObject)) ) //do NOT delete PCs and their associates
|
||||
DestroyObject(oObject);
|
||||
}
|
||||
oObject = GetNextObjectInArea(OBJECT_SELF);
|
||||
}
|
||||
oObject = GetFirstObjectInArea(oVilArea);
|
||||
while (GetIsObjectValid(oObject))
|
||||
{
|
||||
if (GetObjectType(oObject) == OBJECT_TYPE_CREATURE || GetObjectType(oObject) == OBJECT_TYPE_ITEM)
|
||||
{
|
||||
if ( !GetIsPC(oObject) && !GetIsPC(GetMaster(oObject)) && !GetIsPC(GetMaster(GetMaster(oObject))) && !GetIsPC(GetLastMaster(oObject)) ) //do NOT delete PCs and their associates
|
||||
DestroyObject(oObject);
|
||||
}
|
||||
oObject = GetNextObjectInArea(oVilArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
DelayCommand(1.0, Body());
|
||||
}
|
||||
Reference in New Issue
Block a user