Jump to content
aimgame

Virtual Arsenal: Loadouts restriction

Recommended Posts

Hi all! Im using a preconfigured virtual arsenal (VA) box in my mission, with only stuff that i need there. But i found out that players can make preset loadouts in their single VA, and then load them though this box while playing at the server. Is it possible to make the "Load" button inactive for all in VA of my mission?

Share this post


Link to post
Share on other sites

Possible, yes. It just requires some digging around in the config.

 

 

You'll have to put this bit of code after the command you use to open the arsenal.:

waitUntil { sleep 0.5; !isnull ( uinamespace getvariable "RSCDisplayArsenal" ) };
ctrlEnable [44147, false];

That should to the trick (havent tried it yet)

Share this post


Link to post
Share on other sites
Guest

You can also add this code in the arsenal addaction.

Share this post


Link to post
Share on other sites

Possible, yes. It just requires some digging around in the config.

 

 

You'll have to put this bit of code after the command you use to open the arsenal.:

waitUntil { sleep 0.5; !isnull ( uinamespace getvariable "RSCDisplayArsenal" ) };
ctrlEnable [44147, false];

That should to the trick (havent tried it yet)

 

You can also add this code in the arsenal addaction.

 

So i've tried this right after addaction in my object, also tried in the VA script... It doesn't work... players still able to load their presaved loadouts((

Share this post


Link to post
Share on other sites

Here is an example of what i made for my team : http://pastebin.com/0YxUcRjJ

Create an allowedLoadout.sqf at the root of your mission and paste the code in it.

 

Run the following line in the init field of your ammobox, it automatically adds an action to the  ammobox :

this execVM "allowedLoadout.sqf";

Since the functions have a global parameter, you may run it server side only :

if (isServer) then {this execVM "allowedLoadout.sqf"};

Here is the documentation for the functions used : https://community.bistudio.com/wiki/Arsenal#Add

 

I think you have to list all the items you want to be available, you can't blacklist.

Share this post


Link to post
Share on other sites

Here is an example of what i made for my team : http://pastebin.com/0YxUcRjJ

Create an allowedLoadout.sqf at the root of your mission and paste the code in it.

 

Run the following line in the init field of your ammobox, it automatically adds an action to the  ammobox :

this execVM "allowedLoadout.sqf";

Since the functions have a global parameter, you may run it server side only :

if (isServer) then {this execVM "allowedLoadout.sqf"};

Here is the documentation for the functions used : https://community.bistudio.com/wiki/Arsenal#Add

 

I think you have to list all the items you want to be available, you can't blacklist.

 

You don't get it... This is just a creation of the box. And i already have it! It works pretty fine. The problem is that players can load their presaved loadouts (from their own single VA) while playing at my server and using my VA box with only stuff that i wanted. I'd like to disallow them do that, so they could use only things that are in my preconfigured box)

Share this post


Link to post
Share on other sites

Oh cmon guys... Disable buttons and set custom VA dont work as intended. Cause if u make VA with custom guns and outfit if wont load any preset anymore in MP. I guess TS need another aproach. He could make a trigger near VA position for players only and deny use of inproper weapons and outfit.

Share this post


Link to post
Share on other sites

... if u make VA with custom guns and outfit it wont load any preset anymore in MP...

 

But it does! I do have a VA with custom guns... and players still able to load their own presets((

Share this post


Link to post
Share on other sites

Oops, sorry...

 

You could create a trigger near your base and check the player loadout every x secondes while he's in the area : getUnitLoadout.

Share this post


Link to post
Share on other sites

Oops, sorry...

 

You could create a trigger near your base and check the player loadout every x secondes while he's in the area : getUnitLoadout.

 

Thats what i just did, before making this post:) But this solution is not very right...

Share this post


Link to post
Share on other sites

You might want to take a look at Loadout Transfer. It's available as a mod or script. With some code in the init line of a box you can specify that players can only select loadouts that you have specified as either mission loudouts, unique to that mission or server loudouts that are unique to your server. You can make it so they cannot load their own loadouts.

 

I believe the author is S. Crowe

Share this post


Link to post
Share on other sites

Thats what i just did, before making this post:) But this solution is not very right...

you are going to need to disable global weapons, items, etc.

if you've already got everything for your arsenal in terms of weapons, items, backpacks, etc.

I recommend you try doing something like this:

[(_this select 0),"",0] call BIS_fnc_addVirtualWeaponCargo;

The "0" at the end will dis allow the loading of weapons outside of what you have there.

This is how I've always done it, but there may be better options with the same results. 

Same syntax with 

bis_fnc_addVirtualItemCargo,

bis_fnc_addVirtualBackpackCargo,

and bis_fnc_addVirtualMagazineCargo.

This shouldn't tamper with what you already have in there as long as there is nothing added to that string.

 

Here is the function description (bis_fnc_addVirtualWeaponCargo) 

/*

	Description:
	Add virtual weapons to an object (e.g., ammo box).
	Virtual items can be selected in the Arsenal.

	Parameter(s):
		0: OBJECT - objct to which weapons will be added
		1: STRING or ARRAY of STRINGs - weapon class(es) to be added
		2 (Optional): BOOL - true to add weapons globally (default: false)
		3 (Optional): BOOL - true to add Arsenal action (default: true)

	Returns:
	ARRAY of ARRAYs - all virtual items within the object's space in format [<items>,<weapons>,<magazines>,<backpacks>]
*/

Share this post


Link to post
Share on other sites

I don't understand why this post is still going.

I gave you your answer in post #4 of this thread, in the linked thread you will find two options.

One disables the load and save buttons completely, post #3.

The other keeps the buttons enabled but any loadout that is loaded is checked against the VA white listed items and removes any items from the player that are not allowed, post #8.

You make no mention of trying the examples from my link, if you are having problems with them let me know and ill try to help you as i know they work.

The "0" at the end will dis allow the loading of weapons outside of what you have there.

This is not what this option does, and its a bool not a number.

It means that the items added will be only locally for that VA. Rather than globally for all client VAs.

  • Like 1

Share this post


Link to post
Share on other sites

I don't understand why this post is still going.

I gave you your answer in post #4 of this thread, in the linked thread you will find two options.

One disables the load and save buttons completely, post #3.

The other keeps the buttons enabled but any loadout that is loaded is checked against the VA white listed items and removes any items from the player that are not allowed, post #8.

You make no mention of trying the examples from my link, if you are having problems with them let me know and ill try to help you as i know they work.

This is not what this option does, and its a bool not a number.

It means that the items added will be only locally for that VA. Rather than globally for all client VAs.

Okay, thanks. 

Share this post


Link to post
Share on other sites

Is there any good solution for this yet? It seems like this bug have been in game since September 2016 and still no one notices it.

 

Btw, code above doesn't prevent players from loading loadouts. They still can use hotkeys to open same menu.

You need much more complex code to block hotkeys too.

Share this post


Link to post
Share on other sites

2 posts up Larrow wonders why this thread is still going and so do I. I just used his solution and it works great.

If players go to load a preset using gear NOT in the whitelist then it removes it and tells them. There's honestly no better solution than Larrows (as usual)

Share this post


Link to post
Share on other sites

Larrow's script gives some RPT errors. I don't trust it :)

 9:31:47   Error Zero divisor
 9:31:47 File C:\Users\Vlad\Documents\Arma 3 - Other Profiles\Champ\missions\override_VA_templates.VR\LARs\override_VA_templates\functions\fn_overrideVAButtonDown.sqf, line 67

 

