Jump to content
da12thMonkey

MRT Accessory Functions

Recommended Posts

logo_AccFncs_ca.png
by da12thMonkey Robalo and Tupolov

MRT Accessory Functions (AccFncs for short) is a small script addon that switches a player's current weapon accessories between a set of predefined classnames at the press of a button. The aim of this function is to simulate various interactive features in real-life weapon accessories that are otherwise absent in Arma 3.
 

 


Demonstration video by sorophx
(uses the example attachments linked further down this post)

The system is designed to be easy to implement for community addon makers and avoids hardcoded classnames within the scripts themselves. Making an addon compatible with MRT Accessory Functions does not make the addon dependant on MRT Accessory Functions or CBA, and its installation remains at the discretion of the player.

As of 25/02/2017 MRT Accessory Functions has been fully integrated in to Community Base Addon (CBA_A3).

It is no longer necessary to run this addon separately with CBA versions later than 3.2.0, and MRT AccFncs can be removed as a dependency from your collections and modsets

More information:

https://forums.bistudio.com/topic/168277-cba-community-base-addons-arma-3/?page=37#comment-3157088

https://forums.bistudio.com/topic/171270-mrt-accessory-functions/?do=findComment&comment=3157248

 

Configuration Controls Configure Addon

 

MRT Accessory Functions should be available from the drop-down menu there, allowing you to change the keybinds to your liking.
 
In rare circumstances it is possible to corrupt your CBA keybinding registry, which may cause problems such as control options disappearing from the keybind menu. In order to reset the keybinding register please attempt the following instructions:

 
  1. Go in to the mission editor and place a playable unit down
  2. Press [Ctrl+D] in the editor to bring up the debug console*
  3. Type the following code accurately into the console and execute it
  4. Press the 'Preview' button to initialise the mission
  5. CBA keybinds menu should reset at mission start

profileNamespace setVariable ["cba_keybinding_registryNew", nil]; saveProfileNamespace;

* you can use the debug console that appears when you're on the pause screen in mission editor previews but the CBA keybinding menu will not reset until you exit back to the mission editor and then start a new instance of the mission (i.e. by hitting the 'Preview' button again).


When performing these key-presses with a compatible attachment assigned to your weapon, a small 'click' sound will be heard as your accessory changes mode, and a small hint box will appear, telling you which mode your weapon accessory has changed to.

In order for you to see the effects of the script, an addon with compatible attachments must be running in conjunction with MRT_AccFncs.pbo. We have provided config addons to add compatibility for:

Appropriate attachments (R3F's mini laser/lamp) will be able to switch between laser and light modes, when running in conjunction with MRT AccFncs and CBA. This config addon is available in the 'optional' subfolder inside the @MRT_AccFncs modfolder.

Compatible Community Addons:

  • ASDG Attachments - Using v.20150305 config
  • ASDG ACO - Allows switching between all of the (now) 4 reticle variants for the ACO sights and the 2 reticles for the Holo sights, that came with the Marksmen DLC. It requires JR because it's adding 6 new hidden optic classes to allow this to work.
  • FHQ Accessories Pack - Version 1.5 utilises MRTAccFns to provide a switchable LLM-01 Laser/Light as well as module and flip-up magnifiers for Aimpoint and EOTech sights
  • R3F ASDG JR config - An ASDG JR config for the R3F French Weapons Pack Version 3.3 that also enables MRT functionality on the SURB laser/light module attachment when MRT AccFncs is installed. A standalone config that enables this MRT feature without the additional ASDG JR compatibility, is distributed with MRT AccFncs itself.
  • RHS ASDG JR config - Robalo's custom config for the RHS: Escalation provides MRT support for the Kobra sight and Surefire/IR combo
  • Specialist Military Arms - SMA Version 1.9 contains several attachments that utilise MRT AccFncs, including an EOTech with a flip-over magnifier

Making a MRT_AccFncs compatible addon:

Implementing our system into your own attachments addon is incredibly simple; it just requires three additional config parameters in your attachment's class:

MRT_SwitchItemNextClass = "*CLASSNAME1*";
MRT_SwitchItemPrevClass = "*CLASSNAME2*";
MRT_switchItemHintText = "*DESCRIPTION*";

Replace *CLASSNAME1* with the atachment class you want the script to switch to when pressing the 'Next' keybind (default [ctrl + L] for rail items, [ctrl + NumPad /] for optic items).

Replace *CLASSNAME2* with the atachment class you want the script to switch to when pressing the 'Previous' keybind (default [shift + L] for rail items, [shift + NumPad /] for optic items).

Replace *DESCRIPTION* with a short text string that describes the mode of operation that the class has (e.g. "Laser", "Light", "Red", "Blue" etc.). This is the text that will appear in the ingame hint box when the player switches to this attachment class using the keybind. Can be left empty if you don't want or need a hint box to appear.

These config parameters will only be recognised by the game when MRT_AccFncs.pbo is installed by the player, otherwise they will have absolutely zero effect on the operation of your addon. As such, addons can be made compatible with the Accessory Functions system without being dependant on it, and the choice to download and use the system remains completely at the discretion of the player. So worry not, you can continue to make your attachments without the anxiety of bloating the user requirements with a bunch of mandatory addon dependencies. :)

