95 lines
2.6 KiB
Plaintext
95 lines
2.6 KiB
Plaintext
/* areacleanup script
|
|
checks the area that it was called for for the presence of pc's,
|
|
if there aren't any then it systematically cleans up the area
|
|
of extra encounters and loot
|
|
*/
|
|
void debug(string dstring)
|
|
{
|
|
int isdebug = 0;
|
|
if (isdebug == 1)
|
|
SendMessageToPC(GetFirstPC(), dstring);
|
|
}
|
|
|
|
void TrashObject(object oObject)
|
|
{
|
|
debug(GetTag(oObject) + " is in trashobject");
|
|
//if(GetStringLowerCase(GetName(oObject)) == "remains")
|
|
//{
|
|
//object oItem = GetFirstItemInInventory(oObject);
|
|
//while (oItem !=OBJECT_INVALID)
|
|
// {
|
|
// DestroyObject(oItem);
|
|
// oItem = GetNextItemInInventory(oObject);
|
|
// }
|
|
// }
|
|
if (GetObjectType(oObject) == OBJECT_TYPE_PLACEABLE) {
|
|
object oItem = GetFirstItemInInventory(oObject);
|
|
while (GetIsObjectValid(oItem))
|
|
{
|
|
debug(GetTag(oItem) + " is in trashobject");
|
|
TrashObject(oItem);
|
|
oItem = GetNextItemInInventory(oObject);
|
|
}
|
|
}
|
|
else if ((GetResRef(oObject)!="div_key")&&(GetResRef(oObject)!="divine_note"))
|
|
{
|
|
debug(GetTag(oObject) + " failed to pass as inventory type placeable is getting destroyed");
|
|
AssignCommand(oObject, SetIsDestroyable(TRUE, FALSE, FALSE));
|
|
DestroyObject(oObject);
|
|
}
|
|
}
|
|
|
|
void CleanArea(object oPlayer)
|
|
{
|
|
object oPC;
|
|
oPC = GetFirstPC();
|
|
object tPC = oPC;
|
|
debug("We're starting area cleanup");
|
|
while (oPC != OBJECT_INVALID)
|
|
{
|
|
if (OBJECT_SELF == GetArea(oPC))
|
|
return;
|
|
else oPC = GetNextPC();
|
|
}
|
|
object oObject = GetFirstObjectInArea(OBJECT_SELF);
|
|
while (oObject != OBJECT_INVALID)
|
|
{
|
|
debug(GetTag(oObject));
|
|
if (GetIsEncounterCreature(oObject) && FindSubString(GetTag(oObject), "_BOSS") > -1)
|
|
{
|
|
if ((GetTag(oObject)!="starfall")&&(GetTag(oObject)!="reaper")&&(GetIsPC(oObject)==FALSE))
|
|
{
|
|
DestroyObject(oObject);
|
|
}
|
|
}
|
|
if (GetObjectType(oObject) == OBJECT_TYPE_CREATURE && GetIsEnemy(oPlayer, oObject))
|
|
{
|
|
object oItem=GetFirstItemInInventory(oObject);
|
|
while (oItem!=OBJECT_INVALID)
|
|
{
|
|
DestroyObject(oItem);
|
|
oItem = GetNextItemInInventory(oObject);
|
|
}
|
|
TrashObject(oObject);
|
|
}
|
|
int iObjectType = GetObjectType(oObject);
|
|
if(iObjectType == OBJECT_TYPE_ITEM)
|
|
{
|
|
TrashObject(oObject);
|
|
}
|
|
// else if(iObjectType == OBJECT_TYPE_PLACEABLE && GetName(oObject) == "Remains")
|
|
// {
|
|
// TrashObject(oObject);
|
|
// }
|
|
if(GetStringLowerCase(GetName(oObject)) == "remains")
|
|
{
|
|
TrashObject(oObject);
|
|
}
|
|
|
|
|
|
oObject = GetNextObjectInArea(OBJECT_SELF);
|
|
}
|
|
|
|
}
|
|
//void main(){}
|