void TrashObject(object oObject)

{
     /* search and destroy contents of body bag's, others just destroy */
    if (GetObjectType(oObject) == OBJECT_TYPE_PLACEABLE) {

        object oItem = GetFirstItemInInventory(oObject);

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

            oItem = GetNextItemInInventory(oObject);
        }
    }

    DestroyObject(oObject);
}



   #include "afx_sfunc"

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




object oPC = GetExitingObject();
    // First check to see if the ExitingObject is a PC or not
    if(GetIsPC(oPC) == TRUE) {
        afx_remove_effects(oPC,OBJECT_SELF);
    }
    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();
    }

    // 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 */
}
    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) != "BodyBag") {
                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();
}
}