The MRT_SwitchItemNextClass and MRT_SwitchItemPrevClass parameters can be arranged in such a way to provide different control schemes depending on the number of modes that you want your interactive attachment to have. The following graphics show the recommended setup for an attachment with simple binary states (like a laser/light module or flip-over magnifier), cyclable attachment states, or linearly scaling attachment states, but more complicated control schemes can probably be mapped out if you want them.

Colours indicate the MRT_SwitchItemNextClass and MRT_SwitchItemPrevClass relationship between classes:

AccFncs_Binary.png
Fig.1: Binary

AccFncs_Cycle.png
Fig.2: Cycle

AccFncs_Linear.png
Fig.3: Linear

Examples:

To provide some idea of the capabilities of this system, I have provided a small set of additional attachments that are set up to utilise the above control schemes.

We have:

  • MRT_LLMTest.pbo - A simple Laser/light module using the BIS IR laser and Flashlight models to visualise the binary switch
  • MRT_COMPM4.pbo - An Aimpoint CompM4 with a 3x magnifier that flips up and down (also binary, but applied to the optics slot for a change)
  • MRT_FlashlightAdj.pbo - An adjustable flashlight that allows you to scale the intensity of the light source using the linear control scheme
  • MRT_Holosight.pbo - An EOTech holographic sight with selectable reticle patterns that can be cycled through

MRT_COMPM4.pbo, MRT_FlashlightAdj.pbo, MRT_Holosight.pbo and MRT_LLMTest.pbo are all unbinarised to provide examples that other addon makers may wish to copy. However because they are unbinarised and unoptimised, the game may hang slightly when loading the unbinarised models for the first time ingame (i.e. when switching the aimpoint magnifier up and down).

Bear in mind that these are just some quick testbed attachments to show off ideas for the sort of functions that can be simulated with the MRT Accessory Functions system, and some of the limitations (There appears to be an engine limitation where you have to turn the light on and off again to refresh the light source with the adjustable flashlight!). The models are just quick 'placeholders' using available assets; not nice, polished addons.

Download:
MRT AccFnc Examples

ASDG Joint Rails CBA Joint Rails is needed for the example attachments to actually clip on to the weapons ingame.

MRT Accessory Functions system itself does not require attachments to be JR compatible. However, we strongly recommend utilising JR in your projects as a means of improving compatibility with other community-made weapons and attachments :)

A few words on development of this addon:

The concept for this addon came about after I completed work on RKSL Attachments Pack 1. I began assessing options for new attachments that I should make for the next pack, and the UK's latest LLM Mk.3 seemed a likely candidate, but I figured why make something like that when it wouldn't be able to switch between laser and light modes? I know I and several other community addon makers had long held hope that BIS might make attachments a bit more dynamic, but so far nothing seemed to be materialising on this front within the community or from BIS.

Eventually I got around to trying to write a basic script to switch between the standard Arma 3 flashlight and IR laser attachments and investigating how to pair the two classes together via the config. Right from the beginning it was my desire to avoid using hardcoded classnames in the script to ensure that if I wished to make more attachments using this system in future, I wouldn't have to manually add classnames to the script every time I wished to update my addon, or introduce hard dependencies between addons. I had also hoped that the system would be able to be used by other addon makers in the community who did not possess the time or inclination to generate their own switching scripts.

Unfortunately, in twelve years of playing these games I'd never even attempted to code sqf before, so I very soon got stuck and asked Tupolov to help me out, knowing that he was developing some interesting functions for Arma 3 small arms himself. Tup, marvel that he is, understood my concept and put together a fully functioning script, for which I will forever be in his debt. Even more so for allowing me to abuse the coding work further and create the first version of this addon, that was received with some enthusiasm by the community members I got to test the system.

