Jump to content

Photo

Updating Speedmult midgame

actor value creation kit

6 replies to this topic

#1
TheArmageddonJoker

TheArmageddonJoker

    Regular

  • Members
  • PipPip
  • 55 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!



#2
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 10,491 posts

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.nexusmod...tion/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.



#3
TheArmageddonJoker

TheArmageddonJoker

    Regular

  • Members
  • PipPip
  • 55 posts

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.



#4
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 10,491 posts

Which menu are you talking about?

Are you testing on a save that has not seen the mod in question?

Are you testing on a new game?

Are you using COC to jump into the game world from the main menu?



#5
blitzen

blitzen

    Adventurer

  • Supporter
  • PipPipPipPip
  • 2,151 posts

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, 07 February 2022 - 03:54 AM.


#6
TheArmageddonJoker

TheArmageddonJoker

    Regular

  • Members
  • PipPip
  • 55 posts

@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



#7
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 10,491 posts

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




Reply to this topic



  



Also tagged with one or more of these keywords: actor value, creation kit

IPB skins by Skinbox
Page loaded in: 1.049 seconds