enderalse/source/scripts/frostslowfix.psc

38 lines
1.1 KiB
Plaintext

Scriptname FrostSlowFix extends activemagiceffect
{Behebt den Fehler, dass die Verlangsamung von Frostzaubern nicht funktioniert, indem das SpeedMult-Attribut durch kurzzeitige Änderung des InventoryWeight geupdatet wird.}
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)
ForceSpeedMultUpdate()
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)
ForceSpeedMultUpdate()
EndIf
EndEvent
Function ForceSpeedMultUpdate()
Target.ModActorValue("InventoryWeight", -0.1)
Utility.Wait(0.01)
Target.ModActorValue("InventoryWeight", 0.1)
EndFunction