void ClearArea(object oArea) { int iFlag; int iType; int iObjectFlag; int iCount; int iDoOnce; string sTag; location oLoc; object oObject; iFlag = 0; iCount = 0; oObject = GetFirstObjectInArea(oArea); while (iFlag == 0) { iCount++; iType = GetObjectType(oObject); if (iType == OBJECT_TYPE_CREATURE) { //check if enemy, hopefully should keep familiars/summoned/henchmen from being destroyed if (GetIsEnemy(GetFirstPC(),oObject)) { DestroyObject(oObject); } } //allow respawning of loot in containers iDoOnce = GetLocalInt(oObject,"NW_DO_ONCE"); if (iDoOnce != 0) SetLocalInt(oObject,"NW_DO_ONCE",0); oObject = GetNextObjectInArea(oArea); if (oObject==OBJECT_INVALID) { iFlag = 1; } if (iCount >1000) { iFlag=1; } } }