Announcement

Collapse
No announcement yet.

here's how to disable Arsenal load (and/or save) dialogs

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • here's how to disable Arsenal load (and/or save) dialogs


    Problem being solved: wanting arsenal but not wanting to allow LOADs of previously saved loadouts

    Okay, this is the code you need in your CLIENT init script to disable both the button and the ctrl+O keystroke that opens the arsenal LOAD dialog (I saw no need to prevent users from opening the SAVE dialog, but if you want to disable that, too, it would be easy enough to do – see the embedded comment):


    Code:
    //to disable opening the Arsenal save/load dialog
    Stick_interceptctrlOkeydowninarsenal = {
    private["_handled", "_key", "_shift", "_ctrl", "_alt"];
    _key = _this select 1;
    _shift = _this select 2;
    _ctrl = _this select 3;
    _alt = _this select 4;
    _handled = false;
    if ((_ctrl) and (not _shift) and (not _alt)) then {
    if (_key == 24) then {_handled = true};
    };
    _handled;
    }; //if we also want to disable the S key for the ctrl+S save dialog, that's key 31 so the “if” line changes to: if (_key in [24,31]) then {_handled = true};
    
    if ((paramsArray select 2)==1) then {
    //this part from Larrow, found here: https://forums.bistudio.com/forums/t...ad-in-arsenal/
    [missionNamespace, "arsenalOpened", {
    disableSerialization;
    _display = _this select 0;
    Stick_interceptctrlOkeydowninarsenalEH = _display displayAddEventHandler ["keydown","_this call Stick_interceptctrlOkeydowninarsenal"]; //added by Stick with handler above
    {
    ( _display displayCtrl _x ) ctrlSetText "Disabled";
    ( _display displayCtrl _x ) ctrlSetTextColor [ 1, 0, 0, 0.5 ];
    ( _display displayCtrl _x ) ctrlRemoveAllEventHandlers "buttonclick";
    }forEach [ 44146, 44147 ];
    }] call BIS_fnc_addScriptedEventHandler;
    };
    Now you can manually tweak the contents of your arsenal box in Eden editor to restrict to NATO or CSAT or whatnot and then prevent bypassing those restrictions by disabling the LOAD dialog (and the save dialog, if you want, see comment above).

    Note that I have this coded as a mission startup parameter (see the check against (paramsArray select 2) above). By making it a mission parameter you can accommodate open missions where you need to restrict it and also closed missions or events among trusted players where you can open it. Put this into your description.ext class Params section (herein it's assumed to be the third parameter):

    Code:
    class DisableArsenalSaveLoad
    {
    // paramsArray[2]
    title = "Disable Arsenal Save/Load functionality?";
    values[] = {0,1};
    texts[] = {"Do NOT disable it", "Disable it"};
    default = 1;
    };
    NB: tested on hosted server only

    enjoy,
    Stick
    Last edited by Stick; 03-19-2017, 10:27 AM.

  • #2
    This is excellent stuff! Thanks for that.
    |TG-189th| Unkl
    ArmA 3 Game Officer
    Dean of Tactical Gamer University
    189th Infantry Brigade Member

    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN

    Comment


    • #3
      i can see this being very useful, nice one!

      Comment


      • #4
        Bravo Good Sir!
        May God have mercy upon my enemies, because I won’t.
        -- Gen. George S. Patton


        |TG189th| Cody

        Comment


        • #5
          Here I was merely hiding Save functionality by disabling the button while keeping the Save hotkey available (disabling both button and hotkey for Load). Mik pointed out that the 44146 display ID is for the Save dialog (easily enough discovered by experimentation). If you want to allow the Save button as well as the Save hotkey, remove the 44146 from the final foreach before the bis_fnc call.

          On my hosted server this is persistent through respawn without reassertion.

          Comment


          • #6
            Quickly threw this in my initPlayerLocal.sqf and tried changing "if ((paramsArray select 2)==1) then" to "if (true) then" and didn't look much closer.

            We could use a version that you can simply turn off in the main script or don't insert the script if you not using it. Anywho, I was able to load from the arsenal so removed it. I know I need to read the script a bit more but I'm already at the saturated point in my mission making for the day :D
            |TG-189th| Unkl
            ArmA 3 Game Officer
            Dean of Tactical Gamer University
            189th Infantry Brigade Member

            SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN

            Comment


            • #7
              You're saying this didn't work for you? That would be interesting. I tested it, but not on dedicated, but this is entirely client side so there should not be a difference!

              I also tested it with no mods. There is a chance that some mods may alter the display ID for the arsenal dialog, or the control IDs for the buttons of interest, if you were running mods. I can't speak to that. I'm not a dialogs/UI coder, that part came from Larrow. If you're running mods, and they did alter the display ID and/or the button IDs, someone with UI experience would be in a better position to figure out what the arsenal display ID and button IDs are in your configuration (or better yet in real time, of course). For all I know Arma disallows conflicts in UI IDs, but I wouldn't be surprised if it allows "bumping" of built-in UI IDs "down the list", thus changing them.

              Also, to be clear, I tested this on ammo crates that were virtual arsenal via the EDEN EDITOR. I have NOT tested this on ammo crates that were turned into arsenal crates via the bis_fnc call. For all I know those use different UI IDs, although one would certainly hope not. If so, again, someone with UI experience would be in a better position to figure out what the display ID is for scripted arsenal boxes.

              Comment


              • #8
                This works awesome. Thanks for the find and the additions. I have added it to the ZGMs for now. If interested, check out the initPlayerLocal.sqf

                Comment

                Connect

                Collapse

                TeamSpeak 3 Server

                Collapse

                Advertisement

                Collapse

                Twitter Feed

                Collapse

                Working...
                X