AltSwing on Left Mouse Button & Throwing/Shooting



  • A number of people seem to prefer the alternate swing animation over the regular one.

    The problem with binding alternate swing to your left mouse button (LMB) is that you can’t throw throwables or shoot bows and crossbows with LMB anymore. You also can’t press Alt+LMB to get a regular swing instead of the altswing.

    It would be nice if TBS could fix/change this. Since bows/crossbows/throwables don’t have alt attacks, making altswing behave like swing (shoot/throw) wouldn’t interfere with anything else. Alt + Perform Alternate Swing/Overhead = regular swing/overhead also shouldn’t mess with other things at first glance.

    UPDATED VERSION BELOW

    ~~Until then I have written a small AutoHotkey snippet that fixes the former of these problems. When using it, keep “Primary Attack” bound to LMB in game and/or adjust the script to your own config.

    #IfWinActive ahk_class LaunchUnrealUWindowsClient
    ; replace default swing with alt swing but still throw with LMB
    ; (needs #UseHook or $ modifier)
    $*LButton::SendInput {Blind}{LAlt down}{LButton down}{LAlt up}
    $*LButton Up::SendInput {Blind}{LButton up}
    

    Here’s my full AutoHotkey setup for Chivalry.

    Update: Fixed a bug where pressing LMB would interrupt/prevent sprinting. Removed second snippet as it would be difficult to fix the same bug in that one while its functionality doesn’t seem to be in demand. If you would like to be able to press Alt+LMB to perform a regular attack instead of an alt attack, just contact me and I’ll see if I can get it to work.

    Update 2: Second snippet is back, now fixed. Using the following bindings will yield the same results as above, with the added option of pressing/holding Alt+LMB for a regular swing instead of an altswing:

    ; swap default swing with alt swing but still shoot/throw with LMB
    ; (needs #UseHook or $ modifier)
    ; - set a secondary ingame bind for "Primary Attack" if you want a single button regular swing
    $*LButton::
        If GetKeyState("LAlt") ; if alt is pressed
            SendInput {Blind}{LAlt up}{LButton down}
        Else
            SendInput {Blind}{LAlt down}{LButton down}{LAlt up}
        return    
    $*LButton Up::SendInput {Blind}{LButton up}
    

    My own setup on github has been updated accordingly.~~



  • I think from TB’s side, they could make different keybinds for Primary Attack and Regular Swing. Right now, as you said, Primary Attack is the main button for regular slash, shoot arrows and bolts, throw projectiles, etc.

    I personally don’t mind because I have a mouse that has enough buttons to bind all 5 attacks and still has buttons to spare for parry, bash, crouch, etc.



  • @osta2501:

    I personally don’t mind because I have a mouse that has enough buttons to bind all 5 attacks and still has buttons to spare for parry, bash, crouch, etc.

    What kind? The Naga comes to mind but I imagine its buttons / their positions would be a bit fiddly for Chivalry?



  • Wouldn’t the alt-for-regular-swing work like this:

    $*Lbutton::
       SendInput {Blind} ;<-- I don't even know what this does :P
       If !GetKeyState("LAlt", "P") ;if alt isn't pressed perform alternate attack
       {
          SendInput {LAlt Down}
          SendInput {LButton down}
          SendInput {LAlt Up}
       }
       else
       {
       SendInput {x down} ; <- x=the key you've bound the regular attack to in-game
       }
    return
    
    

    …and same logic for $*LButton Up::



  • @Reubot:

    Wouldn’t the alt-for-regular-swing work like this:

    $*Lbutton::
       SendInput {Blind} ;<-- I don't even know what this does :P
       If !GetKeyState("LAlt", "P") ;if alt isn't pressed perform alternate attack
       {
          SendInput {LAlt Down}
          SendInput {LButton down}
          SendInput {LAlt Up}
       }
       else
       {
       SendInput {x down} ; <- x=the key you've bound the regular attack to in-game
       }
    return
    
    

    …and same logic for $*LButton Up::

    I had something similar, also using GetKeyState, but ran into a bug. However, since I reset my Chivalry config today, another issue I had with a different script miraculously disappeared. It seems there was something wrong with my modified config.

    Since interest in having LAlt trigger a regular swing has been expressed both here and on reddit, I’ll try to get it work and will post my results here.



  • @Reubot:

    Wouldn’t the alt-for-regular-swing work like this:

    $*Lbutton::
       SendInput {Blind} ;<-- I don't even know what this does :P
       If !GetKeyState("LAlt", "P") ;if alt isn't pressed perform alternate attack
       {
          SendInput {LAlt Down}
          SendInput {LButton down}
          SendInput {LAlt Up}
       }
       else
       {
       SendInput {x down} ; <- x=the key you've bound the regular attack to in-game
       }
    return
    
    

    …and same logic for $*LButton Up::

    The issue with the code you posted (and with what I had) revolves around {Blind}. Prefixing a Send command with {Blind} causes it to not release all modifiers (which is the default behaviour) before sending the command. Since your SendInput {x down} is not prefixed in this way, it will release all modifiers, including shift, effectively stopping sprint. If you do prefix it, LAlt won’t be released, resulting in an alternative swing instead of a regular one in the else case.

    The solution is relatively simple. The only reason it didn’t work for me before is because of an error in my config files. I’ve updated my original post with the new, fixed version.



  • Just found this. Where do I paste this code? And would it work for a gamepad? I assume I’d have to change Lbutton for RightTrigger or some such?



  • bump. Where would I put this Autohotkey thing?



  • Updated, cleaner implementation:

    If you just want LMB = AltSwing + Shoot, open your UDKGame.ini, find the line for LeftMouseButton (Ctrl+F) and replace it with this:

    Bindings=(Name="LeftMouseButton",SecondaryKey=,Command="GBA_AltAttack0|GBA_Fire|GBA_SpectatorNext",Control=False,Shift=False,Alt=False,bIgnoreCtrl=False,bIgnoreShift=False,bIgnoreAlt=False,Flag="KBFlag_Weapon|KBFlag_Utility",FriendlyName="PLeftAttack|SpectateNext")
    

    That’s it, you don’t need AutoHotkey for this anymore.

    If you want the above PLUS Alt+LMB = Regular Swing, download AutoHotkey and create and run a script that contains the following:

    *!LButton::Send {Blind}{LAlt up}{XButton2}
    

    Also add to / change in your UDKGame.ini:

    Bindings=(Name="ThumbMouseButton2",SecondaryKey=,Command="GBA_Fire",Control=False,Shift=False,Alt=False,bIgnoreCtrl=False,bIgnoreShift=False,bIgnoreAlt=False,Flag="KBFlag_Weapon",FriendlyName="Swing")
    

    This assumes you use Left Alt for “Perform Alternate Attack” (modifier) and ThumbMouseButton2/XButton2 (the latter is AutoHotkey’s name for that button) for Regular Swing / Primary Attack. You can change these to your preference by making changes in both UDKGame.ini and the script above.

    There is an issue with all 4 implementations I’ve posted in this thread. If you LMB=>Feint=>LMB instantly, you will feint an AltSwing into a regular swing (expected behaviour would be feint AltSwing into AltSwing).

    This is due to a huge defect in the game called command queueing that the Chivalry devs have been refusing to fix for many months. It’s what causes you to sometimes attack again long after you’ve stopped pressing that button. As I said this is a problem with the way the game processes input, so I cannot fix this for you guys at all :/

    @imdahman:

    bump. Where would I put this Autohotkey thing?

    You paste it into a .ahk file (create one) and run it (double click with AutoHotkey installed). Sorry for the late response.


Log in to reply
 

Looks like your connection to Torn Banner Forums was lost, please wait while we try to reconnect.