Recently Robalo released ASDG LightSwitch which functions in a very similar manner to what me and Tup wanted to achieve. I sent him the work that had been done so far, knowing from past collaboration with him that we could exchange some ideas about implementation that would mutually benefit overall development of this concept within the community. Rob identified that the way I'd set up Tup's script was pretty inefficient and being the great bloke that he is, streamlined the whole system into one very impressive function.

We hope that this system provides some utility to people who wish to experience a little more interaction with their weapon's attachments... at least until the day BIS provide some native way of creating such multi-mode attachments that doesn't rely on scripts and creating a glut of additional classnames. We genuinely hope that one day BIS will make this addon obsolete! :)

  • Like 3

Share this post


Link to post
Share on other sites

Something I forgot to mention, but is written in the readme (these things happen when you're releasing addons at near enough 3am local time...) and probably worth noting here, is that currently the function only supports primaryWeapon (rifle, SMG, MG etc.) and Handgun slot weapons.

This is because BIS have not added a removeSecondaryWeaponItem command that would allow us to easily provide the switching utility on secondaryWeapon (AT/AA launcher) slot weapons. They have an addSecondaryWeaponItem command though; so it's a bit perplexing. As soon as BIS add the necessary command, support can be added for AT launchers and such like. The code is already there in the scripts, it's just commented out while the required command is absent. ;) Feel free to vote up the ticket on the Arma 3 feedback tracker in the meantime.

^BIS fixed the above in the Arma 3 v.1.38 patch, and it was enabled in v.1.1 of MRT AccFncs^

Also, interactive weapon accessory functions are only available to rail slot and optics slot attachments. Muzzle slot could be supported; I just couldn't think of any practical examples that might use the muzzle slot. If an addon maker approaches us with the requirement, we can always add a the necessary code and keybinds for muzzle slot attachments.

Oh and if anybody wants to make a Youtube video showing off the function at work on the example addons; that would be grand. I didn't really have the capacity to make a half decent one myself to provide a visual demonstration of what the system does, but if somebody does one I'll embed it in the first post.

Edited by da12thMonkey

Share this post


Link to post
Share on other sites

Nice work chaps. I've been looking forward to this release for some time!

Share this post


Link to post
Share on other sites

Wonderful. Thank you for your work on this. Works great. Now we need peq16.

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

** Note:

since this is a project on which more people are working we will contact you in the future to discuss how you want this to be setup on Armaholic.

Share this post


Link to post
Share on other sites

Wow! I asked, I think Hatchet long time ago if this was possible to make and now we already have it! Great work guys!

Share this post


Link to post
Share on other sites

New mod v1.0 available at withSIX. Download now by clicking:

@mrt_accfncs.png

@ da12thMonkey, Robalo & Tupolov;

Soon you will be able to manage the promo pages of your content on our web platform and publish new content yourself.

To do so, please hit 'this is me' button on the page while logged in and you will get connected to your work.

For now you can send new content or releases our way through withsix.wetransfer.com or add your notification at getsatisfaction.withsix.com.

Share this post


Link to post
Share on other sites

I owe a huge thank you to Foxhound and Sonsalt 6 setting up download mirrors, and for being tremendous assets to the community in general along with their respective colleagues at Armaholic and play withSix. Mirror links have been incorporated into the first post. :)

Share this post


Link to post
Share on other sites

Great to see this out. Congrats on the release, da12thMonkey, next version of FHQ Accessories pack will make extensive use of this :)

Share this post


Link to post
Share on other sites

Maybe I am just a blockhead... but for fellow blockheads who cant seem to get this working... The mod switches items, not operational state. When you flip-flop back and forth between laser and flashlight, you have to turn the item on again. I had 30 seconds of @#$%&*!!!!!!! before this hit me.

Thank you for another fantastic mod. The community appreciates your efforts.

Share this post


Link to post
Share on other sites

Here's an idea. The script could be set not to overwrite any existing keybinds. Then you could set for example L for light and shift+L for rail accessory switch. This way you could then keep them lit after switching.

As promised, here's a MRT config for ASDG Attachments. Overwrite existing config to use it.

Share this post


Link to post
Share on other sites
Maybe I am just a blockhead... but for fellow blockheads who cant seem to get this working... The mod switches items, not operational state. When you flip-flop back and forth between laser and flashlight, you have to turn the item on again. I had 30 seconds of @#$%&*!!!!!!! before this hit me.

Thank you for another fantastic mod. The community appreciates your efforts.

