84 lines
3.3 KiB
Plaintext
84 lines
3.3 KiB
Plaintext
#include "_sh_inc_list"
|
|
#include "69_hench_lib"
|
|
void main()
|
|
{
|
|
object oExiting = GetLocalObject(GetModule(), "TravellingPC");
|
|
string sAreaString = GetLocalString(OBJECT_SELF, "AreaString");
|
|
DeleteLocalInt(oExiting, "TalkedAdv");
|
|
DeleteLocalInt(oExiting, "Duel");
|
|
ExploreAreaForPlayer(OBJECT_SELF, oExiting, FALSE);
|
|
int nPopulated = FALSE;
|
|
object oObject = GetFirstObjectInArea(OBJECT_SELF);
|
|
while (GetIsObjectValid(oObject))
|
|
{
|
|
if (GetIsPC(oObject))
|
|
{
|
|
nPopulated = TRUE;
|
|
break;
|
|
}
|
|
oObject = GetNextObjectInArea(OBJECT_SELF);
|
|
}
|
|
|
|
if (nPopulated == FALSE)
|
|
{
|
|
DeleteLocalInt(OBJECT_SELF, "IsPopulated");
|
|
DeleteLocalInt(OBJECT_SELF, "NO_ESCAPE");
|
|
DeleteLocalInt(OBJECT_SELF, "ThugNoticed");
|
|
DeleteLocalInt(OBJECT_SELF, "TributePaid");
|
|
DeleteLocalInt(OBJECT_SELF, "Level");
|
|
DeleteLocalInt(OBJECT_SELF, "AmbushPrepared");
|
|
DeleteLocalInt(OBJECT_SELF, "Duel");
|
|
DeleteLocalInt(OBJECT_SELF, "MerchantTrouble");
|
|
DeleteLocalInt(OBJECT_SELF, "DiscoveredVillage");
|
|
DeleteLocalInt(OBJECT_SELF, "DiscoveredDungeon");
|
|
if (GetLocalInt(OBJECT_SELF, "Battle") != 0) MusicBattleChange(OBJECT_SELF, GetLocalInt(OBJECT_SELF, "Battle"));
|
|
|
|
//Delete all chests, items, demon portals and creatures in the area; and refresh the store
|
|
location lStore;
|
|
int nStoreRefreshed;
|
|
oObject = GetFirstObjectInArea(OBJECT_SELF);
|
|
object oItem;
|
|
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_tchest")
|
|
{
|
|
oItem = GetFirstItemInInventory(oObject);
|
|
while (GetIsObjectValid(oItem))
|
|
{
|
|
DestroyObject(oItem);
|
|
oItem = GetNextItemInInventory(oObject);
|
|
}
|
|
DestroyObject(oObject);
|
|
}
|
|
if (GetTag(oObject) == "anc_demongate" || 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);
|
|
if ( !GetIsPC(oObject) && GetIsDead(oObject) && GetLocalInt(oObject, "Escorted") == TRUE) //...unless they are a dead escorted NPC
|
|
DestroyObject(oObject);
|
|
}
|
|
oObject = GetNextObjectInArea(OBJECT_SELF);
|
|
}
|
|
|
|
//Add this area to the list of free areas
|
|
string sRegionString = GetStringLeft(sAreaString, 1);
|
|
string sList = "sList"+sRegionString;
|
|
object oList = GetLocalObject(GetModule(), sList);
|
|
ListAddString(oList, sAreaString);
|
|
|
|
//TEST
|
|
int i;
|
|
for (i = 1; i <= ListGetElementCount(oList); i++)
|
|
{
|
|
FloatingTextStringOnCreature(ListGetString(oList, i), oExiting);
|
|
}
|
|
}
|
|
}
|