Jump to content
Sign in to follow this  
A.Soren

VIrtual Arsenal Restricted by PID or Variable Name

Recommended Posts

In our unit, we have a bunch of new recruits that we want to solely run prescribed load outs, which I have figured out and done. Now, we want people that have successfully accomplished a certain training to have full access to an arsenal box. I understand the white-listing process for objects within an arsenal, but I was wondering if perhaps there was a way to write in a way that only certain players, or slots even, could run a virtual arsenal when looking at a box in the similar fashion as the usual scroll and click for a universal access arsenal that you can put onto a box.

 

My question is, whether by variable name of a unit/slot or by a list of whitelisted PIDs, can the VA system be limited to certain members on a server while others are forced to use the load-outs I have already scripted into the mission?

Share this post


Link to post
Share on other sites

Just put the UIDs of all players that are allowed to use it in an array and use that in a condition when you're adding the arsenal.

 

So put this somewhere in your init and add all the UIDs there:

arsenalPlayers = ["01231230","0123123123"];

 

And this goes in the init of any object (doesn't have to an ammobox) that should have a full arsenal:

this addAction ["Open Arsenal", { ["Open",true] spawn BIS_fnc_arsenal; }, [], 0, false, false, "", "(getPlayerUID _this) in arsenalPlayers"];

 

 

Using the debug console you can even add new entrys to arsenalPlayers on the fly, during the mission.

Like this for example when you're aiming at the person to be added:

arsenalPlayers pushBack getPlayerUID cursorTarget; publicVariable "arsenalPlayers";

 

 

 

If you want to use that in several missions, you could also save the uids in the profileNamespace on the server, that way even the uids that you add on the fly would persist.

  • Like 5

Share this post


Link to post
Share on other sites

EDIT: Ugh, my bad!

Quote

while others are forced to use the load-outs I have already scripted into the mission?

The other players still need to have the action I assume?

https://community.bistudio.com/wiki/BIS_fnc_arsenal

this addAction ["Open Arsenal",
{
	if (((getPlayerUID _caller) in arsenalPlayers)) then
	{
		["Open", true] spawn BIS_fnc_arsenal;
	} else
	{
		["Open", false] spawn BIS_fnc_arsenal; // I assume you will need to add the equipment (weapons, etc) you want with the following commands (see below)
	};
}, [], 0, false, false, "", ""];

https://community.bistudio.com/wiki/BIS_fnc_addVirtualWeaponCargo

https://community.bistudio.com/wiki/BIS_fnc_addVirtualMagazineCargo

https://community.bistudio.com/wiki/BIS_fnc_addVirtualItemCargo

https://community.bistudio.com/wiki/BIS_fnc_addVirtualBackpackCargo

This could be a pain if you need lots of stuff in the arsenal, and if you have mods. I know you can automatically grab all that data and have some kind of blacklist array but if that's the case, you could just give them full arsenal and remove the stuff you want resticted to them?

https://community.bistudio.com/wiki/BIS_fnc_removeVirtualWeaponCargo

https://community.bistudio.com/wiki/BIS_fnc_removeVirtualMagazineCargo

https://community.bistudio.com/wiki/BIS_fnc_removeVirtualItemCargo

https://community.bistudio.com/wiki/BIS_fnc_removeVirtualBackpackCargo

  • Like 1

Share this post


Link to post
Share on other sites

Thank you, both of you. I was beating my head in trying to figure this out. I'm relatively new to this. Glad it was possible :)

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
Sign in to follow this  

×