Share this post


Link to post
Share on other sites

There's no reason not to trust it, have you even looked at the script?

If you don't want to use it that's fine, but it's the best option out there 

Share this post


Link to post
Share on other sites

You totally ignored that part about RPT error :D

Share this post


Link to post
Share on other sites

Yeah because I don't see it as a big deal. Hell even BIS's functions will give you rpt errors at times.

I get one in every mission just from preloading the arsenal. It really is nothing to worry about.  

Share this post


Link to post
Share on other sites
On 05/02/2017 at 7:33 AM, champ-1 said:

Larrow's script gives some RPT errors. I don't trust it :)

The function is just a direct copy of the Arsenal keys function, I had just forgot to include the macros needed just for the TAB key, and as it was not part of the loadouts I had not noticed. Now fixed.

How about letting people know next time that there is something wrong.

Also added ability to disable random button and its shortcut key. Hopefully have not broken anything else.

overRide_VA_templates

 

  • Like 2

Share this post


Link to post
Share on other sites
9 hours ago, Larrow said:

The function is just a direct copy of the Arsenal keys function, I had just forgot to include the macros needed just for the TAB key, and as it was not part of the loadouts I had not noticed. Now fixed.

How about letting people know next time that there is something wrong.

Also added ability to disable random button and its shortcut key. Hopefully have not broken anything else.

overRide_VA_templates

 

Thanks.

I was looking for some options. That's why didn't just report error.

P.S. Can you make Esc close Arsenal? It's like muscle memory for me and with your script it doesn't do anything.

Share this post


Link to post
Share on other sites
On 06/02/2017 at 8:09 AM, champ-1 said:

Can you make Esc close Arsenal? It's like muscle memory for me and with your script it doesn't do anything.

Added Esc key for closing both loadout and Arsenal display.

Fixed ctrl+O shortcut key.

Added Orange color to loadouts that have restricted items.

Added message when Loadouts display is shown to explain what the colors mean.

Moved settings into its own file within script folder.

Removed horrible restricted items list and re-appropriated VA loadouts window to display them instead.

  • Like 1

Share this post


Link to post
Share on other sites
11 hours ago, Larrow said:

Added Esc key for closing both loadout and Arsenal display.

Fixed ctrl+O shortcut key.

Added Orange color to loadouts that have restricted items.

Added message when Loadouts display is shown to explain what the colors mean.

Moved settings into its own file within script folder.

Removed horrible restricted items list and re-appropriated VA loadouts window to display them instead.

Thanks for update. Works fine now.

I was wondering is it possible to have a "light version" of your script, which doesn't have all those fancy settings and popup windows and blocked shortcuts, but it just removes restricted items when you load them from saved loadout?

 

P.S. "LARs_overrideVA_showMsg = -1" doesn't show any messages for me.

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

×