Scriptname mm_BeluaVampireSprintScript extends activemagiceffect import debugGlobalVariable Property BeluaGlobalCurrentVampireLevel AutoGlobalVariable Property BeluaSatiatedStage AutoGlobalVariable Property BeluaVampireSprintImodStrength AutoImageSpaceModifier Property mm_BeluaSprintIntroImod AutoImageSpaceModifier Property mm_BeluaSprintMainImod AutoImageSpaceModifier Property mm_BeluaSprintOutroImod AutoActor CasterFloat originalSpeedFloat previousSpeedFloat SprintMod = 0.0bool EffectFinished = falsefloat ImodStrengthfloat totalincreaseEvent OnEffectStart(Actor target, Actor akCaster)ImodStrength = BeluaVampireSprintImodStrength.GetValue() as FloatCaster = akCaster; Kill the imods from previous if still running...like berzerk scriptmm_BeluaSprintIntroImod.Remove()mm_BeluaSprintMainImod.Remove()mm_BeluaSprintOutroImod.Remove()mm_BeluaSprintIntroImod.Apply(ImodStrength)int level = BeluaGlobalCurrentVampireLevel.GetValue() as intoriginalSpeed = akCaster.GetActorValue("speedMult")previousSpeed = originalSpeedTrace("CurrentLevel: " + level)Trace("originalSpeed: " + originalSpeed)if level == 1 ; 10% Increase SprintMod = (1.10 * originalSpeed) - previousSpeedelseif level == 2 SprintMod = (1.15 * originalSpeed) - previousSpeedElseIf level == 3 SprintMod = (1.20 * originalSpeed) - previousSpeedElseIf level == 4 SprintMod = (1.25 * originalSpeed) - previousSpeedElseIf level == 5 ; 50% Increase SprintMod = (1.30 * originalSpeed) - previousSpeedEndIfTrace("SpeedMultUp: " + SprintMod)totalincrease = SprintMod;Utility.Wait(1.75)mm_BeluaSprintIntroImod.PopTo(mm_BeluaSprintMainImod,ImodStrength)akCaster.ModActorValue("SpeedMult", SprintMod)akCaster.ModActorValue("CarryWeight", -1)akCaster.ModActorValue("CarryWeight", 1)RegisterForSingleUpdate(2)EndEventEvent OnUpdate()int SatiationStage = BeluaSatiatedStage.GetValue() as intif(!caster.IsInInterior() && effectfinished != true) SprintMod = SprintMod * 1.3 Trace("SpeedMultUp: " + SprintMod) ; The hungrier the are the faster you move if SatiationStage == 4 SprintMod = SprintMod * 1.05 elseif SatiationStage == 3 SprintMod = SprintMod * 1.10 elseif SatiationStage == 2 SprintMod = SprintMod * 1.15 elseif SatiationStage == 1 SprintMod = SprintMod * 1.20 elseif SatiationStage == 0 SprintMod = SprintMod * 1.25 EndIf totalincrease = totalincrease + SprintMod caster.ModActorValue("SpeedMult", SprintMod) caster.ModActorValue("CarryWeight", -1) caster.ModActorValue("CarryWeight", 1)EndIfEndEventEvent OnEffectFinish(Actor target, Actor akCaster)effectfinished = true;mm_BeluaSprintIntroImod.Remove()float reverse = 0 - totalincreasemm_BeluaSprintMainImod.PopTo(mm_BeluaSprintOutroImod,ImodStrength); Reverse the increaseakCaster.ModActorValue("SpeedMult", reverse )akCaster.ModActorValue("CarryWeight", -1)akCaster.ModActorValue("CarryWeight", 1)Trace("SpeedMultDown: " + reverse)EndEventSome users have reported that they are getting stuck at higher and higher speed multipliers. One user, who turned up the imod strength then noticed when it happens, the imagespace modifier wasn't being removed. This means the OnEffectFinish event is not always firing when the effect condition in the spell evaluates to false and removes the effect. I, however, cannot reproduce the issue on my machine. The wiki has this to say:
- By the time this event is called, the active magic effect may have already been deleted by the game. Any native calls to this active magic effect may fail.
- This event is also called when the owning spell is removed from the target or when its conditions become invalid.
I'm not really sure what to make of that sentance. Can we not trust that OnEffectFinish will always be called? Does Papyrus pre-empt other script blocks from execution if it's too tasked?
-MM

