Jump to content

REQUEST: Walking/Running/Sprinting mod, or a tutorial to do it myself


BionicDance

Recommended Posts

We all know Bethesda games aren't great when it comes to getting around; you're always either moving too fast or too slow. Walking is unbearably slow while running--at least in a non-combat setting--is like being late for your flight at the airport running; neither one is very useful.

There are mods out there that will adjust your speed, but they're all global changes, so if walking speed is faster, so is sprint and running. It looks like that's all you can do, that there are not separate variables for walking speed and running speed, for example. And that kinda stinks, cuz none of the mods out there can get the speeds right; fixing one will always break the other.

 

So what I'm hoping is that there is an easy way to do it by checking what state the player is currently in and throw a few if/then statements at it:

If [player movement state] = "walk" then player.setav speedmult 153

If [player movement state] = "run" then player.setav speedmult 100

...or something similar. And make it easy to custom-adjust those values

 

The problem is...I've never made a mod before. For all I know, what I hypothesized above isn't possible; my coding experience ends a few decades prior to today.

So I'm hoping someone can either point me in the right direction to start learning how, or just make this mod for me. Either will do.

Thanks! 

Link to comment
Share on other sites

Note: I haven't tested this script

This is assuming this script would be attached to an object. Would require minor changes to help it work in other circumstances (as a consumable item, as a quest script, etc.) It hasn't been tested, but this should work with minimal alteration. If you choose to go for it, make sure you implement a cleanup function somewhere that unregisters the event registrations and sets the vars to None so it doesn't cause any performance problems if it's ever uninstalled.

ScriptName changeplayerspeed Extends ObjectReference
{Changes Player sprint speed multiplier, but no other types of movement are affected}
 
ActorValue Property SpeedMult Mandatory Const Auto
{ActorValue SpeedMult holds speed multiplier}
 
float Property newSprintSpeed Auto
{This is the new speed multiplier we want to set for the Player}
 
;variables needed
Actor PlayerRef
float defaultSprintSpeed
 
Event OnLoad()
    ;init vars
    PlayerRef = Game.GetPlayer()
    defaultSprintSpeed = PlayerRef.GetBaseValue(SpeedMult)
 
    ;Register for animation events
    If RegisterForAnimationEvent(PlayerRef, "SprintStart")
        Debug.Trace("Registered for SprintStart event successfully")
    Else
        Debug.Trace("Failed to register for SprintStart event")
    EndIf
   
    If RegisterForAnimationEvent(PlayerRef, "SprintStop")
        Debug.Trace("Registered for SprintStop event successfully")
    Else
        Debug.Trace("Failed to register for SprintStop event")
    EndIf
EndEvent
 
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
{check if player is in sprint animation and set desired speed}
    If akSource == Game.GetPlayer()
        If asEventName == "SprintStart"
            PlayerRef.SetValue(SpeedMult, newSprintSpeed)
        ElseIf asEventName == "SprintStop"
            PlayerRef.SetValue(SpeedMult, defaultSprintSpeed)
        EndIf
    EndIf
EndEvent
Link to comment
Share on other sites

SpeedMult is an actor value that you must set in creation kit after attaching the script - should work with just pressing the Auto assignment button since it's the same name as the ActorValue you would be targeting.

newSprintSpeed is a property that you can set in CreationKit after attaching the script - makes it easier and more robust than hard coding a value.

 

edit: If you don't want to do it yourself, I can see what I can do to make this a working mod. Just let me know precisely what you wanted it to do and I'll see what I can do when I get some time.

Edited by COCayneT
Link to comment
Share on other sites

I can see that it may not be as easy and straightforward as I thought; I'd assumed that the player walking, running, and sprinting would be distinct states which could trigger a speed change when activated. Hrm.

 

Anyway, the run speed is fine. The sprint speed is fine.

But the walk speed is unbearably slow, especially in first person. I forget what the optimal speed was for walking--not too fast, but not like trying to walk through chest-high Jell-O™, either--but it was something like 1.5x or 1.75x of normal; I'd have to experiment to find what's best. I'm honestly surprised that each movement state isn't its own settable variable.

I understand that higher speeds in 3rd person will trigger the run animation even when in walk mode, but I almost exclusively play in first person, so I'm cool with it.

 

I'd definitely appreciate an assist on this one, if you have the time and patience for it. Thanks. 🙂

Link to comment
Share on other sites

There IS a form called Human_Default_MT which is a movement type form that lists the base values for HumanRace based actors. It lists the walk, run, and sprint speeds for normal/sneaking/swimming etc. The issue is, it affects all human race actors including the player and all npcs. You could always duplicate it and make the Player actor use the duplicate form instead, then set whatever values you wanted for the various states but this is bound to conflict with all sorts of other mods. It's best practice to never alter vanilla forms if possible because no matter how big the change is, the last mod to alter that form will override all the others which means anything else that alters or changes player will likely not work correctly in this case.

This is why I provided the script. Using a script attached to an item/object/quest etc. allows you to change the values at runtime. The only downside is, the Actor form doesn't have any events for IsSprinting, IsWalking, etc. (though it does have IsSneaking) which means you would have to find another way to detect when the player goes from walk to sprint and vice-versa. The simplest way I could figure was to listen for animation events from the player actor reference.

 

Anyway, I'll take a look at it when I get some time, but it may be a while. My son is starting school so I will  be unavailable to work on these things for a little bit. If you haven't figured it out or someone else hasn't beaten me to it, I will gladly put some time into figuring this one out for you.

Link to comment
Share on other sites

I wonder how it knows to switch from running to walking when CapsLock is pressed, or what is toggled by pressing it; the game has to be doing something, aye?

 

Anyway, thanks, and I totally understand that family comes first. I hope school goes well for him. 🙂

Link to comment
Share on other sites

There's a lot of default objects/actions that aren't directly exposed via papyrus. My gravity switch is a good example. To make it possible for the pilot seat to be used during zero gravity the seat has to have the keyword AllowZeroGUse which is handled by thr default object AllowZeroGUseDO (its something like that, don't remember off the bat) 

 

I know there is a default movement action object too. so I'm guessing its handled there. so yeah, the game is doing something, but we don't have direct access to certain things unless we alter the vanilla objects (heavy conflict probability) or we work around it with scripts using something we DO have access to. (In the gravity switch case I had to monitor when the player wanted to sit, quickly set the gravity from 0.0 to 0.0001 so the game wouldn't look at it as being in Zero G, send another activation event from the script, then setting it back to 0 when the player wanted to get up after the animation event of getting up was completed) 

 

To the player its pretty seamless, but if I didn't have to worry about conflicts with the cockpit form, I could have done it all by just adding the keyword to the object instead.

 

a big reason script extenders are still used after the creation kits for skyrim and fallout came out is because it hooks into and exposes a lot of default native functions that aren't accessible directly from vanilla papyrus scripting.

Link to comment
Share on other sites

also, it may be possible to do what you want in a better way, or one that fits your need specifically better. If I'm making a mod, its with the thought of making it as compatible with other mods, updates, etc. as possible. So I will likely go a different way than what would work better for you individually. 

Edited by COCayneT
Link to comment
Share on other sites

  • Recently Browsing   0 members

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