void main() { object oDoor; if (GetLocalInt(OBJECT_SELF,"nDone")!=1) { oDoor=GetObjectByTag("jw_new_zhentb1"); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(10,DAMAGE_TYPE_MAGICAL,DAMAGE_POWER_PLUS_FIVE),oDoor); oDoor=GetObjectByTag("jw_new_zhentb2"); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(10,DAMAGE_TYPE_MAGICAL,DAMAGE_POWER_PLUS_FIVE),oDoor); SetLocalInt(OBJECT_SELF,"nDone",1); } object oChest; object oObject = GetFirstObjectInArea(); object oPC=GetEnteringObject(); if (!GetIsPC(oPC)) { return; } if (GetIsDM(oPC)) { return; } int nPCinArea=FALSE; oObject=GetFirstObjectInArea(); while (GetIsObjectValid(oObject)) { if (GetIsPC(oObject)&&(oObject!=oPC)) { nPCinArea = TRUE; } oObject=GetNextObjectInArea(); } /// this returns true if there are any PCs in the area that are NOT /// the object that just entered the area if (nPCinArea != TRUE) { oChest=GetObjectByTag("jw_new_zhent_chest"); oObject=GetFirstItemInInventory(oChest); while (GetIsObjectValid(oObject)) { DestroyObject(oObject); oObject=GetNextItemInInventory(oChest); } AssignCommand(oChest,ActionPlayAnimation (ANIMATION_PLACEABLE_CLOSE)); AssignCommand(oChest,SetLocked(oChest,TRUE)); SetLocalInt(oChest,"nDone",0); } }