Keeping sprint (shift) pressed as long as any movement (wasd) is maintained Topic is solved

Ask gaming related questions
ouboss
Posts: 14
Joined: 10 Dec 2016, 04:24

Keeping sprint (shift) pressed as long as any movement (wasd) is maintained

10 Jun 2018, 15:16

Titanfall 2 is my gold standard for sprinting movement, and I'm trying to transfer it to other games. In Titanfall 2, one tap of sprint will keep you in a sprint state even if you are strafing directly left or right at the lesser, pure strafing speed. Once you return to any forward or diagonal forward movement, full sprint resumes. To release sprint, one has to release all movement keys or, I believe 's' cancels it as well but I don't remember 100%.

The following, based off of an evilC script, is getting me fairly close, but I'm finding that my w-aw-a-aw-w seems to reset movement to walk upon returning to w. Any ideas for improving this anyone?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
Nextron
Posts: 1148
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Keeping sprint (shift) pressed as long as any movement (wasd) is maintained  Topic is solved

10 Jun 2018, 16:07

EvilC using KeyWait? :think: :wtf:

You could try something like this:

Code: [Select all] [Download] GeSHi © Codebox Plus

*LShift::Send {Blind}{LShift down}
*LShift up::
*~w up::
*~a up::
*~s up::
*~d up::
If GetKeyState("LShift") && !GetKeyState("w","p") && !GetKeyState("a","p") && !GetKeyState("s","p") && !GetKeyState("d","p") && !GetKeyState("LShift","p")
Send {Blind}{LShift up}
Return
The more I know:
The more I know,
I know nothing.
ouboss
Posts: 14
Joined: 10 Dec 2016, 04:24

Re: Keeping sprint (shift) pressed as long as any movement (wasd) is maintained

10 Jun 2018, 18:51

Above code is perfection, minus the random LControl's I'm seeing whenever alt is thrown into the mix, reproducible when I press shift+alt+any of wasd.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

ouboss
Posts: 14
Joined: 10 Dec 2016, 04:24

Re: Keeping sprint (shift) pressed as long as any movement (wasd) is maintained

11 Jun 2018, 06:53

Interesting read. Was able to get it working perfectly afterwards. Thanks.

Return to “Gaming”

Who is online

Users browsing this forum: StonerSouls and 7 guests