//:://///////////////////////////////////////////// //:: Name corpse_damaged //:: FileName //:: //::////////////////////////////////////////////// /* Responds to the ondamaged event of the placeable. Performe=s a saving throw on items if necessary. */ //::////////////////////////////////////////////// //:: Created By: Alexandre Brunel //:: Created On: 21/04/2003 //::////////////////////////////////////////////// #include "corpse_lib" void main() { if(GetUseSaves()) { object target = GetOriginalCorpse(); object item = GetFirstItemInInventory(); int dammages = GetLocalInt(OBJECT_SELF,CorpseItemLastHP) - GetCurrentHitPoints(); SetLocalInt(OBJECT_SELF,CorpseItemLastHP,GetCurrentHitPoints()); while(GetIsObjectValid(item)) { if(!GetPlotFlag(item) && item != GetPickableCorpse()) { /*WriteTimestampedLogEntry("Total Dammages = "+IntToString(GetTotalDamageDealt())); SetDamageTaken(GetTotalDamageDealt(),0,item); WriteTimestampedLogEntry("Fire Dammages = "+IntToString(GetDamageDealtByType(DAMAGE_TYPE_FIRE))); SetDamageTaken(GetDamageDealtByType(DAMAGE_TYPE_FIRE),1,item); WriteTimestampedLogEntry("Acid Dammages = "+IntToString(GetDamageDealtByType(DAMAGE_TYPE_ACID))); SetDamageTaken(GetDamageDealtByType(DAMAGE_TYPE_ACID),1,item);*/ SetDamageTaken(dammages,0,item); ExecuteScript(SavesScriptName,item); } item = GetNextItemInInventory(); } item = GetFirstItemInInventory(target); while(GetIsObjectValid(item)) { if(!GetPlotFlag(item)) { SetDamageTaken(dammages,0,item); ExecuteScript(SavesScriptName,item); } item = GetNextItemInInventory(target); } } }