void main()
{
object oPC = GetFirstObjectInArea(OBJECT_SELF);
while ( GetIsObjectValid( oPC ) )
{
if (GetIsPC(oPC))
{
// Well, there you have it. Someone is still in the area. We don't want to
// clean up quite yet.
return;
}
if (GetObjectType( oPC )!=OBJECT_TYPE_CREATURE)
{
oPC = GetNextObjectInArea( OBJECT_SELF );
continue;
}
oPC = GetNextObjectInArea(OBJECT_SELF );
int iCount = 0;
object oObject = GetObjectByTag( "BodyBag", iCount );
while ( GetIsObjectValid( oObject ) )
{
// First, remove whatever treasure might be in it.
object oTreasure = GetFirstItemInInventory( oObject );
while ( GetIsObjectValid( oTreasure ) )
{
DestroyObject( oTreasure );
oTreasure = GetNextItemInInventory( oObject );
}
// Now, remove the body bag itself.
DestroyObject( oObject );
oObject = GetObjectByTag( "BodyBag", ++iCount );
}
}
}
This is supposed to check if there are any PC's in the area, and then destroy body bags. It compiles, and is on area exit, but doesn't destroy the body bags.
|