RELEASED [SMAPI 0.37+] Sprint! A faster, stamina draining run.

Discussion in 'Gameplay Mechanics' started by Yoshify, Mar 6, 2016.

  1. Yoshify

    Yoshify Intergalactic Tourist

    As requested by a fellow farmer!

    Sprint is a faster version of run that will drain your stamina over time. It's fully configurable, included in the config are the following values:

    SprintKey=X - X by default as that was requested, but you can change it to whatever!
    SprintToggle=false - false (off) by default, enabling this (true) will make the sprint toggleable.
    SpeedModifier=1 - The amount to be added onto the base speed.
    StaminaDrainAmount=1 - The amount of stamina drained.
    StaminaDrainRateInSeconds=5 - The rate of which the stamina is drained, in seconds.

    Please note that this requires the latest SMAPI to use. Simply drag and drop the contents of the downloaded zip into the Mods folder in your Stardew Valley directory.

    Please report any bugs to me, and as always, enjoy! :)

    Downloads
    Download
    Source

    Changelog
    v1.1.2 (09/03/2016):

    • Fixed bug where Stamina would continue draining when paused/idle.
    v1.1.1 (08/03/2016):
    • Fixed bug where Control/Shift keys weren't recognised.
    v1.1 (08/03/2016):
    • Added a toggle option.
    • Config file now contains every accepted KeyCode, simply look up the one you want!
    v1.0 (07/03/2016):
    • Release.
     
      Last edited: Mar 9, 2016
      Davrial, LaViel, hplek and 5 others like this.
    • Kulturbanause

      Kulturbanause Phantasmal Quasar

      Wow hope other modders are trying to make their mods compatible with latest SMAPI soon.

      Anyways very nice mod i test it right now.
       
      • Dratro

        Dratro Big Damn Hero

        Works like a charm! Just need to balance it in a good way and it's what i needed! Ty OP! :*
         
        • Yoshify

          Yoshify Intergalactic Tourist

          No worries, glad it was what you were looking for! :)
           
            Dratro likes this.
          • Khranos

            Khranos Scruffy Nerf-Herder

            Very nice, thank you! The default "run" seemed like the speed walking should have been, so something faster was most definitely needed.

            I feel this mod also works really well with Natfoth's stamina regen mod, with a little value tweaking of course.
             
            • Randonx

              Randonx Scruffy Nerf-Herder

              Can't seem to get this mod to work with different keys. I tried changing it to something simple, like 'q'. Doesn't seem to work. Also, would it be possible to make it work on the Shift key (as long as I rebind shift in game not to walk)
               
              • sweetangel20

                sweetangel20 Starship Captain

                Any chance of making it a toggle key instead of one you just hold down?
                 
                • mistersnuggler

                  mistersnuggler Tentacle Wrangler

                  Nice! This is pretty similar to the mod that I was trying to make, but I got stuck on making the key used to sprint changeable... But I see that you've beaten me to getting the stamina drain :). Will you be adding a stamina regen at some point? I was thinking it would be pretty nifty if you could regain a portion of stamina lost based on how long you were sprinting.
                   
                  • mistersnuggler

                    mistersnuggler Tentacle Wrangler

                    It looks like you need to have the capital character, so instead of "q" use "Q". I just did a quick test and the capital "Q" works for me! I assume that the result will be similar for any other lettered character, as long as it's capitalized.

                    If it helps, I also confirmed that lowercase "q" does not work.
                     
                    • Yoshify

                      Yoshify Intergalactic Tourist

                      It needs to be a capital character like Mistersnuggler said. :)

                      I can add that option in for you, yes!

                      Natfoth already has a configurable stamina regen mod so I feel it would be kinda cheap taking his mod like that. I advise you check it out!
                       
                      • cantorsdust

                        cantorsdust Existential Complex

                        Added to mod list!
                         
                        • Kipex

                          Kipex Orbital Explorer

                          Love the mod and I got it working with the default X button. However, I can't seem to get it to work with Left Control even trying a bunch of different combinations of Control/CTRL/LeftControl/... capitalized or not.

                          Can you put up a list of the corresponding character/key codes, especially for left control? I'm sure others would find this helpful too as shift/ctrl/alt are common for these types of functions in games. Thanks!
                           
                          • Yoshify

                            Yoshify Intergalactic Tourist

                            I'll try do that yes, I believe the name of the key you're looking for is ControlKey, although LeftControl should of worked. I will look into this. :)
                             
                              Last edited: Mar 7, 2016
                            • Yoshify

                              Yoshify Intergalactic Tourist

                              Updated with requests!

                              v1.1 (08/03/2016):
                              • Added a toggle option.
                              • Config file now contains every accepted KeyCode, simply look up the one you want!
                               
                                sweetangel20 and Kipex like this.
                              • Kipex

                                Kipex Orbital Explorer

                                Thanks for the new version, but even after updating the mod I tried all of the following with no success:
                                • LeftShift
                                • RightShift
                                • LeftControl
                                • RightControl
                                • LeftAlt
                                • RightAlt
                                But for example CapsLock worked fine. Great if you could look into these specific buttons that seem to refuse to work :) Also gave "ControlKey" a shot but nope. Also made sure in my game options there shouldn't be any duplicates for a button like LeftControl.
                                 
                                • Yoshify

                                  Yoshify Intergalactic Tourist

                                  That is incredibly strange. I'll get back to you on that one!
                                   
                                  • mistersnuggler

                                    mistersnuggler Tentacle Wrangler

                                    I actually ran into this problem with my mod. You'll want to use "17" for control buttons and "16" for shift buttons. I just tested using "SprintKey=17" and it works for both left and right controls.

                                    Also, I noticed that (for whatever reason) I wasn't able to differentiate between left and right control buttons, this also seemed to hold true for shift buttons. In addition I found that the left and right alt buttons don't even register.
                                     
                                      Kipex likes this.
                                    • Kipex

                                      Kipex Orbital Explorer

                                      Tried and "17" indeed works for both Ctrl, which is perfectly fine. Weird, but it works so thanks for that!
                                       
                                      • Yoshify

                                        Yoshify Intergalactic Tourist

                                        I find it really weird that this works and I'll need to look into it further. It should be matching the keycodes string as I'm getting the keydown/keyup events fired from the named keys. It's either a bug or a quirk with how SDV handles its keyboard events. Either way, glad to hear it's working!

                                        EDIT:

                                        So every Key is properly returned by its name besides both Control and Shift keys, which, for some reason, are returned by their numeric constants. I've made a little workaround in the new update so that it'll work properly with the named keys in the config now. :)

                                        v1.1.1 (08/03/2016):
                                        • Fixed bug where Control/Shift keys weren't recognised.
                                         
                                          Last edited: Mar 8, 2016
                                        • Randonx

                                          Randonx Scruffy Nerf-Herder

                                          You're the best.
                                           
                                            sweetangel20 likes this.

                                          Share This Page