Starker 8 Posted January 8, 2019 The "Raise Weapon" key binding does not function how I think it should. I want to attempt to fix this with scripting, but I don't know much about SQF. I want to make a script that will enable the following: Holding the right mouse button raises the weapon (combat pace stance, weapon is shouldered, but the sights are not being looked through). While the weapon is raised, releasing the right mouse button for less than 0.2 seconds then holding it again will enter optics. Releasing the mouse button for more than 0.2 seconds under any circumstances lowers the weapon all the way (weapon is down and not shouldered, relaxed carry position.) If the weapon is shouldered for any reason while the right mouse button is not held, then the weapon will lower. This final bit is necessary because opening the inventory, vaulting, exiting vehicles, and rising from prone will shoulder the weapon. I have no code yet because I am incompetent with SQF and must read up. I have written a pseudocode. Work in progress: Comment blocks start with /* and end with */ and denote portions that I have not figured out to code yet. if (weaponLowered player = 1) then ( /*right mouse button is bound to*/ tempRaiseWeapon ) if (/*right mouse button has been released for less than x seconds*/) then ( if (weaponLowered player = 0) then ( /*right mouse button is bound to*/ opticsTemp ) ) if (/*right mouse button has been released for more than x seconds*/) then ( /*lower the player's weapon*/ ) weaponStuckUp = ((weaponLowered player = 0) and /*right mouse button is up*/) if (weaponStuckUp = 1) then ( /*lower the player's weapon*/ ) /*loop everything above*/ Any help would be very appreciated. Share this post Link to post Share on other sites
Dedmen 2714 Posted January 8, 2019 4 hours ago, Starker said: I want to attempt to fix this with scripting You can't. That's engine code, you cannot just fix that with scripts. Share this post Link to post Share on other sites
Von Quest 1163 Posted January 8, 2019 If you are interested, we currently use PGP mapping software for an XBox Controller for the PC. It's AMAZING! It's a bit steeper learning curve, but worth it. http://pinnaclegameprofiler.com Share this post Link to post Share on other sites
Starker 8 Posted January 9, 2019 16 hours ago, Von Quest said: If you are interested, we currently use PGP mapping software for an XBox Controller for the PC. It's AMAZING! It's a bit steeper learning curve, but worth it. http://pinnaclegameprofiler.com Can you use this to map the mouse to a virtual mouse or keyboard? I am not interested in using a gamepad. Share this post Link to post Share on other sites
Starker 8 Posted January 9, 2019 18 hours ago, Dedmen said: You can't. That's engine code, you cannot just fix that with scripts. After some research, I see what you mean. There seem to be no SQF commands that alter weapon position. This is odd because there are commands that alter other things like stance and running speed. I don't have to use scripts to do it. ACE Team made their own key bindings that cause player movements (vaulting, hand signals) so the engine code can be changed. Can new key bindings be made that emulate "Raise Weapon" and "Optics Temporary" with small changes? Side question: Why has this bug persisted for so long in the game? Did BI actually intend for "Raise Weapon" to lower the weapon when held instead of raising it? That boggles my mind. Share this post Link to post Share on other sites
Noblezim711 11 Posted January 9, 2019 They just use different animations than the default, and keybind them over the default ones. They are already hard coded into the game. If you want to change the animations, then you would have to make a custom model, and import it into the game as a MOD. But then you wouldn't be able to use it on server you don't own, unless it had it installed or let you run whatever mod you want. You can view the Animations available in ARMA 3 by entering the editor, placing a unit, clicking "play scenario", then pressing the Escape key, and clicking "Animations". I'm not trying to be rude, but you need to do a lot of studying before you can try to do stuff like what you're asking. I suggest you start with something simple, like a script that teleport s you to a point. Share this post Link to post Share on other sites
Dedmen 2714 Posted January 9, 2019 2 hours ago, Starker said: that cause player movements (vaulting, hand signals) so the engine code can be changed Those are custom animations and gestures. Has nothing to do with changing engine code. Share this post Link to post Share on other sites
killzone_kid 1331 Posted January 9, 2019 The logic of Sec Mouse Btn operation is unclear from OP's post. However if you unbind Sec Mouse Btn you can use the following code to raise and lower the weapon with it: finddisplay 46 displayAddEventHandler ["MouseButtonDown", { if (_this select 1 == 1) then { player action [["WeaponOnBack", "WeaponInHand"] select weaponLowered player, player]; }; }]; 1 Share this post Link to post Share on other sites
Dedmen 2714 Posted January 9, 2019 2 minutes ago, killzone_kid said: "WeaponOnBack" WeaponOnBack is lowering the weapon? I love Arma. 1 2 Share this post Link to post Share on other sites
Starker 8 Posted January 10, 2019 20 hours ago, noblezim711 said: They just use different animations than the default, and keybind them over the default ones. They are already hard coded into the game. If you want to change the animations, then you would have to make a custom model, and import it into the game as a MOD. But then you wouldn't be able to use it on server you don't own, unless it had it installed or let you run whatever mod you want. You can view the Animations available in ARMA 3 by entering the editor, placing a unit, clicking "play scenario", then pressing the Escape key, and clicking "Animations". I'm not trying to be rude, but you need to do a lot of studying before you can try to do stuff like what you're asking. I suggest you start with something simple, like a script that teleport s you to a point. You're not coming off as rude. I asked because I didn't remotely know how intensive this would be. I am not a coder and I don't want to mess with anything beyond scripting. I have done scripting related to spawning enemies, giving them waypoints, triggers, changing factions, but nothing that adds key bindings. Share this post Link to post Share on other sites
Dedmen 2714 Posted January 10, 2019 Adding keybinds like "key pressed" or "key released" is easy. But if you want "key held for a second" and similar you have to code that manually. On 8.1.2019 at 6:34 AM, Starker said: while weapon is raised I wouldn't know how to detect that. On 8.1.2019 at 6:34 AM, Starker said: while in optics Something about being in gunner view, I think that's possible but also don't know how. Certainly not a easy thing you chose for a beginner. Might be easier to just be more vocal towards BI about that bug ^^ Share this post Link to post Share on other sites
Noblezim711 11 Posted January 10, 2019 6 hours ago, Starker said: You're not coming off as rude. I asked because I didn't remotely know how intensive this would be. I am not a coder and I don't want to mess with anything beyond scripting. I have done scripting related to spawning enemies, giving them waypoints, triggers, changing factions, but nothing that adds key bindings. Stick with it, it seems like you got the bug now. Everyone started off like you, and grew into what they are today. Just keep pushing yourself to try to do new things, and keep asking questions. 1 Share this post Link to post Share on other sites
killzone_kid 1331 Posted January 10, 2019 3 hours ago, Dedmen said: I wouldn't know how to detect that !weaponLowered Share this post Link to post Share on other sites
Dedmen 2714 Posted January 10, 2019 41 minutes ago, killzone_kid said: !weaponLowered Okey. I'll go take a nap. Seems like I need it. Share this post Link to post Share on other sites
Starker 8 Posted January 14, 2019 On 1/9/2019 at 12:57 AM, killzone_kid said: The logic of Sec Mouse Btn operation is unclear from OP's post. However if you unbind Sec Mouse Btn you can use the following code to raise and lower the weapon with it: finddisplay 46 displayAddEventHandler ["MouseButtonDown", { if (_this select 1 == 1) then { player action [["WeaponOnBack", "WeaponInHand"] select weaponLowered player, player]; }; }]; Thanks, I will try to implement this. If you tell me specifically what doesn't make sense in my explanation, I may be able to fix it. I currently cannot think of a way to make it more clear. Share this post Link to post Share on other sites
Starker 8 Posted January 19, 2019 On 1/9/2019 at 12:57 AM, killzone_kid said: The logic of Sec Mouse Btn operation is unclear from OP's post. However if you unbind Sec Mouse Btn you can use the following code to raise and lower the weapon with it: finddisplay 46 displayAddEventHandler ["MouseButtonDown", { if (_this select 1 == 1) then { player action [["WeaponOnBack", "WeaponInHand"] select weaponLowered player, player]; }; }]; I placed this block into init.sqf of my test mission and it appears not to function. No errors are returned. Share this post Link to post Share on other sites
killzone_kid 1331 Posted January 19, 2019 You have to wait for mission display to become available if you put it in init.sqf Share this post Link to post Share on other sites
Starker 8 Posted January 20, 2019 On 1/18/2019 at 11:26 PM, killzone_kid said: You have to wait for mission display to become available if you put it in init.sqf I'm sorry, but I don't know what "mission display" is. I searched and found nothing related. Share this post Link to post Share on other sites
killzone_kid 1331 Posted January 20, 2019 Display 46 is mission display Share this post Link to post Share on other sites
Dedmen 2714 Posted January 24, 2019 On 19.1.2019 at 5:31 AM, Starker said: finddisplay 46 finds the display. If the display doesn't exist yet it returns null. adding a display eh to null does nothing. Thus your EH doesn't fire. First have to wait until the display is not null aka it exists. Share this post Link to post Share on other sites