Jump to content

Updating Speedmult midgame


TheArmageddonJoker

Recommended Posts

Hey everyone,

 

I do have a question about scripting within a quest stage, I have the following script:

 

while (true)

if (Game.GetPlayer().IsInCombat())

Game.GetPlayer().SetActorValue("SpeedMult", 100.0)

else

Game.GetPlayer().SetActorValue("SpeedMult", 37.0)

endif

endWhile

 

so, the point is, if I normally walk around, starting a battle etc. nothing will happen, the first speedmult value will stay active, until I'm going to open the menu. After closing the menu again the new speedmult value is active. But why? Does anyone know how the creation engine handles the SetActorValue? Because the while loop is working as intended, because watching the value constantly with GetActorValue will deliver the correct value.

 

P.S.: Yes, don't use a while loop like this, without a break condition, this is only for testing something.

 

Cheers!

Link to comment
Share on other sites

The default value is 100.

The stage fragment will not run until the quest reaches that point.

Not knowing anything about the quest, it could be possible that the stage fragment finally runs when entering the menu.

 

Try a hotkey approach to initiate the change in speed multiplier. In fact, a mod has already been done which does this very thing.

https://www.nexusmods.com/skyrimspecialedition/mods/38471

Although it was designed for use with a controller. If you do not use a controller, you should be able to change the key bind via console and it work with mouse and keyboard.

Link to comment
Share on other sites

Thanks for your answer. The quest is pretty simple, Run on start, and only one stage (0, start with quest). The fragment is running and working, if I insert into the while loop a "Debug.Notification(Game.GetPlayer().GetActorValue("SpeedMult"))" it will always show me outside a battle 37, and inside a battle 100. So it will always run, but not apply, until I open the menu and close it again.

Link to comment
Share on other sites

The speedmult value is odd. If you update it with the console or SkyTweak, it doesn't go into effect until something triggers it. For example, drawing a weapon and putting it back causes the new value to take effect. If you update it for a mount you are riding, you have to dismount then remount to see the new speed. Using setav allegedly causes the value to reset at some point (I think when you logout). I always used "modav" to increase it.

Edited by blitzen
Link to comment
Share on other sites

@IsharaMeradin

I mean by menu the inventory, not the menu with the quest logs etc.

 

@blitzen

Thanks, it really was because I used SetActorValue and not ModActorValue, the script is now working, just using some more conditions to mod the AV, otherwise it will scale down until -infinity or +infinty xD

 

 

while (true)

if (Game.GetPlayer().IsInCombat() && Game.GetPlayer().GetActorValue("Speedmult") == 37.0)

Game.GetPlayer().SetActorValue("SpeedMult", 63.0)

elseif (!Game.GetPlayer().IsInCombat() && Game.GetPlayer().GetActorValue("Speedmult") == 100.0)

Game.GetPlayer().SetActorValue("SpeedMult", -63.0)

endif

endWhile

P.S.: Yes, never compare floats if they are gonna be exactly a specific value (because of floats :D), and yes, never use a while true loop without a break condition. xD

Link to comment
Share on other sites

I got hung up on the menu. Should have known of the "wonkiness" with setting actor values since my controller walk run toggle mod (linked earlier) does the following:

Function ChangeSpeedRate(Actor Dude, Float Rate)
	Dude.ModActorValue("SpeedMult",Rate)
	Dude.ModActorValue("CarryWeight",0.1)
	Dude.ModActorValue("CarryWeight",-0.1)
EndFunction
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...