Jump to content

Recommended Posts

I am currently making a mission file for my Arma 3 Mil-Sim and I want to limit the options the players have. I have gone to https://community.bistudio.com/wiki/Arsenal#Access but this didn't really help me any further. I have also searched the BI forums but still didn't find what I was looking for. My current state is that I have an arsenal with the following in it '_crate = _this select 0; ["AmmoboxInit",[_crate,false,{true}]] spawn BIS_fnc_arsenal;'. and a .sqf file in the mission folder named 'virtual_arsenal_init.sqf'. In it, I have the following code.

//Init stuff
_crate = _this select 0;
["AmmoboxInit",[_crate,false,{true}]] spawn BIS_fnc_arsenal;

//Lists of items to include

_nvgoggles = [
	"rhsusf_ANPVS_14",
	"rhsusf_ANPVS_15"

_availableHeadgear = [
	"rhsusf_lwh_helmet_marpatd",
	"rhsusf_lwh_helmet_marpatd_ess",
	"rhsusf_lwh_helmet_marpatd_headset",
	"rhs_8point_marpatd"
];

_availableGoggles = [
	"rhsusf_googles_black",
	"rhsusf_googles_yellow",
	"rhsusf_googles_orange",
	"rhsusf_googles_clear",
	"rhsusf_shemagh_tan",
	"rhsusf_shemagh2_tan",
	"rhsusf_shemagh_gogg_tan",
	"rhsusf_shemagh2_gogg_tan",
	"G_Aviator"
];

_availableUniforms = [
	"rhs_uniform_FROG01_d1"
];

_availableVests = [
	"rhsusf_spc",
	"rhsusf_spc_corpsman",
	"rhsusf_spc"_crewman,
	"rhsusf_spc_iar",
	"rhsusf_spc_light",
	"rhsusf_spc_mg",
	"rhsusf_spc_marksman",
	"rhsusf_spc_patchless",
	"rhsusf_spc_patchless_radio",
	"rhsusf_spc_rifleman",
	"rhsusf_spc_squadleader",
	"rhsusf_spc_teamleader"
];

_availableBackpacks = [
	"B_Kitbag_cbr",
	"B_Parachute",
	"rhsusf_assault_eagleaiii_coy"	
];


//Populate with predefined items and whatever is already in the crate
[_crate,((backpackCargo _crate) + _availableBackpacks)] call BIS_fnc_addVirtualBackpackCargo;
[_crate,((itemCargo _crate) + _availableHeadgear + _availableGoggles + _availableUniforms + _availableVests)] call BIS_fnc_addVirtualItemCargo;
[_crate,(magazineCargo _crate)] call BIS_fnc_addVirtualMagazineCargo;
[_crate,(weaponCargo _crate)] call BIS_fnc_addVirtualWeaponCargo;


First, I want the following stuff to work and then another question I have is for the weapons do I make another '_availableweapons = [];' or do I name it whatever I want. I am a pretty new scripter/mission maker and am looking to learn something. Any help is appreciated.

Share this post


Link to post
Share on other sites

//Init stuff
_crate = _this select 0;
["AmmoboxInit",[_crate,false,{true}]] spawn BIS_fnc_arsenal;

//Lists of items to include

_nvgoggles = [
    "rhsusf_ANPVS_14",
    "rhsusf_ANPVS_15"

_availableHeadgear = [
    "rhsusf_lwh_helmet_marpatd",
    "rhsusf_lwh_helmet_marpatd_ess",
    "rhsusf_lwh_helmet_marpatd_headset",
    "rhs_8point_marpatd"
];

_availableGoggles = [
    "rhsusf_googles_black",
    "rhsusf_googles_yellow",
    "rhsusf_googles_orange",
    "rhsusf_googles_clear",
    "rhsusf_shemagh_tan",
    "rhsusf_shemagh2_tan",
    "rhsusf_shemagh_gogg_tan",
    "rhsusf_shemagh2_gogg_tan",
    "G_Aviator"
];

_availableUniforms = [
    "rhs_uniform_FROG01_d1"
];

_availableVests = [
    "rhsusf_spc",
    "rhsusf_spc_corpsman",
    "rhsusf_spc"_crewman,
    "rhsusf_spc_iar",
    "rhsusf_spc_light",
    "rhsusf_spc_mg",
    "rhsusf_spc_marksman",
    "rhsusf_spc_patchless",
    "rhsusf_spc_patchless_radio",
    "rhsusf_spc_rifleman",
    "rhsusf_spc_squadleader",
    "rhsusf_spc_teamleader"
];

_availableBackpacks = [
    "B_Kitbag_cbr",
    "B_Parachute",
    "rhsusf_assault_eagleaiii_coy"    
];

_availableweapons = [
    ""
];

_availablemags = [
    ""
];

_availableaccs = [
    ""
];


//Populate with predefined items and whatever is already in the crate
[_crate,((backpackCargo _crate) + _availableBackpacks)] call BIS_fnc_addVirtualBackpackCargo;
[_crate,((itemCargo _crate) + _availableHeadgear + _availableGoggles + _availableUniforms + _availableVests + _availableaccs)] call BIS_fnc_addVirtualItemCargo;
[_crate,(magazineCargo _crate + _availablemags)] call BIS_fnc_addVirtualMagazineCargo;
[_crate,((weaponCargo _crate) + _availableweapons)] call BIS_fnc_addVirtualWeaponCargo;

 

edit: you should also use this so players cannot load their own loadouts with weapons you dont want them to have https://www.dropbox.com/s/l10xioc4crjlb82/override_VA_templates.VR.zip?dl=0

Share this post


Link to post
Share on other sites

Ok so that partially helps me but I still need it to work in first place. What do I put in the init part of the ammo box so that it limits the arsenal to what I have limited it to 

Share this post


Link to post
Share on other sites

this addAction["Open Virtual Arsenal", {null = [_this] execVM "virtual_arsenal_init.sqf";}];

Share this post


Link to post
Share on other sites

Ok so now I am able to scroll on to arsenal but then I get an error message stating.

[BIS_fnc_aresenal] Error: type ARRAY expected OBJECT on index 0 in [[21b2e753580/ 159357: supplydrop.p3d,Zeus,0,<null>], false,(true)]

here is a screen shot as well https://gyazo.com/7ecc26516a5132da08e20060245cb4a0

 

But thanks for helping me so far :D

 

 

Share this post


Link to post
Share on other sites

Have a look at these functions:

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

 

As an example with weapons:
1. You maintain a list with the weapon classnames

example_weapons = [
	"rhs_weap_hk416d10",
	"rhs_weap_hk416d10_LMT",
	"rhs_weap_hk416d10_m320",
	"rhs_weap_hk416d145",
	"rhs_weap_hk416d145_m320",
	"rhs_weap_M107",
	"rhs_weap_M107_d",
	"rhs_weap_M107_w"
];

2. And after loading your weapon (magazines/items/backpacks) list you add them to the virtual arsenal (which is empty in the beginning)

// if running on every client for a box named ammobox
[ammobox, example_weapons] call BIS_fnc_addVirtualWeaponCargo;

// if just running on the server for a box named ammobox
[ammobox, example_weapons, true] call BIS_fnc_addVirtualWeaponCargo;

// if running on every client for a global arsenal open action
[missionNamespace, example_weapons] call BIS_fnc_addVirtualWeaponCargo;

// if just running on the server for a global arsenal open action
[missionNamespace, example_weapons, true] call BIS_fnc_addVirtualWeaponCargo;

 

Do steps 1 - 2 again for magazines, items and backpacks with the appropriate function from above.

 

3. At your desired box (named "ammobox" in this example) where the players should get an arsenal action you just add in the init or after the spawn:

// via script
["AmmoboxInit",[ammobox]] spawn BIS_fnc_arsenal;

// as init line in the editor
null = ["AmmoboxInit",[this]] spawn BIS_fnc_arsenal;

// if you use a action which just should open the arsenal
["Open"] spawn BIS_fnc_arsenal;

 

Share this post


Link to post
Share on other sites
15 minutes ago, Wyqer said:

2. And after loading your weapon (magazines/items/backpacks) list you add them to the virtual arsenal (which is empty in the beginning)


// if running on every client
[missionNamespace, example_weapons] call BIS_fnc_addVirtualWeaponCargo;

// if just running on the server
[missionNamespace, example_weapons, true] call BIS_fnc_addVirtualWeaponCargo;

So due to me running a dedicated server, I need to add the script above. But where do I put this script?

@Wyqer

Share this post


Link to post
Share on other sites

Where you want it. Write a script which is executed after the "reading of your lists" and it's fine.

Share this post


Link to post
Share on other sites

@T_STRONG_SHARK

 

This is what i did for my own mission:

 

- Name your objects/crates etc and add them in the array _crates.

- Put the script in a .sqf file and execute it from your initPlayerLocal

- You do not have to add anything else in your object init.

_crates = [crate1,crate2,etc];

//Lists of items to include
_nvgoggles = [
	"rhsusf_ANPVS_14",
	"rhsusf_ANPVS_15"

_availableHeadgear = [
	"rhsusf_lwh_helmet_marpatd",
	"rhsusf_lwh_helmet_marpatd_ess",
	"rhsusf_lwh_helmet_marpatd_headset",
	"rhs_8point_marpatd"
];

_availableGoggles = [
	"rhsusf_googles_black",
	"rhsusf_googles_yellow",
	"rhsusf_googles_orange",
	"rhsusf_googles_clear",
	"rhsusf_shemagh_tan",
	"rhsusf_shemagh2_tan",
	"rhsusf_shemagh_gogg_tan",
	"rhsusf_shemagh2_gogg_tan",
	"G_Aviator"
];

_availableUniforms = [
	"rhs_uniform_FROG01_d1"
];

_availableVests = [
	"rhsusf_spc",
	"rhsusf_spc_corpsman",
	"rhsusf_spc"_crewman,
	"rhsusf_spc_iar",
	"rhsusf_spc_light",
	"rhsusf_spc_mg",
	"rhsusf_spc_marksman",
	"rhsusf_spc_patchless",
	"rhsusf_spc_patchless_radio",
	"rhsusf_spc_rifleman",
	"rhsusf_spc_squadleader",
	"rhsusf_spc_teamleader"
];

_availableBackpacks = [
	"B_Kitbag_cbr",
	"B_Parachute",
	"rhsusf_assault_eagleaiii_coy"	
];


//Populate with predefined items and whatever is already in the crate
{
   [_x,((backpackCargo _crate) + _availableBackpacks)] call BIS_fnc_addVirtualBackpackCargo;
   [_x,((itemCargo _crate) + _availableHeadgear + _availableGoggles + _availableUniforms + _availableVests)] call    BIS_fnc_addVirtualItemCargo;
   [_x,(magazineCargo _crate)] call BIS_fnc_addVirtualMagazineCargo;
   [_x,(weaponCargo _crate)] call BIS_fnc_addVirtualWeaponCargo;
} forEach _crates;

 

 

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

×