link182 Posted August 26, 2019 Share Posted August 26, 2019 Hi, Iâve been working on a mod that gives the player the avoid death perk or more accurately a copy of it from the start. Iâve got that part down however, I want to make it so if you unlock level 90 restoration and then unlock the actual perk you extend itâs usage from once per day to twice per day and Iâm truly stuck. When Iâve looked at the script that checks if enough time has passed I canât see how to extend it over 2 days instead if anyone can help me with this that would be amazing. Link to comment Share on other sites More sharing options...
ReDragon2013 Posted August 26, 2019 Share Posted August 26, 2019 (edited) vanilla script you mentioned as follow: PerkAvoidDeathScript Scriptname PerkAvoidDeathScript extends ActiveMagicEffect ; ready to heal you Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked ) ; ; debug.trace(self + " Enter Bleedout"); If PerkAvoidDeathTimer.GetValue() < GameDaysPassed.GetValue() ; cast heal spell PercentHealth = GetTargetActor().GetAVPercentage("Health") If PercentHealth < 0.1 HealSpell.Cast(GetTargetActor()) PerkAvoidDeathTimer.SetValue(GameDaysPassed.GetValue() + 1.0) ; ; debug.trace(self + " Heal "+ PerkAvoidDeathTimer.GetValue() + " " + GameDaysPassed.GetValue()) EndIf Else ; ; debug.trace(self + " Timer not reset " + PerkAvoidDeathTimer.GetValue() + " " + GameDaysPassed.GetValue()) EndIf endEvent Spell Property HealSpell Auto GlobalVariable Property PerkAvoidDeathTimer Auto GlobalVariable Property GameDaysPassed Auto float Property PercentHealth = 100.0 Auto and now a copy of them with things you want to modify, in case you dislike the script name change it as you wish: linkCopyPerkAvoidDeathScript Scriptname linkCopyPerkAvoidDeathScript extends ActiveMagicEffect ; https://forums.nexusmods.com/index.php?/topic/7936883-help-with-script-that-checks-time-passed/ GlobalVariable PROPERTY PerkAvoidDeathTimer auto GlobalVariable PROPERTY GameDaysPassed auto Spell PROPERTY HealSpell auto ;Float PROPERTY PercentHealth = 100.0 auto ; UnUSED by now ; added by ReDragon Float fTimer Actor target ; -- EVENT -- EVENT OnEffectStart(Actor akTarget, Actor akCaster) fTimer = PerkAvoidDeathTimer.GetValue() target = akTarget gotoState("Healing") ; ### STATE ### ENDEVENT EVENT OnEffectFinish(Actor akTarget, Actor akCaster) gotoState("") ; ### STATE ### target = None ENDEVENT ;================================= state Healing ;============ EVENT OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool b1, Bool b2, Bool b3, Bool b4) IF (target.GetActorValuePercentage("Health") > 0.1) RETURN ; - STOP - target is still on good health ENDIF ;--------------------- IF (fTimer >= GameDaysPassed.GetValue()) ; >= Utility.GetCurrentGameTime()) RETURN ; - STOP - time delay is too short for healing again ENDIF ;--------------------- ready to heal gotoState("") ; ### STATE ### prevent calling of hit events (I am busy with healing!) myF_Action() gotoState("Healing") ; ### STATE ### allow hit events again ENDEVENT ;======= endState ; -- FUNCTION ;-------------------- FUNCTION myF_Action() ;-------------------- HealSpell.Cast(target as ObjectReference) ; full healing immediately ; Which time has target to wait for next healing? IF (target.GetActorValue("Restoration") < 90) fTimer = 1.0 ; one day ELSE fTimer = 2.0 ; two days ENDIF fTimer = GameDaysPassed.GetValue() + fTimer ; = Utility.GetCurrentGameTime() + fTimer PerkAvoidDeathTimer.SetValue( fTimer ) ; set timer to globalVariable like vanilla script ENDFUNCTION I hope it is useful for understanding how does the script is working! Edited August 26, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
link182 Posted August 26, 2019 Author Share Posted August 26, 2019 Thatâs very helpful thank you. Link to comment Share on other sites More sharing options...
Recommended Posts