cold steel Posted May 26, 2019 Posted May 26, 2019 Hello guys. Maybe someone here know how can I change my character movement speed properly. Here is my code: Function WGSpeedManager() Actor player = Game.getPlayer() CurrentSpeed == player.GetValue(Speedmult) If (player.HasPerk(BellySlow0)) player.setvalue(Speedmult, (CurrentSpeed-10.00) as float) The idea was to change movement speed from 100% to 90% , but for some reason my character speed decrease too much after this script. If I am not mistaken default Speedmult value is 100.00 as float. That mean player.GetValue(Speedmult) function should set CurrentSpeed to 100.00. After that "setvalue" must deduct 10 out of 100 and set 90.00 speed. Can someone tell me please where I was wrong?
Guest Posted May 26, 2019 Posted May 26, 2019 There is a small error in your code. Here is the fixed version: Function WGSpeedManager() Actor player = Game.getPlayer() CurrentSpeed = player.GetValue(Speedmult) If (player.HasPerk(BellySlow0)) player.setvalue(Speedmult, (CurrentSpeed-10.00) as float) Be also aware that the speed multiplier is a value between 0.0 and 1.0, so probably you want to reduce it by 0.1 and not by 10.0
cold steel Posted May 26, 2019 Author Posted May 26, 2019 9 minutes ago, CPU said: There is a small error in your code. Here is the fixed version: Function WGSpeedManager() Actor player = Game.getPlayer() CurrentSpeed = player.GetValue(Speedmult) If (player.HasPerk(BellySlow0)) player.setvalue(Speedmult, (CurrentSpeed-10.00) as float) Be also aware that the speed multiplier is a value between 0.0 and 1.0, so probably you want to reduce it by 0.1 and not by 10.0 It works, thank you VERY much sir!
Guest Posted May 26, 2019 Posted May 26, 2019 next time it will be a good idea to comment your code when sending it to someone. we don't know what your code does
cold steel Posted May 26, 2019 Author Posted May 26, 2019 4 minutes ago, NeonTube100 said: next time it will be a good idea to comment your code when sending it to someone. we don't know what your code does For sure I will comment my code if needed for my question
Carreau Posted May 26, 2019 Posted May 26, 2019 It’s better to make it a perk That effects the run speed. Scripted run speed changes almost always will have issues when another mod is trying to make run changes as well
cold steel Posted May 26, 2019 Author Posted May 26, 2019 16 minutes ago, Carreau said: It’s better to make it a perk That effects the run speed. Scripted run speed changes almost always will have issues when another mod is trying to make run changes as well I can't find any perk options for changing speed. So, I decided to write a script for my custom perk.
Carreau Posted May 26, 2019 Posted May 26, 2019 Course Speed Up is the vanilla spell that alters speed. I used to use scripted slow down effects based on Fallout Vore's indigestion speed reduction. What I found is that the slow downs do not play well with each other, and it can easily cause problems when they stack and when they start to roll off resulting in permanent speed up and slow downs. Make your magic effect a Value Modifier or Peak Value Modifier and Constant Effect that effects SpeedMult and check Detrimental, Recover, and No Area. Then you can add it by having the perk added. It's much cleaner, and you're guaranteed that the effect will always roll back to normal speed once it's over. It will also stack well with other speed altering abilities so you won't have issues with mod compatibility. Set the spell magnitude as positive in the spell editor, and since Detrimental is checked, the magnitude is considered negative when it's applied to SpeedMult.
Carreau Posted May 26, 2019 Posted May 26, 2019 Here are some screenshots of how I set this up in the CK. It's much better than scripting the values. Trust me.
cold steel Posted May 26, 2019 Author Posted May 26, 2019 22 minutes ago, Carreau said: Course Speed Up is the vanilla spell that alters speed. I used to use scripted slow down effects based on Fallout Vore's indigestion speed reduction. What I found is that the slow downs do not play well with each other, and it can easily cause problems when they stack and when they start to roll off resulting in permanent speed up and slow downs. Make your magic effect a Value Modifier or Peak Value Modifier and Constant Effect that effects SpeedMult and check Detrimental, Recover, and No Area. Then you can add it by having the perk added. It's much cleaner, and you're guaranteed that the effect will always roll back to normal speed once it's over. It will also stack well with other speed altering abilities so you won't have issues with mod compatibility. Set the spell magnitude as positive in the spell editor, and since Detrimental is checked, the magnitude is considered negative when it's applied to SpeedMult. Thanks, I will try.
cold steel Posted May 27, 2019 Author Posted May 27, 2019 15 hours ago, Carreau said: Course Speed Up is the vanilla spell that alters speed. I used to use scripted slow down effects based on Fallout Vore's indigestion speed reduction. What I found is that the slow downs do not play well with each other, and it can easily cause problems when they stack and when they start to roll off resulting in permanent speed up and slow downs. Make your magic effect a Value Modifier or Peak Value Modifier and Constant Effect that effects SpeedMult and check Detrimental, Recover, and No Area. Then you can add it by having the perk added. It's much cleaner, and you're guaranteed that the effect will always roll back to normal speed once it's over. It will also stack well with other speed altering abilities so you won't have issues with mod compatibility. Set the spell magnitude as positive in the spell editor, and since Detrimental is checked, the magnitude is considered negative when it's applied to SpeedMult. Carreau, can you take a look please on my screenshots and tell me what I am doing wrong? I am trying to change character movement speed with your method when my character get BellySlow0 perk. Unfortunately for some reason my character speed don't change after getting perk.
Carreau Posted May 27, 2019 Posted May 27, 2019 Take out that conditional. It was incorrectly stated early that it transitions between 0 and 1. It transitions between 0 and 100. But more importantly, even if you set it a100, the moment your perk ability fired, you would no longer meet the conditional requirement and the spell would cease to function.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.