// 5.4.1
// took out corpse sound as now sound is correct by default using loot bag 5.
// Took out code to destroy lootable corpse when empty because of
// new code for only having one xp message in nw_c2_default7
////////////////////////////////////////////////////////////////////////////////
//                                                  //                        //
// hc_close_npccorp                                 //      VERSION 1.0       //
//                                                  //                        //
//  by Keron Blackfeld on 07/17/2002                ////////////////////////////
//                                                                            //
//  email Questions and Comments to: keron@broadswordgaming.com or catch me   //
//  in Bioware's NWN Community - Builder's NWN Scripting Forum                //
//  modified 01/03/2003 by Ragnar69 to destroy empty corpses                  //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  This script is a simple, albeit weak, attempt to mask the default DOOR    //
//  sounds tied to the invisible lootable object. Please this in both the     //
//  onOpened and onClosed Events of the "invis_corpse_obj" described in my    //
//  _kb_lootable_corpse script.                                               //
//  modified 01/03/2003 by Ragnar69 to destroy empty corpses                  //
////////////////////////////////////////////////////////////////////////////////


void main()
{
    /*effect eQuiet = EffectSilence();
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eQuiet, OBJECT_SELF, 120.0f);
    PlaySound("it_armorleather");
    DelayCommand(0.2f, PlaySound("it_materialsoft"));
    DelayCommand(0.3f, PlaySound("it_armorleather"));
    DelayCommand(0.4f, PlaySound("it_materialsoft"));
    DelayCommand(0.5f, PlaySound("it_armorleather"));
    */
    object oItem=GetFirstItemInInventory(OBJECT_SELF);
    object oAnimal = GetLocalObject(OBJECT_SELF, "oHostBody");
    if(!GetIsObjectValid(oItem)&& GetRacialType(oAnimal) != RACIAL_TYPE_ANIMAL)
     DelayCommand(1.0, DestroyObject(OBJECT_SELF));
}

