Jump to content

Need some help with script


Recommended Posts

Posted

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?

Posted

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

Posted
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!

Posted

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

Posted
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 :)

Posted

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

Posted
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.

Posted

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.

Posted
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.

Posted
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.


1.jpg.5207eec9f36f3acf9d1db68129c45a0f.jpg2.thumb.jpg.b487ac45e3fca2770646a2846d0458bc.jpg3.jpg.d4a16645bbfe591283dea19dd05044dc.jpg

Posted

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.

speed3.png

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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