generated from Jaysyn/ModuleTemplate
102 lines
2.2 KiB
Plaintext
102 lines
2.2 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Name ag_area_reset
|
|
//:: FileName
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Alan Guile
|
|
//:: Created On:12/5/03
|
|
//:://////////////////////////////////////////////
|
|
#include "prc_inc_util"
|
|
|
|
void main()
|
|
{
|
|
object oArea = GetArea(OBJECT_SELF);
|
|
object oPC = GetFirstPC();
|
|
object oTreasure = GetFirstObjectInArea(oArea);
|
|
object oIItem;
|
|
int nPCinArea = 0;
|
|
|
|
|
|
// Check to make sure no PC's In Area
|
|
while (GetIsObjectValid(oPC) == TRUE)
|
|
{
|
|
if (GetArea(oPC) == oArea)
|
|
{
|
|
nPCinArea = TRUE;
|
|
}
|
|
oPC = GetNextPC();
|
|
|
|
|
|
|
|
}
|
|
|
|
// Master Loop thru all objects in zone
|
|
if (nPCinArea == FALSE)
|
|
{
|
|
while (GetIsObjectValid(oTreasure) == TRUE)
|
|
{
|
|
|
|
PrintString(GetTag(oTreasure));
|
|
|
|
// If has inventory reset do once
|
|
if (GetHasInventory(oTreasure) == TRUE)
|
|
{
|
|
SetLocalInt(oTreasure,"NW_DO_ONCE",0);
|
|
}
|
|
// if open close
|
|
if (GetIsOpen(oTreasure)== TRUE)
|
|
{
|
|
AssignCommand(oTreasure,ActionCloseDoor(oTreasure));
|
|
}
|
|
// if lockable lock it
|
|
if (GetLockLockable(oTreasure) == TRUE)
|
|
{
|
|
SetLocked(oTreasure,TRUE);
|
|
}
|
|
// if encounter creature delete it
|
|
if (GetIsEncounterCreature(oTreasure) == TRUE)
|
|
{
|
|
DestroyObject(oTreasure);
|
|
}
|
|
// if is encounter reset spawn counter
|
|
if (GetObjectType(oTreasure) == OBJECT_TYPE_ENCOUNTER)
|
|
{
|
|
SetEncounterSpawnsCurrent(0,oTreasure);
|
|
SetEncounterActive(TRUE,oTreasure);
|
|
}
|
|
// delete loot bags
|
|
if (GetTag(oTreasure) == "BodyBag")
|
|
{
|
|
// delete items in loot bag
|
|
oIItem = GetFirstItemInInventory(oTreasure);
|
|
while (GetIsObjectValid(oIItem) == TRUE)
|
|
{
|
|
DestroyObject(oIItem);
|
|
oIItem = GetNextItemInInventory(oTreasure);
|
|
}
|
|
DestroyObject(oTreasure);
|
|
}
|
|
// delete items
|
|
if (GetObjectType(oTreasure) == OBJECT_TYPE_ITEM)
|
|
{
|
|
DestroyObject(oTreasure);
|
|
}
|
|
// Have other mobs rest
|
|
if ( GetObjectType(oTreasure) == OBJECT_TYPE_CREATURE)
|
|
{
|
|
PRCForceRest(oTreasure);
|
|
}
|
|
|
|
|
|
|
|
|
|
oTreasure = GetNextObjectInArea(oArea);
|
|
}
|
|
}
|
|
|
|
}
|