Actor Value not taking effect correctly

Post » Fri Jan 04, 2013 7:20 am

Say we have something like this:

Scriptname ReducedSpeed extends activemagiceffect  Event OnEffectStart(actor akTarget, actor akCaster)	akTarget.ModActorValue("Speedmult", -20.0)EndEventevent OnEffectFinish(actor akTarget, actor akCaster)	akTarget.ModActorValue("Speedmult", 20.0)EndEvent

It's attached to a spell with constant effect, the spell affecting an armor part. You equip these heavy armor boots, you're supposed to run slower. Is there a reason why it doesn't actually take effect until I reopen and close the inventory? If I just equip the boots and close the inventory nothing happens, although player.getav speedmult reports the correct altered value. What's wrong?
User avatar
Alexandra Ryan
 
Posts: 3438
Joined: Mon Jul 31, 2006 9:01 am

Post » Fri Jan 04, 2013 4:19 pm

When changing Speedmult, you must also change the actor's carryweight by a small amount afterward to give the engine the kick it needs to update the value. Generally I use:

akTarget.ModActorValue("Speedmult", -20.0)akTarget.ModActorValue("CarryWeight", 0.1)akTarget.ModActorValue("CarryWeight", -0.1)
User avatar
Sweet Blighty
 
Posts: 3423
Joined: Wed Jun 21, 2006 6:39 am


Return to V - Skyrim