Jump to content

[solved] whitelisted arsenal limitations ( disable "+" item button )

Recommended Posts

I have whitelisted arsenal like this ( executed in addAction )

_box setVariable ["bis_addVirtualWeaponCargo_cargo", nil, true];

[_box, _items, false, false] call BIS_fnc_addVirtualItemCargo;
[_box, _weapons, false, false] call BIS_fnc_addVirtualWeaponCargo;
[_box, _magazines, false, false] call BIS_fnc_addVirtualMagazineCargo;
[_box, _backpacks, false, false] call BIS_fnc_addVirtualBackpackCargo;

["Open", [false, _box, _player]] call BIS_fnc_arsenal;

I have declared whitelisted items in arsenal like this

_items = ["FirstAidKit"];


when player pick up restricted item from enemy / ground and put it in inventory, then he go to whitelisted virtual arsenal, he can duplicate/multiply this restricted items ( for example: "Medikit" ) with "+" button


Expected result

- player should not be able to increase number of restricted items in loadout



- virtual arsenal is whitelisted with BIS_fnc_addVirtualItemCargo


- player pick restricted item and enters whitelisted arsenal


- item should not be increased ( disabled + button ) for adding more


Possible solutions:

- disable "+" button in arsenal UI for restricted items ( I did not find yet _control IDC of arsenal _display yet )

private _plusButton = _display displayCtrl 993;

- remove restricted item from players inventory when open arsenal

- I tried to disable item with this command, but problem still occurs

[_box, ["Medikit"], false] call BIS_fnc_removeVirtualItemCargo;



  • Like 1

Share this post

Link to post
Share on other sites

I checked ace3 arsenal and they do handle this problem with disabling "+" button for blacklisted items



Share this post

Link to post
Share on other sites

so I figured how to disable "+" button, but there is still something missing, as when I click on button, it does action regardless _control is disabled

            private _ctrl = _display displayCtrl _x;
            _ctrl ctrlAddEventHandler ["LBSelChanged", { 
                params ["_control", "_selectedIndex"];

                private _enabled = false; // set to false for debug purposes

                if ( _selectedIndex isNotEqualTo -1 ) then 
                    private _display = findDisplay -1;
                    private _plusButtonCtrl = _display displayCtrl 993;
                    _plusButtonCtrl ctrlEnable _enabled; // this does not work
            984, // misc
            983, // explosives
            982, // grenades
            986, // magazines
            981 // magazine


Share this post

Link to post
Share on other sites

so in order to disable "+" button, you also need to disable event link to it added by BIS.

you can find this event in file



_ctrlArrowRight = _display displayctrl IDC_RSCDISPLAYARSENAL_ARROWRIGHT;
_ctrlArrowRight ctrladdeventhandler ["buttonclick","with uinamespace do {['buttonCargo',[ctrlparent (_this select 0),+1]] call bis_fnc_arsenal;};"];

here is final solution how to disable "+" button

private _enabled = false; // your switch to enable/disable button

private _display = findDisplay -1;
private _button = _display displayCtrl 993;
_button ctrlEnable _enabled;
_button ctrlRemoveAllEventHandlers "ButtonClick";
if ( _enabled ) then 
    _button ctrlAddEventHandler ["ButtonClick", "with uinamespace do { ['buttonCargo', [ctrlparent ( _this select 0 ), +1]] call BIS_fnc_arsenal; };"];


  • Like 1

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