Rest only when safe

Rest only when safe
here it is the godly(self apointed name:P) res only when safe script. change fseconds to change the time between res attempts and change fHostileRange to change the min distance of a hostile to res. from what testing ive done it works great(sofar ive tested with 2 deaths at the same time) if u find a bug please email me bulldogc@cox.net or pm me and ill be glad to try and help ya out. also if u edit or use it please give credit to me someware in it title this one anything and place it in your on death mod slot

void Raise(object oPlayer) {       effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION); effect eBad = GetFirstEffect(oPlayer); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection,oPlayer); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer); //Search for negative effects while(GetIsEffectValid(eBad)) {         if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||              GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||              GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||              GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||              GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||              GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||              GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||              GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||              GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||              GetEffectType(eBad) == EFFECT_TYPE_DEAF ||              GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||              GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL) {               //Remove effect if it is negative. RemoveEffect(oPlayer, eBad); }               eBad = GetNextEffect(oPlayer); }           //Fire cast spell at event for the specified target SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE)); ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPlayer); } void main {   float fSeconds = 10.0; object oRespawner = GetLastPlayerDied; SetLocalObject(oRespawner, "reser", oRespawner); DelayCommand(fSeconds,ExecuteScript("reswhensafea", oRespawner)); }

and this one jsut gets saved and sits waiting to be called.

//name this script reswhensafea void main {   float fHostileRange = 9.0; object oRespawner = GetLocalObject(OBJECT_SELF,"reser"); object oCreature = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, oRespawner); float fSeconds = 20.0; float fdistancebetween = GetDistanceBetween (oRespawner, oCreature); if(GetIsDead(oRespawner) == TRUE) {   if (GetIsObjectValid(oCreature) == TRUE) {      if (fdistancebetween >= fHostileRange) {         AssignCommand(oRespawner, SpeakString("Welcome Back")); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection,oRespawner); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner); }      else {         AssignCommand(oRespawner, SpeakString("You can not resurect in the heat of battle")); DelayCommand(fSeconds,ExecuteScript("reswhensafea", OBJECT_SELF)); }     }    else {      AssignCommand(oRespawner, SpeakString("The area appears safe to return to life")); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection,oRespawner); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner); }   }    else {   } }