Yea, with lasers and lights you have to actually switch the thing on again when it switches to the new mode, or in the case of the flashlight, off then on again if you perform the switch with the light already turned on (due to the apparent engine limitation we have when it comes to updating a weapon's light source).

During one of the betas I did have it set up so that the laser/light on the LLM would come on automatically when switching (as Robalo said this was by not overriding the L key input that turns the laser off and on). This meant the attachment could switch directly between a laser and a light source being projected. However, it also resulted in some less than ideal behaviours such as the adjustable flashlight flashing off and on repeatedly as you cycled through the modes (annoying as hell - was like using a signal lamp), and for tactical purposes it's probably safer to be able to set the mode you want without automatically switching the attachment on and giving your position away unintentionally. It also didn't work if you bound the rail switching keys to a non-default setting that didn't use the L key, so behaviour would be inconsistent from user to user.

When he was explaining the finer points of setting up his awesome CBA keybinding system to me, Taosenai suggested that I allow the function to override the underlying L or NUM-/ inputs when using the ctrl/shift combos and stop this erratic behaviour, and I agreed with him.

Different visual states that are the result of switching the models; like the changing reticles on the Holosight example and the magnifier on the Aimpoint example, are instant switches: i.e you can look down the sights and perform the switch. However, things like current zeroing settings on classes that have adjustable zero wouldn't carry over (they revert to the default/init settings for that class). Alas that's one of the limitations of the whole class-switching 'hack' we have to make do with until BIS decide to change things :)

Great to see this out. Congrats on the release, da12thMonkey, next version of FHQ Accessories pack will make extensive use of this :)

I think I should apologise to you for changing the tag on the config parameters at the last minute, to something different from what they were in the alphas/betas I sent you. Going through your configs again to add the new tags was probably a bit tedious for the sake of changing 3 little letters. :D

But anyway folks - Alwarren's range of attachments for the FHQ pack were a big source of inspiration when it came to thinking up ideas of how this sort of system might find different applications beyond me wanting to make a semi-functional LLM Mk.3 in future, and deciding what additional features might be useful. The addon probably wouldn't be what it is, without his input.

----

I added the link to Robalo's compatibility config for ASDG attachments' bipods to the first post :)

Edited by da12thMonkey

Share this post


Link to post
Share on other sites

or you could add a little timer between key strokes so when you just cycle through you get no blinking but, if there was enough time between key presses you would have it turn on. just an idea.

Share this post


Link to post
Share on other sites
I think I should apologise to you for changing the tag on the config parameters at the last minute, to something different from what they were in the alphas/betas I sent you. Going through your configs again to add the new tags was probably a bit tedious for the sake of changing 3 little letters. :D

Naw, no problem XD I can always use search&replace, the config isn't that big luckily :)

But anyway folks - Alwarren's range of attachments for the FHQ pack were a big source of inspiration when it came to thinking up ideas of how this sort of system might find different applications beyond me wanting to make a semi-functional LLM Mk.3 in future, and deciding what additional features might be useful. The addon probably wouldn't be what it is, without his input.

Well I wanted to have this kind of functionality and was ready to implement it myself. This addon came at the right time, and saved me a LOT of work :)

Share this post


Link to post
Share on other sites

Oh and if anybody wants to make a Youtube video showing off the function at work on the example addons; that would be grand.

Share this post


Link to post
Share on other sites

Thanks a lot sorophx! I've embedded it in the first post.

Share this post


Link to post
Share on other sites

Here's a little MRT config addon which allows changing the ACO reticle between red circle dot and green chevron dot: ASDG_MRTACO v1.0

Note that I also changed scope of optic_ACO_grn and optic_ACO_grn_smg to protected because they're redundant with MRT and this addon.

Share this post


Link to post
Share on other sites

Just a small announcement that as of last month on the dev branch (rev. 128627), BIS added the removeSecondaryWeaponItem command that was missing from Arma 3, as part of a larger overhaul of the game's addXYZWeaponItem and removeXYZWeaponItem commands. As such, in the next version of the addon we should finally be able add support for attachments fitted to AT/AA Launcher type weapons, and other items potentially using the secondaryWeapon inventory slot.

Last night I tested that the removeSecondaryWeaponItem command worked in the editor and enabled the lines of the code that were there awaiting its introduction. It seems to function without the errors that were there before in the absence of the command; so I will probably push an update to MRT AccFncs out of the door as soon as BIS release patch 1.28 for the stable/main branch.

Thanks go out to Jan MareÄek (japapatramtara) and the other programmers at BIS :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×