Sniperwolf572 758 Posted June 29, 2013 (edited) Haven't been an author of one of these threads since forever. ^_^ Anyway, 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. There are some known issues that I haven't tried or been able to solve: You can fire the launcher while it's selected and transitioning (first part of the "from launcher" transitions and the last part of "to launcher" transitions). I haven't been able to figure this out, as the primary/handgun will correctly not fire if you try, the launcher seems to disregard the config parameters. I'm probably doing something wrong here. Don't blow yourself up now. (Thanks zGuba!) 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. I've not bothered to test it in MP, I've no clue how it behaves there. (Should be ok now) Binding the switch actions to mouse buttons will not work, mouse clicks are not handled, but requires a change/fix to work correctly (http://feedback.arma3.com/view.php?id=10766) (Using a different method now) 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. 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. Here's a little preview of it as it is right now: TLDR; instructions: Install the addon 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 Download (version 1.4.5): Dropbox Steam Workshop Source code on GitHub Changelog: Version 1.4.5: Made to be compatible with FFV. Version 1.4.4: Made the switch to and from the launcher safer by disabling it via script until the switch is done Signed the addon Version 1.4.3: Reduced the sliding, animation repeating and other shenanigans that happen in MP Version 1.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. Version 1.4.1: Fixed an error that occurred while trying to switch from binocular slot weapons Version 1.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 Version 1.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 Version 1.2: Refactored the control listening logic, making the stationary weapon switching more responsive. Version 1.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 Version 1.0: Initial release 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 Edited March 4, 2015 by Sniperwolf572 Version 1.4.5 released - Armaholic mirror Share this post Link to post Share on other sites
bad benson 1733 Posted June 29, 2013 very nice! i actually was going to make something like this myself but this seems to be perfect. i assume you set up the default switching anims as gestures with a proper skeleton mask? anyways. good job! will try this out and give some feedback as soon as i get home. Share this post Link to post Share on other sites
Sniperwolf572 758 Posted June 29, 2013 very nice! i actually was going to make something like this myself but this seems to be perfect. i assume you set up the default switching anims as gestures with a proper skeleton mask?anyways. good job! will try this out and give some feedback as soon as i get home. Thanks! Actually I've created new gestures that point to the default switch files, as not to modify anything existing. But yeah, masks combined with weapon IK curves seem like really powerful tools. Wasn't aware it was that flexible. :) Share this post Link to post Share on other sites
bad benson 1733 Posted June 29, 2013 Actually I've created new gestures that point to the default switch files that's what i meant. good job man. can't wait to try it. seems like it's well executed. Share this post Link to post Share on other sites
froggyluv 2136 Posted June 29, 2013 Very nice! Just curious how you press Tab+1 while holding 'W' to move forward? I tried binding it to my side mouse buttons but for some reason the soldier will revert and stop as before Share this post Link to post Share on other sites
Sniperwolf572 758 Posted June 29, 2013 (edited) Very nice! Just curious how you press Tab+1 while holding 'W' to move forward? I tried binding it to my side mouse buttons but for some reason the soldier will revert and stop as before Sorry about that, I'll have to look into the mouse buttons, it's probably due to the event handler's keyDown event. Keyboard keys should work. My Tab+1 can be pressed with 1 finger as 1 is right next to it and tab+2 requires ring finger on the tab and a slight slide up of the middle finger to reach 2. :p Edited June 29, 2013 by Sniperwolf572 Share this post Link to post Share on other sites
ck-claw 1 Posted June 29, 2013 Nice work- followed your 'Proof of concept' in the other thread! :cool: Share this post Link to post Share on other sites
Sniperwolf572 758 Posted June 29, 2013 Very nice! Just curious how you press Tab+1 while holding 'W' to move forward? I tried binding it to my side mouse buttons but for some reason the soldier will revert and stop as before Some bad news here, apparently MouseButtonDown/Up events can't be "handled", which means I can't "deny" the event which is generated by the keybind itself by returning "true" from the event itself. Share this post Link to post Share on other sites
down8 30 Posted June 29, 2013 Thank you very much!!! Share this post Link to post Share on other sites
ghostnineone 10 Posted June 29, 2013 Awesome! do you know if the fast transitions mod would mess this up? Share this post Link to post Share on other sites
froggyluv 2136 Posted June 29, 2013 Some bad news here, apparently MouseButtonDown/Up events can't be "handled", which means I can't "deny" the event which is generated by the keybind itself by returning "true" from the event itself. It's cool - time for me to learn some new OFP muscle memory anyways :p Share this post Link to post Share on other sites
ghostnineone 10 Posted June 29, 2013 This isn't working for me :( Share this post Link to post Share on other sites
Sniperwolf572 758 Posted June 29, 2013 This isn't working for me :( Are you running it with latest CBA_A3 and have correctly defined the keys from the first post? Share this post Link to post Share on other sites
ghostnineone 10 Posted June 29, 2013 Are you running it with latest CBA_A3 and have correctly defined the keys from the first post? I'm pretty sure I am. I'm not using tab 1 and tab 2. I had them assigned to ctrl R and Ctrl T, but I tried other key combinations too. Also, you said mouse clicks don't work, does it work if you assign a key to a mouse button, instead of mouse button 2,3,4, etc? Share this post Link to post Share on other sites
Sniperwolf572 758 Posted June 29, 2013 I'm pretty sure I am. I'm not using tab 1 and tab 2. I had them assigned to ctrl R and Ctrl T, but I tried other key combinations too. Just tried, looks like some keys in combos don't correctly interrupt, stop movement or conflict. For example, CTRL being tied to stance adjust, R being reload, etc. It seems to be related to multiple things with the same modifier and that I'm listening for the weapon switch action. Shift+1 seems to work ok, but Shift+R doesn't, etc. Apparently I've hit a combo with Tab+1/2 that works really well for myself. :p I'll see if I can find some workaround for this tomorrow. Try Tab+1/2 anyway, just to make sure. Also, you said mouse clicks don't work, does it work if you assign a key to a mouse button, instead of mouse button 2,3,4, etc? I'm not sure what you mean by that. Any combo that relies on the mouse buttons probably won't work as there's nothing listening for mouse buttons right now. Share this post Link to post Share on other sites
ghostnineone 10 Posted June 29, 2013 Just tried, looks like some keys in combos don't correctly interrupt, stop movement or conflict. For example, CTRL being tied to stance adjust, R being reload, etc. It seems to be related to multiple things with the same modifier and that I'm listening for the weapon switch action. Shift+1 seems to work ok, but Shift+R doesn't, etc.Apparently I've hit a combo with Tab+1/2 that works really well for myself. :p I'll see if I can find some workaround for this tomorrow. Try Tab+1/2 anyway, just to make sure. I'm not sure what you mean by that. Any combo that relies on the mouse buttons probably won't work as there's nothing listening for mouse buttons right now. I mean if I bound my mouse button to something like Shift, does that not work? and I will try that, I am also using the dev build. I forgot to mention that. Share this post Link to post Share on other sites
Sniperwolf572 758 Posted June 29, 2013 I mean if I bound my mouse button to something like Shift, does that not work?and I will try that, I am also using the dev build. I forgot to mention that. Dev build is ok, stable is for babies. :) I'm not sure really if remaping the mouse buttons to other keys will work. As long as the button doesn't have conflicting actions and the game detects it as key press instead of a mouse click it might work. Try it out and let me know. :) Share this post Link to post Share on other sites
ghostnineone 10 Posted June 29, 2013 (edited) I tried tab one and two and it doesn't work. I definitely have the newest version of CBA, it could be a conflict but I don't know with what... edit. i fixed it. edit: if i use tab 1 it works, if i assign tab to one of my mouse buttons it works :D I have a logitech g500 Edited June 29, 2013 by ghostnineone Share this post Link to post Share on other sites
toiletguy 1 Posted June 30, 2013 You should try to put it up on Armaholic. :rolleyes: Share this post Link to post Share on other sites
.kju 3244 Posted June 30, 2013 Maybe some day BI fixes it.. displayAddEventHandler 'MouseButtonDown' with return true, still executes mouse action --- Very nice work there! Share this post Link to post Share on other sites
Sniperwolf572 758 Posted June 30, 2013 (edited) I tried tab one and two and it doesn't work. I definitely have the newest version of CBA, it could be a conflict but I don't know with what...edit. i fixed it. edit: if i use tab 1 it works, if i assign tab to one of my mouse buttons it works :D I have a logitech g500 Excellent! Can you share what made the TAB+1 work in case other people run into that same issue? ;2428823']Maybe some day BI fixes it..displayAddEventHandler 'MouseButtonDown' with return true' date=' still executes mouse action[/url'] --- Very nice work there! Thank you. :) I wasn't aware it was yet another age old issue. :( I've also reported it last night to the BI feedback tracker here, fingers crossed that we'll get it solved this time around. Edited June 30, 2013 by Sniperwolf572 Share this post Link to post Share on other sites
enex 11 Posted June 30, 2013 Big thanks for release!You are my hero. Also upvoted. Share this post Link to post Share on other sites
Dwarden 1125 Posted June 30, 2013 nice one, once again :p Share this post Link to post Share on other sites
ghostnineone 10 Posted June 30, 2013 Excellent! Can you share what made the TAB+1 work in case other people run into that same issue I thought I copied and pasted the addon but I didn't :blush: Also is there any work around to using other keys? I have tab now instead of ctrl on my mouse button, i had a lot of things attached to the ctrl key, so something like ctrl r or ctrl middle mouse or something would be really nice Share this post Link to post Share on other sites
Codeine 1 Posted July 1, 2013 Where do i put the file? And what is "CBA_A3 and keybinds" mean? Share this post Link to post Share on other sites