MRT Accessory Functions
da12thMonkey, Robalo and Tupolov
MRT Accessories Functions 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.
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.
To install the MRT Accessory Functions you should use modfolders to keep it seperate from the official game content to prevent issues.
With Arma 3 you can use different ways to set up your modfolders to use custom content you have downloaded.
Please visit the Arma 3 Mod install instructions page
for more information about using custom mods and addons in Arma 3.
Making a MRT_AccFncs compatible addon:
For detailed usage instructions please refer to the release thread: http://forums.bistudio.com/showthread.php?181338-MRT-Accessory-Functions
Using MRT AccFncs:
The system uses four Keybinds operating in two pairs. One pair controls attachments in the optics slot and the other pair controls attachments in the rail accessory slot. Each slot is assigned a key to switch forward to the next operating mode of the attachment, and a key to switch backward to the previous operating mode.
By default, the control scheme looks like this:
[ctrl + L] Switch rail attachment to the next mode
[shift + L] Switch rail attachment to the previous mode
[ctrl + NumPad /] Switch sight attachment to the next mode
[shift + NumPad /] Switch sight attachment to the previous mode
Keybinds are customisable through the usual CBA keybindings menu, accessible from the ingame menu by clicking:
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.
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:
FHQ Accessories pack
R3F French Weapons Pack
Where appropriate attachments (FHQ's LLM-01 and R3F's mini laser/lamp) will be able to switch between laser and light modes, when running in conjunction with MRT AccFncs and CBA. These two config addons are available in the 'optional' subfolder inside the @MRT_AccFncs modfolder.
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.
- 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. Hovever 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.
MRT AccFnc Examples (6mb)
ASDG 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 ASDG JR compatible. However, we strongly recommend utilising ASDG JR in your projects as a means of improving compatibility with other community-made weapons and attachments
Compatible Community Addons:
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 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!
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 will add a the necessary code and keybinds for muzzle slot attachments.
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. As soon as BIS add the 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.
Credits & Thanks:
Tupolov - accessory switching script
da12thMonkey - concept and implementation
Robalo - final script optimisation
Taosenai [CBA] - for the CBA keybinding feature and helping me to make the most of it
Alwarren [FHQ] - for plenty of contructive feedback, and for making some inspiring attachment models
GvsE - for testing the addon out
RobertHammer - for testing the addon out
VOLCBAT - for support in general
- changed init.sqf to use the improved CBA Keybinding API from CBA v1.20.50327 - custom keybinds may be reverted to default
- added support for SecondaryWeapon slot items (attachments for AT/AA launchers etc.)
- first release
- BI forums
- Community Base addons A3