void main() { //Quit if the entering object is not a PC if (!GetIsPC(GetEnteringObject())) return; //Close all doors object oExArea = GetArea(GetWaypointByTag(GetLocalString(OBJECT_SELF, "DungeonWP"))); if (GetLocalInt(oExArea, "DoorClosed") == FALSE) { SetLocalInt(oExArea, "DoorClosed", TRUE); object oObject = GetFirstObjectInArea(OBJECT_SELF); while (GetIsObjectValid(oObject)) { if (GetObjectType(oObject) == OBJECT_TYPE_DOOR) { AssignCommand(oObject, ActionCloseDoor(oObject)); } oObject = GetNextObjectInArea(OBJECT_SELF); } } //Delete the variable signifying transition between the exterior and the interior area DeleteLocalInt(GetEnteringObject(), "InTransition"); //A workaround to enable selecting this area in the OnClientLeave event, since GetArea returns OBJECT_INVALID there SetLocalObject(GetEnteringObject(), "StoredArea", OBJECT_SELF); //Let's set this area's pseudo OnExit event (as a workaround for players quitting the game) SetLocalString(OBJECT_SELF, "OnExit", "pseudo_dungexit"); }