gruppe-adler / grad_slingHelmet

Gruppe Adler Sling Helmet is a mod for Arma 3, which adds the functionality of attaching your helmet to your belt.
Other
2 stars 14 forks source link

Arsenal button to sling helmet #17

Open Saborknight opened 5 years ago

Saborknight commented 5 years ago

Similar to BackpackOnChest, have a button that allows the user to sling the helmet and then select another headgear.

10Dozen commented 5 years ago

Fast and easy way to add stuff to arsenal is to draw controls using Arsenal display. Code below may be be plugged into some loop (e.g. eachFrame) or handler may be attached

        if ( isNull ( uinamespace getvariable "RSCDisplayArsenal") ) exitWith {}; // No arseanl display
        private _display = uinamespace getvariable "RSCDisplayArsenal";

        // Adds new button control to arsenal UI
        private _ctrl = _display ctrlCreate ["RscButton", -1];      
        _ctrl ctrlSetText  "MY BUTTON";
        _ctrl ctrlSetPosition [0.375,1,0.25,0.05];
        _ctrl ctrlCommit 0;

        _ctrl ctrlAddEventHandler ["ButtonClick", {
            params ["_control"];

            /* Do stuff, call some functions to move selected headgear to belt */
        }];
DerZade commented 5 years ago

@10Dozen Thanks a lot for the code. I'll probably take the code from my other Mod BackpackOnChest :)