lofgren Posted February 28, 2021 Share Posted February 28, 2021 I've been trying to search Google for this, but the results are too cluttered with other definitions of "run" and with players trying to solve bugs. Has anybody found a nice clean method for preventing the player from running? Specifically I want them to be unable to run when under the effects of a particular spell. So far the only method I have found is encumbering them, which also slows their walking speed. Any help would be appreciated. Thanks. Link to comment Share on other sites More sharing options...
Zorkaz Posted February 28, 2021 Share Posted February 28, 2021 You can disable running by using an InputDisableLayer.https://www.creationkit.com/fallout4/index.php?title=InputEnableLayer_Script At least in Falllout 4 Link to comment Share on other sites More sharing options...
lofgren Posted February 28, 2021 Author Share Posted February 28, 2021 THANK YOU. I have been searching for a solution to this problem for literally years and I never even knew what an input layer was. Link to comment Share on other sites More sharing options...
lofgren Posted February 28, 2021 Author Share Posted February 28, 2021 Aaaaand spoke too soon. I never knew what an input layer was because it is a Fallout thing, not a Skyrim thing. Link to comment Share on other sites More sharing options...
dylbill Posted February 28, 2021 Share Posted February 28, 2021 The simplest way I can think is to make the player over encumbered by either subtracting from carry weight or adding to inventory weight. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 1, 2021 Share Posted March 1, 2021 You could do what my Controller Walk Run Toggle mod does. Change the player's speed multiplier value. When done as a magic effect, it might show up in the magic window under status effects (not sure - would need to be tested). 25 to 35 is a good range for walking when adjusting the speedmult value. But given that other mods could change the value, it might be best to get the starting value and subtract the target value and then Mod the remainder away while storing it to add back when the effect ends. Link to comment Share on other sites More sharing options...
lofgren Posted March 1, 2021 Author Share Posted March 1, 2021 Doesn't the PC still run when you change their speed modifier, just slower? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 1, 2021 Share Posted March 1, 2021 As the speed rate is reduced the animation matches the rate of movement. Eventually, "run" (i.e. full press of the controller stick) visually becomes "walk". The only real concern with this approach is sprint. The sprint animation does not get affected but the speed rate for sprint does. So... the player could try to sprint and end up with a fast sprint animation while moving a disproportionate amount of distance (i.e. almost running in place). The only way to prevent sprint is to use the encumbered approach. If by run you meant sprint, changing the carry weight and / or inventory weight is the only viable approach. If by run you meant default full forward speed, changing the speed multiplier may be a viable approach depending upon usage. Link to comment Share on other sites More sharing options...
ReDragon2013 Posted March 1, 2021 Share Posted March 1, 2021 (edited) Afaik player is able to run until his stamina is gone. By using this approach you could attach a script to your spell effect and use next script. Maybe it works for you. lofgPlayerNotRunningEffectScript Scriptname lofgPlayerNotRunningEffectScript extend ActiveMagicEffect ; https://forums.nexusmods.com/index.php?/topic/9708733-prevent-the-player-from-running/ Bool bSpellActive ; [default=False] ; -- EVENTs -- EVENT OnEffectStart(Actor akTarget, Actor akCaster) IF (akTarget == Game.GetPlayer()) ; just a safety condition bSpellActive = TRUE RegisterForSingleUpdate(1.0) ; first time for calling OnUpdate() event ENDIF ENDEVENT EVENT OnEffectFinish(Actor akTarget, Actor akCaster) bSpellActive = False ENDEVENT EVENT OnUpdate() actor player = Game.GetPlayer() ; get it once here ; https://www.creationkit.com/index.php?title=GetActorValue_-_Actor float f0 = player.GetActorValue("Stamina") ; obtains players current stamina, before changing float f = f0 bool bOK = player.IsRunning() ; set our break condition WHILE (bOK) f = f * 0.5 ; reduce by 50 percent, 0.75 -> reducing by 25%, 0.25 -> reducing by 75% player.DamageActorValue("Stamina", f) ; reduce players stamina Utility.Wait(1.0) IF ( bSpellActive ) ; spell effect is still running bOK = player.IsRunning() ELSE ; spell effect has been finished by time bOK = False ENDIF ENDWHILE ; https://www.creationkit.com/index.php?title=RestoreActorValue_-_Actor f = player.GetActorValue("Stamina") ; obtains players current stamina, after reduction IF (f < f0) player.RestoreActorValue("Stamina", f0 - f) ; restore players stamina ENDIF IF ( bSpellActive ) RegisterForSingleUpdate(1.0) ; register again for this event ENDIF ENDEVENT Edited March 1, 2021 by ReDragon2013 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 1, 2021 Share Posted March 1, 2021 @lofgrenUse IsSprinting() in place of IsRunning() in ReDragon2013's code and you'll be set for trying to prevent the player from sprinting. IsRunning() does not return whether the player is sprinting or not and it is sprinting that is governed by stamina. Running as far at the game is concerned is the normal forward movement. Probably best to get a definition of what you mean by "run" as I fear there has been some confusion. Link to comment Share on other sites More sharing options...
Recommended Posts