void TrashObject(object oObject)  /* function by Leo Lipelis */

{
    if (GetHasInventory(oObject) == FALSE) {

        DestroyObject(oObject);  /* not a container, just destroy it */

    } else {

        object oItem = GetFirstItemInInventory(oObject);

        /* recursively trash all items inside container */
        while (GetIsObjectValid(oItem))
        {
            TrashObject(oItem);

            oItem = GetNextItemInInventory(oObject);
        }

        /* destroy the container itself */
        DestroyObject(oObject);
    }
}


void main()
{
    /* only execute for PC's entering an area */
    if(!GetIsPC(GetExitingObject())) {
        return; }



    object oItem = GetFirstObjectInArea();

    while (GetIsObjectValid(oItem))
    {
       int iObjectType = GetObjectType(oItem);

        switch (iObjectType) {
        case OBJECT_TYPE_PLACEABLE:

            /* monster drop containers are tagged placeables */
            if (GetTag(oItem) != "Body Bag") {
                break; }

            /* note: no break here, allow fall-through */

        case OBJECT_TYPE_ITEM:





                    TrashObject(oItem); } /* destruct time has passed, trash the object */

                /* note: no action if destruct time set but not passed */




        oItem = GetNextObjectInArea();
}
object oPC = GetExitingObject();
    // First check to see if the ExitingObject is a PC or not

    if (!GetIsPC(oPC))
        return;
    // Start up the loop, setting oPC now to the first PC
    oPC = GetFirstPC();
    // Continue looping until there are no more PCs left
    while (oPC != OBJECT_INVALID)
    {
        // Check the Area against the Area of the current PC
        // If they are the same, exit the function, as we do not need to
        // check anymore PCs
        if (OBJECT_SELF == GetArea(oPC))
            return;
        // If not, continue to the next PC
        else oPC = GetNextPC();
    }
        object drac = GetObjectByTag("NW_DRGRED003");
    SetPlotFlag( drac, FALSE);
    DestroyObject(drac);
    // If we've made it this far, we know that there aren't any PCs in the area
    // Set oObject to the first object in the Area
    object oObject = GetFirstObjectInArea(OBJECT_SELF);
    // Continue looping until there are no more objects left
    while (oObject != OBJECT_INVALID)
    {
        // Test to see if oObject is a creature spawned from an encounter
        // If so, destroy the object
        if (GetIsEncounterCreature(oObject))
            DestroyObject(oObject);
        // Move on to the next object
        oObject = GetNextObjectInArea(OBJECT_SELF);

    /* only execute for PC's entering an area */
}
}