Author: da12thMonkey
Author Website:

Requirements: Community Base addons A3

Version: 1.20
Signed: Yes, serverkey included

Short description: 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.

Date: 2015-04-09 15:22


Comments: (1)
Rating:



 



MRT Accessory Functions

by
da12thMonkey, Robalo and Tupolov


Description:
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.


Installation:
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.


Included files:
MRT_R3F_SURBAccFnc.pbo
MRT_FHQ_LLMAccFnc.pbo
MRT_AccFncs.pbo


Usage:
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.


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. 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.

Download:
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:

Notes:
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!


Known issues:
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.


Steam Workshop:
- Subscribe


Credits & Thanks:
Devs:
Tupolov - accessory switching script
da12thMonkey - concept and implementation
Robalo - final script optimisation

Thanks:
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


Changelog:
v1.20
- changed init.sqf to use the improved CBA Keybinding API from CBA v1.20.50327 - custom keybinds may be reverted to default

v1.10
- added support for SecondaryWeapon slot items (attachments for AT/AA launchers etc.)

v1.00
- first release


Forum topic:
- BI forums



- Community Base addons A3




Enable javascript to be able to download from Armaholic please!



Tags: No tags