Switching weapons while moving
by
Sniperwolf572
Description:
This addon allows you to switch between weapons while still being able to move.
I've mashed up a proof of concept for the "Moving and switching weapons at the same time" feature. While it's kinda hacky and my config skills are rusty, hopefully someone with better knowledge of the animation system and the engine might find this useful (hint, hint).
It implements gesture versions of the default BI switching animations and relies on using the "User Action 17" and "User Action 18" controls to function. Action menu actions and keybinds for "Switch to handgun/launcher" will still use the default "stop and switch" method.
In this version, the weapon IK works so it looks nicer than in earlier videos I've shown.
Included files:
TEN_switchWeaponsWhileMoving.pbo
Usage:
Bind "Custom controls > User Action 17" to whatever you want to be your "Switch to handgun" key
Bind "Custom controls > User Action 18" to whatever you want to be your "Switch to launcher" key
(Optional, precaution) Unbind your "Weapons > Switch gun / launcher" and "Weapons > Switch gun / handgun" from your controls, you won't be needing them anymore
Be a badass
It requires keybinds for the following entries:

I've used TAB+1/2 for myself as you can see, not perfect but also not conflicting with my other keybinds. You should be able to bind it to any combination you like. I suggest unbinding the default "Switch to handgun" and "Switch to launcher" keybinds as a precaution.
Sourcecode:
You can find the
source code on GitHub. I'd welcome a review of the code and especially the config, as I might have messed up the inheritance in some way as I'm not up to speed on it.
Media:
Known issues:
The action menu actions, "Switch to handgun" and "Switch to launcher" controls still use the "stop and switch" method, as mentioned. I haven't tried to replace this yet. This remains a safeguard for me in case the addon messes up so you can still switch weapons.
Midway through the transition, the unit will reset it's weapon and camera orientation. This is due to cancelling of the default switch animation that's caused by switchWeapon. Removing the default animations would cause the action menu switching to be instant, which is kinda bad.
If you switch stances (crouch/stand) in the first part of the animation, you can sometimes cause some additional weapon transitions. I'm not quite sure why this happens yet.
Notes:
You can find the source code on GitHub. I'd welcome a review of the code and especially the config, as I might have messed up the inheritance in some way as I'm not up to speed on it.
Steam Workshop:
-
Subscribe
Credits & Thanks:
Special thanks:
Deadfast - Code changes, fixing up my shoddy config work, teaching me about quirks of the scripting scheduling
Drxi, Alejandro, Aseliot, ImClarky - Being awesome test subjects during the MP testing
Change log:
v1.4.5
- Made to be compatible with FFV.
v1.4.4
- Made the switch to and from the launcher safer by disabling it via script until the switch is done
- Signed the addon
v1.4.3
- Reduced the sliding, animation repeating and other shenanigans that happen in MP
v1.4.2:
- Switched to using functions library => removed dependency on XEH.
- Replaced spawns with calls to remove the need for checking whether we're switching - logic is now blocking so no need for that.
- Cleaned up config and fixed inheritance issue.
v1.4.1
Fixed an error that occurred while trying to switch from binocular slot weapons
v1.4
Fixed the inability to switch weapons with the keybinds we handle after team switch
Result of "player" call is cached for the duration of a switch and passed along the function chain
v1.3
Added the emulating of the default switch action while prone, was lost due to controls being switched to custom ones
Implemented lazy evaluation where applicable for unnoticeably faster decision making
v1.2
Refactored the control listening logic, making the stationary weapon switching more responsive.
v1.1
Added the $PBOPREFIX$
Added support for the mouse buttons
Removed the potential movement interruption resulting from handling the movement event
Changed the key bind actions from "handgun/switchWeapon" to "User17/User18" to prevent the default action stopping the player
Code refactoring
Forums Topic:
-
BI Forums
Enable javascript to be able to download from Armaholic please!
Thank you so god damn much for this...I have been hoping BIS will put this into the game for months
this is a big change in arma series! thx please add in core game!
o wonder why this isnt official yet
installed this last night .... won't work :( Created the folder @GunSwitch / addons / Files like your supposed to Activated it in Expansions but unfortunately its not working i'm gutted x)
Yup that`s awesome! Thanks
Excellent job! Thank you!
Thank you so much!!
it switches the weapon but goes back to the one i had in hand before
You lose a mag if you switch when you're in the middle of reloading still.
Total comments : 9, displayed on page: 9