Fixed FrostSlowFix changing actor value and comparing base actor value afterwards

This commit is contained in:
Eddoursul 2021-11-26 00:16:01 +01:00
parent 467d42a300
commit 330f9f1a96
2 changed files with 13 additions and 18 deletions

Binary file not shown.

View File

@ -3,35 +3,30 @@ Scriptname FrostSlowFix extends activemagiceffect
Keyword Property MagicSlowDownTarget Auto
Actor Target
Event OnEffectStart(Actor akTarget, Actor akCaster)
Target = akTarget
Float fBaseSpeed = Target.GetBaseActorValue("Speedmult")
If fBaseSpeed > Target.GetBaseActorValue("Fame") ; ensures that the speedmult gets only halved once
Target.SetActorValue("Fame", fBaseSpeed)
Target.SetActorValue("Speedmult", fBaseSpeed * 0.5)
Float fBaseSpeed = akTarget.GetBaseActorValue("Speedmult")
ForceSpeedMultUpdate()
If fBaseSpeed > akTarget.GetActorValue("Fame") ; ensures that the speedmult gets only halved once
akTarget.SetActorValue("Fame", fBaseSpeed)
akTarget.SetActorValue("Speedmult", fBaseSpeed * 0.5)
ForceSpeedMultUpdate(akTarget)
EndIf
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
If Target == None ; version update
Target = akTarget
EndIf
If Target.HasMagicEffectWithKeyword(MagicSlowDownTarget) == False
Target.SetActorValue("Speedmult", Target.GetBaseActorValue("Fame"))
Target.SetActorValue("Fame", 0)
If akTarget.HasMagicEffectWithKeyword(MagicSlowDownTarget) == False
akTarget.SetActorValue("Speedmult", akTarget.GetActorValue("Fame"))
akTarget.SetActorValue("Fame", 0)
ForceSpeedMultUpdate()
ForceSpeedMultUpdate(akTarget)
EndIf
EndEvent
Function ForceSpeedMultUpdate()
Target.ModActorValue("InventoryWeight", -0.1)
Function ForceSpeedMultUpdate(Actor akTarget)
akTarget.ModActorValue("InventoryWeight", -0.1)
Utility.Wait(0.01)
Target.ModActorValue("InventoryWeight", 0.1)
akTarget.ModActorValue("InventoryWeight", 0.1)
EndFunction