Jump to content
gummybear_qc

How to limit weapons in the Arsenal of a box?

Recommended Posts

So I took a read at this but I don't quite understand how to do it. I do know how to start the arsenal in a box thanks to it but I don't want all the weapons to be allowed, only some custom weapons, sights and magazines. Can I copy the code of a crate made with arsenal from Zeus or do I have to add what I want one by one. And if so one by one, how do I do it exactly? All I read about copying code is just for loadouts, and not actual crate arsenal copy paste.

Share this post


Link to post
Share on other sites

The only way I know, is to add them one by one, which is quite tedious.

Share this post


Link to post
Share on other sites
The only way I know, is to add them one by one, which is quite tedious.

I can cope with it.

How do I do it? I read the wiki page but like I wrote, I can't figure it out.

Share this post


Link to post
Share on other sites

Create box and contents you want via Zeus, with the crate selected press Esc and run the code below from the debugConsole.

_contents = [];
_container = curatorSelected select 0 select 0;
{
_tmp = _container call compile format [ "%1Cargo _this", _x ];
_unique = [];
{
	if !( _x in _unique ) then {
		_unique pushBack _x;
	};
}forEach _tmp;
_contents pushBack _unique;
}forEach [ "backpack", "item", "magazine", "weapon" ];
copyToClipboard str _contents;

Open a txt editor and paste the exported info for safe keeping. Should look something like ..

[["B_Mortar_01_weapon_F"],["U_B_PilotCoveralls","V_Press_F","H_Cap_red"],["HandGrenade","UGL_FlareGreen_F","30Rnd_556x45_Stanag","Laserbatteries"],["arifle_Katiba_F"]]

Go back to the editor, place your crate, paste the code below into its init..

_contents = [["B_Mortar_01_weapon_F"],["U_B_PilotCoveralls","V_Press_F","H_Cap_red"],["HandGrenade","UGL_FlareGreen_F","30Rnd_556x45_Stanag","Laserbatteries"],["arifle_Katiba_F"]];

nul = ["AmmoboxInit",[this,false]] spawn BIS_fnc_arsenal;

clearBackpackCargoGlobal this;
clearItemCargoGlobal this;
clearMagazineCargoGlobal this;
clearWeaponCargoGlobal this;

{
_toAdd = _contents select _forEachIndex;
_fnc = missionNamespace getVariable format [ "BIS_fnc_addVirtual%1Cargo", _x ];
[this, _toAdd, true ] call _fnc;
}forEach [ "backpack", "item", "magazine", "weapon" ];

Replacing the first line, as shown, with the array you exported with the first code.

On previewing the mission, the crate should be empty, with a Arsenal action on it, when opening the arsenal there should be only the items you added plus what ever your currently wearing available to choose from.

Have not put it through much testing other than to make sure that it seemed to be correct. Let me know how you get on.

  • Like 4

Share this post


Link to post
Share on other sites
Create box and contents you want via Zeus, with the crate selected press Esc and run the code below from the debugConsole.

_contents = [];
_container = curatorSelected select 0 select 0;
{
_tmp = _container call compile format [ "%1Cargo _this", _x ];
_unique = [];
{
	if !( _x in _unique ) then {
		_unique pushBack _x;
	};
}forEach _tmp;
_contents pushBack _unique;
}forEach [ "backpack", "item", "magazine", "weapon" ];
copyToClipboard str _contents;

Open a txt editor and paste the exported info for safe keeping. Should look something like ..

[["B_Mortar_01_weapon_F"],["U_B_PilotCoveralls","V_Press_F","H_Cap_red"],["HandGrenade","UGL_FlareGreen_F","30Rnd_556x45_Stanag","Laserbatteries"],["arifle_Katiba_F"]]

Go back to the editor, place your crate, paste the code below into its init..

_contents = [["B_Mortar_01_weapon_F"],["U_B_PilotCoveralls","V_Press_F","H_Cap_red"],["HandGrenade","UGL_FlareGreen_F","30Rnd_556x45_Stanag","Laserbatteries"],["arifle_Katiba_F"]];

nul = ["AmmoboxInit",[this,false]] spawn BIS_fnc_arsenal;

clearBackpackCargoGlobal this;
clearItemCargoGlobal this;
clearMagazineCargoGlobal this;
clearWeaponCargoGlobal this;

{
_toAdd = _contents select _forEachIndex;
_fnc = missionNamespace getVariable format [ "BIS_fnc_addVirtual%1Cargo", _x ];
[this, _toAdd, true ] call _fnc;
}forEach [ "backpack", "item", "magazine", "weapon" ];

Replacing the first line, as shown, with the array you exported with the first code.

On previewing the mission, the crate should be empty, with a Arsenal action on it, when opening the arsenal there should be only the items you added plus what ever your currently wearing available to choose from.

Have not put it through much testing other than to make sure that it seemed to be correct. Let me know how you get on.

Wow. Thank you very much!

Share this post


Link to post
Share on other sites

Create box and contents you want via Zeus, with the crate selected press Esc and run the code below from the debugConsole.

_contents = [];
_container = curatorSelected select 0 select 0;
{
	_tmp = _container call compile format [ "%1Cargo _this", _x ];
	_unique = [];
	{
		if !( _x in _unique ) then {
			_unique pushBack _x;
		};
	}forEach _tmp;
	_contents pushBack _unique;
}forEach [ "backpack", "item", "magazine", "weapon" ];
copyToClipboard str _contents;
Open a txt editor and paste the exported info for safe keeping. Should look something like ..

[["B_Mortar_01_weapon_F"],["U_B_PilotCoveralls","V_Press_F","H_Cap_red"],["HandGrenade","UGL_FlareGreen_F","30Rnd_556x45_Stanag","Laserbatteries"],["arifle_Katiba_F"]]
Go back to the editor, place your crate, paste the code below into its init..

_contents = [["B_Mortar_01_weapon_F"],["U_B_PilotCoveralls","V_Press_F","H_Cap_red"],["HandGrenade","UGL_FlareGreen_F","30Rnd_556x45_Stanag","Laserbatteries"],["arifle_Katiba_F"]];

nul = ["AmmoboxInit",[this,false]] spawn BIS_fnc_arsenal;

clearBackpackCargoGlobal this;
clearItemCargoGlobal this;
clearMagazineCargoGlobal this;
clearWeaponCargoGlobal this;

{
	_toAdd = _contents select _forEachIndex;
	_fnc = missionNamespace getVariable format [ "BIS_fnc_addVirtual%1Cargo", _x ];
	[this, _toAdd, true ] call _fnc;
}forEach [ "backpack", "item", "magazine", "weapon" ];
Replacing the first line, as shown, with the array you exported with the first code.

On previewing the mission, the crate should be empty, with a Arsenal action on it, when opening the arsenal there should be only the items you added plus what ever your currently wearing available to choose from.

Have not put it through much testing other than to make sure that it seemed to be correct. Let me know how you get on.

 

Its working mostly great but after creating a loadout with the created box you cannot re load the loadout. I have allready verifyed my loadouts werent holding anything not in the box by stripping down before creating.

Share this post


Link to post
Share on other sites

 

Its working mostly great but after creating a loadout with the created box you cannot re load the loadout. I have allready verifyed my loadouts werent holding anything not in the box by stripping down before creating.

Not sure if i got this right but i just created a box and paste that last code block you quoted in the boxs init. (Just to save me time making a new list).

I removed everything i was wearing.

Went up to the box and used VA. Took cap, pilot overalls, press vest and katiba.

Saved my VA loadout.

Moved away from the box and removed everything i was wearing.

Went to the box and used VA and loaded the saved loadout.

Everything came back properly.

Share this post


Link to post
Share on other sites

 

Go back to the editor, place your crate, paste the code below into its init..

_contents = [["B_Mortar_01_weapon_F"],["U_B_PilotCoveralls","V_Press_F","H_Cap_red"],["HandGrenade","UGL_FlareGreen_F","30Rnd_556x45_Stanag","Laserbatteries"],["arifle_Katiba_F"]];

nul = ["AmmoboxInit",[this,false]] spawn BIS_fnc_arsenal;

clearBackpackCargoGlobal this;
clearItemCargoGlobal this;
clearMagazineCargoGlobal this;
clearWeaponCargoGlobal this;

{
	_toAdd = _contents select _forEachIndex;
	_fnc = missionNamespace getVariable format [ "BIS_fnc_addVirtual%1Cargo", _x ];
	[this, _toAdd, true ] call _fnc;
}forEach [ "backpack", "item", "magazine", "weapon" ];

Replacing the first line, as shown, with the array you exported with the first code.

On previewing the mission, the crate should be empty, with a Arsenal action on it, when opening the arsenal there should be only the items you added plus what ever your currently wearing available to choose from.

Have not put it through much testing other than to make sure that it seemed to be correct. Let me know how you get on.

 

 

Amazing! Just one more thing. How do you translate this into an .sqf to use with execVM? I want to make a complete NATO Arsenal which is quite a lot to stick in an init box. Nothing I've tried after an hour has worked

Share this post


Link to post
Share on other sites

Just change all the this to _this in that script, and call it from your boxes init like..

this execVM "myCrateLoadout.sqf"

Share this post


Link to post
Share on other sites

Get an odd error doing that.

 

p5etets.png

 

http://i.imgur.com/p5etets.png

 

Tried a NATO basic arms box and aCargobox object.

 

Have to bear with me, not played Arma in a year so I'm rusty and was never that good in the first place :)

 

this execVM "myCrateLoadout.sqf" didnt work so I used null = [this] execVM "ammobox.sqf"; which seemed to run the script but throw up the error.

Share this post


Link to post
Share on other sites

Sorry forgot the nul =

nul = this execVM "myCrateLoadout.sqf"

So yes just remove the [] from around the this.

Share this post


Link to post
Share on other sites

Thanks Larrow.

 

I put together a NATO VA if it's useful to anyone. Needs a bit of work but if it saves someone some time then it's all good.

_contents = [["B_UAV_01_backpack_F",
"B_AssaultPack_khk",
"B_FieldPack_oli",
"B_AssaultPack_dgtl",
"B_AssaultPack_rgr",
"B_AssaultPack_sgg",
"B_AssaultPack_blk",
"B_AssaultPack_cbr",
"B_AssaultPack_mcamo",
"B_Kitbag_mcamo",
"B_Kitbag_sgg",
"B_Kitbag_cbr",
"B_Carryall_oli",
"B_FieldPack_khk",
"B_FieldPack_blk",
"B_FieldPack_oucamo",
"B_FieldPack_cbr",
"B_Carryall_oucamo",
"B_Carryall_khk",
"B_Carryall_cbr",
"B_Parachute",
"B_Kitbag_rgr",
"B_AssaultPack_Kerry",
"B_TacticalPack_oli",
"B_TacticalPack_blk",
"B_TacticalPack_mcamo",
"B_TacticalPack_rgr",
"B_Carryall_mcamo",
"B_Static_Designator_01_weapon_F",
"B_Respawn_TentDome_F",
"B_Respawn_TentA_F",
"B_Respawn_Sleeping_bag_F"],["G_Balaclava_blk",
"G_Balaclava_combat",
"G_Balaclava_lowprofile",
"G_Balaclava_oli",
"G_Bandanna_aviator",
"G_Bandanna_beast",
"G_Bandanna_blk",
"G_Bandanna_khk",
"G_Bandanna_oli",
"G_Bandanna_shades",
"G_Bandanna_sport",
"G_Bandanna_tan",
"G_Combat",
"G_Lowprofile",
"G_Aviator",
"G_Tactical_Clear",
"G_Diving",
"G_B_Diving",
"G_Tactical_Black",
"U_B_CombatUniform_mcam",
"U_B_CombatUniform_mcam_worn",
"U_B_CombatUniform_mcam_tshirt",
"U_B_CombatUniform_mcam_vest",
"U_B_GhillieSuit",
"U_B_HeliPilotCoveralls",
"U_B_PilotCoveralls",
"U_B_Wetsuit",
"U_B_CTRG_1",
"U_B_CTRG_2",
"U_B_CTRG_3",
"U_B_FullGhillie_lsh",
"U_B_FullGhillie_sard",
"U_B_FullGhillie_ard",
"V_Rangemaster_belt",
"V_BandollierB_khk",
"V_BandollierB_rgr",
"V_BandollierB_cbr",
"V_PlateCarrier1_rgr",
"V_PlateCarrier1_blk",
"V_PlateCarrier2_rgr",
"V_PlateCarrierGL_rgr",
"V_PlateCarrierSpec_rgr",
"V_Chestrig_khk",
"V_TacVest_khk",
"V_TacVest_brn",
"V_TacVest_blk",
"V_TacVest_camo",
"V_TacVest_oli",
"V_TacVest_blk_POLICE",
"V_TacVestIR_blk",
"V_RebreatherB",
"V_BandollierB_blk",
"V_Chestrig_rgr",
"V_Chestrig_blk",
"V_BandollierB_oli",
"V_Chestrig_oli",
"V_PlateCarrier_Kerry",
"V_PlateCarrierL_CTRG",
"V_PlateCarrierH_CTRG",
"V_I_G_resistanceLeader_F",
"V_PlateCarrierGL_blk",
"V_PlateCarrierGL_mtp",
"V_PlateCarrierSpec_blk",
"V_PlateCarrierSpec_mtp",
"V_PlateCarrierIAGL_oli",
"H_HelmetB",
"H_Booniehat_khk",
"H_Booniehat_mcamo",
"H_Booniehat_tan",
"H_HelmetB_light",
"H_HelmetCrew_B",
"H_HelmetSpecB",
"H_HelmetSpecB_paint1",
"H_HelmetSpecB_paint2",
"H_HelmetSpecB_blk",
"H_HelmetIA",
"H_Cap_red",
"H_Cap_tan",
"H_Cap_blk",
"H_Cap_blk_CMMG",
"H_Cap_khaki_specops_UK",
"H_Cap_grn",
"H_Cap_grn_BI",
"H_Cap_blu",
"H_Cap_blk_ION",
"H_PilotHelmetFighter_B",
"H_PilotHelmetHeli_B",
"H_CrewHelmetHeli_B",
"H_HelmetSpecB_snakeskin",
"H_HelmetSpecB_sand",
"H_Bandanna_khk",
"H_Bandanna_cbr",
"H_Bandanna_sgg",
"H_Bandanna_gry",
"H_Bandanna_camo",
"H_Bandanna_mcamo",
"H_ShemagOpen_khk",
"H_ShemagOpen_tan",
"H_Beret_blk",
"H_Watchcap_blk",
"H_Watchcap_khk",
"H_Watchcap_camo",
"H_StrawHat",
"H_StrawHat_dark",
"H_Hat_blue",
"H_Hat_brown",
"H_Hat_camo",
"H_Hat_grey",
"H_Hat_checker",
"H_Hat_tan",
"H_HelmetB_camo",
"H_Cap_oli",
"H_Bandanna_khk_hs",
"H_Booniehat_khk_hs",
"H_Cap_oli_hs",
"H_Shemag_olive_hs",
"H_Shemag_olive",
"H_HelmetB_light_sand",
"H_HelmetB_light_black",
"H_HelmetB_light_desert",
"H_HelmetB_light_snakeskin",
"H_HelmetB_light_grass",
"H_HelmetB_sand",
"H_HelmetB_black",
"H_HelmetB_desert",
"H_HelmetB_snakeskin",
"H_HelmetB_grass",
"H_Beret_02",
"H_Beret_Colonel",
"H_Bandanna_surfer_blk",
"H_Bandanna_surfer_grn",
"H_Bandanna_blu",
"H_Bandanna_sand",
"H_Watchcap_cbr",
"H_Cap_usblack",
"H_Cap_surfer",
"H_Cap_police",
"muzzle_snds_M",
"muzzle_snds_H_SW",
"optic_Aco_smg",
"optic_ACO_grn_smg",
"optic_Holosight_smg",
"muzzle_snds_acp",
"optic_DMS",
"optic_Yorris",
"optic_MRD",
"optic_LRPS",
"muzzle_snds_H",
"muzzle_snds_L",
"muzzle_snds_B",
"muzzle_snds_H_MG",
"optic_Arco",
"optic_Hamr",
"optic_Aco",
"optic_ACO_grn",
"optic_Holosight",
"optic_NVS",
"optic_Nightstalker",
"optic_SOS",
"optic_MRCO",
"optic_tws",
"optic_tws_mg",
"acc_flashlight",
"acc_pointer_IR",
"bipod_01_F_snd",
"bipod_01_F_blk",
"bipod_01_F_mtp",
"muzzle_snds_338_black",
"muzzle_snds_338_green",
"muzzle_snds_338_sand",
"muzzle_snds_93mmg",
"muzzle_snds_93mmg_tan",
"optic_AMS",
"optic_AMS_khk",
"optic_AMS_snd",
"optic_KHS_blk",
"optic_KHS_hex",
"optic_KHS_old",
"optic_KHS_tan",
"B_UavTerminal",
"ItemWatch",
"ItemCompass",
"ItemGPS",
"ItemRadio",
"ItemMap",
"NVGoggles",
"NVGoggles_OPFOR",
"NVGoggles_INDEP",
"FirstAidKit",
"Medikit",
"ToolKit"],["Laserbatteries",
"NLAW_F",
"Titan_AA",
"Titan_AT",
"Titan_AP",
"ATMine_Range_Mag",
"APERSMine_Range_Mag",
"APERSBoundingMine_Range_Mag",
"SLAMDirectionalMine_Wire_Mag",
"APERSTripMine_Wire_Mag",
"ClaymoreDirectionalMine_Remote_Mag",
"DemoCharge_Remote_Mag",
"SatchelCharge_Remote_Mag",
"HandGrenade",
"MiniGrenade",
"SmokeShell",
"SmokeShellYellow",
"SmokeShellGreen",
"SmokeShellRed",
"SmokeShellPurple",
"SmokeShellOrange",
"SmokeShellBlue",
"Chemlight_green",
"Chemlight_red",
"Chemlight_yellow",
"Chemlight_blue",
"B_IR_Grenade",
"IEDUrbanSmall_Remote_Mag",
"IEDLandSmall_Remote_Mag",
"IEDUrbanBig_Remote_Mag",
"IEDLandBig_Remote_Mag"],["arifle_MX_F",
"arifle_MX_GL_F",
"arifle_MX_SW_F",
"arifle_MXC_F",
"SMG_01_F",
"hgun_P07_F",
"hgun_Pistol_heavy_01_F",
"launch_Titan_F",
"launch_Titan_short_F",
"launch_NLAW_F",
"launch_B_Titan_F",
"launch_B_Titan_short_F",
"arifle_SDAR_F",
"arifle_MXM_F",
"srifle_LRR_F",
"srifle_DMR_03_F",
"srifle_DMR_02_F",
"MMG_02_black_F",
"Rangefinder",
"MineDetector",
"Binocular",
"Laserdesignator"]];

nul = ["AmmoboxInit",[_this,false]] spawn BIS_fnc_arsenal;

clearBackpackCargoGlobal _this;
clearItemCargoGlobal _this;
clearWeaponCargoGlobal _this;

{
	_toAdd = _contents select _forEachIndex;
	_fnc = missionNamespace getVariable format [ "BIS_fnc_addVirtual%1Cargo", _x ];
	[_this, _toAdd, true ] call _fnc;
}forEach [ "backpack", "item", "magazine", "weapon" ];
  • Like 2

Share this post


Link to post
Share on other sites

Larrow (or anyone who has figured this out!), do you know how to get a "blacklist" of things that you don't want to appear in a VA crate? The wiki entry doesn't seem to work right.

 

What I want to do is create a VA crate and restrict a few particular things from appearing in the crate, but I want the crate to have roughly 99.9% of the possible gear that a "full" VA crate has.

 

These don't seem to be working on a normally-created crate (i.e., one spawned via  0 = ["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal; )

BIS_fnc_removeVirtualBackpackCargo

BIS_fnc_removeVirtualItemCargo

BIS_fnc_removeVirtualMagazineCargo

BIS_fnc_removeVirtualWeaponCargo

 

If anyone has got this working as described, please explain the process you're using to spawn the crate and the code/method for blacklisting a few gear things.

 

Thanks!

Share this post


Link to post
Share on other sites
["AmmoboxInit",[<box>,(<allowAll>,<condition>)]] spawn BIS_fnc_arsenal;

When you create an arsenal box by using true as <allowAll> a string of "%All" is inserted into the category array for each items,weapons,magazines and backpacks.

You can see this array by using the debugConsole, look at your <box> in game and then in the debugConsole type

cursortarget getvariable "bis_addVirtualWeaponCargo_cargo"

it will return an array of [["%ALL"],["%ALL"],["%ALL"],["%ALL"]]

 

When using one of the BIS_fnc_addVirtual#Cargo functions the array of items passed is added to its corresponding array e.g

[myBox,["arifle_MX_ACO_pointer_F"],true] call BIS_fnc_addVirtualWeaponCargo;

the array will now look like [["%ALL"],["%ALL","arifle_MX_ACO_pointer_F"],["%ALL"],["%ALL"]]

 

 

When using one of the BIS_fnc_removeVirtual#Cargo functions the array of items passed is removed from its corresponding array e.g

0 = ["AmmoboxInit",[myBox,true]] spawn BIS_fnc_arsenal;

// [["%ALL"],["%ALL"],["%ALL"],["%ALL"]]

[myBox,["arifle_MX_ACO_pointer_F","hgun_P07_F"],true] call BIS_fnc_addVirtualWeaponCargo;

// [["%ALL"],["%ALL","arifle_MX_ACO_pointer_F","hgun_P07_F"],["%ALL"],["%ALL"]]

[myBox,["arifle_MX_ACO_pointer_F"],true] call BIS_fnc_removeVirtualWeaponCargo;

// [["%ALL"],["%ALL","hgun_P07_F"],["%ALL"],["%ALL"]]

It is not possible to remove an item that has not been specifically added via a BIS_fnc_addVirtual#Cargo. If using <allowAll> true when creating your arsenal box a special string of "%ALL" is added to the box, when the arsenal finds this value it will add all available classes to the display. To remove "%ALL" for a certain type you can use

[myBox,true,true] call BIS_fnc_removeVirtual#Cargo

To have everything minus a few items you would first have to create an arsenal box using <allowAll> false, then specifically add everything via the addVirtual#Cargo functions except the bits you dont want.

 

Here is a quick function to add all available stuff to a box. I can not stress enough that i have put this through very little testing other than to quickly look at a box in the editor preview to see if the contents looked about right.

//[ myBox, isGlobal ] call LARs_fnc_addAllVirtualCargo;

LARs_fnc_addAllVirtualCargo = {

    if !( params [
        [ "_box", objNull, [ objNull ] ]
    ] ) exitWith {};

    _isGlobal = param[ 1, false, [ false ] ];
    if ( _isGlobal ) exitWith {
        [ _box ] remoteExec [ "LARs_fnc_addAllVirtualCargo", 0, true ];
    };

    _fnc_linkedItems = {
        "
            if ( isText( _x >> 'Item' ) ) then {
                [ _box, getText( _x >> 'Item' ), false ] call BIS_fnc_addVirtualItemCargo;
            };
        "configClasses _this;
    };


    {
        "
            if ( getNumber( _x >> 'scope' ) isEqualTo 2 ) then {
                _configName = configName _x;
                _itemType = _configName call BIS_fnc_itemType;
                if !( ( _itemType select 0 ) isEqualTo '' ) then {
                    switch ( _itemType select 0 ) do {
                        case 'Item' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualItemCargo;
                        };
                        case 'Weapon' : {
                            if !( ( _itemType select 1 ) isEqualTo 'VehicleWeapon' ) then {
                                if ( ( _configName call BIS_fnc_baseWeapon ) isEqualTo _configName ) then {
                                    [ _box, _configName, false ] call BIS_fnc_addVirtualWeaponCargo;
                                }else{
                                    ( _x >> 'LinkedItems' ) call _fnc_linkedItems;
                                };
                            };
                        };
                        case 'Magazine' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualMagazineCargo;
                        };
                        case 'Mine' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualMagazineCargo;
                        };
                        case 'Equipment' : {
                            if ( ( _itemType select 1 ) isEqualTo 'Backpack' ) then {
                                [ _box, _configName, false ] call BIS_fnc_addVirtualBackpackCargo;
                            }else{
                                [ _box, _configName, false ] call BIS_fnc_addVirtualItemCargo;
                            };
                        };
                    };
                };
            };
        "configClasses _x;
    }forEach [
        ( configFile >> "CfgWeapons" ),
        ( configFile >> "CfgMagazines" ),
        ( configFile >> "CfgVehicles" ),
        ( configFile >> "CfgGlasses" )
    ];

};

Usage will vary depending on how you implement the function, but something like the below to initialise your box with arsenal.

0 = ["AmmoboxInit",[myBox,false]] call BIS_fnc_arsenal;

[myBox,true] call LARs_fnc_addAllVirtualCargo;

Followed by any BIS_fnc_removeVirtual#Cargo commands to remove what you dont want.

  • Like 2

Share this post


Link to post
Share on other sites

As always, Larrow comes to the rescue :)

 

I tried your blacklist script tonight but for some reason I seem not to be able to get it to working correctly. Here is my arsenal.sqf:

////-------------------------------////
////***Function to limit Arsenal***////
////-------------------------------////

//[ myBox, isGlobal ] call LARs_fnc_addAllVirtualCargo;

LARs_fnc_addAllVirtualCargo = {
 
    if !( params [
        [ "_box", objNull, [ objNull ] ]
    ] ) exitWith {};
 
    _isGlobal = param[ 1, false, [ false ] ];
    if ( _isGlobal ) exitWith {
        [ _box ] remoteExec [ "LARs_fnc_addAllVirtualCargo", 0, true ];
    };
 
    _fnc_linkedItems = {
        "
            if ( isText( _x >> 'Item' ) ) then {
                [ _box, getText( _x >> 'Item' ), false ] call BIS_fnc_addVirtualItemCargo;
            };
        "configClasses _this;
    };
 
 
    {
        "
            if ( getNumber( _x >> 'scope' ) isEqualTo 2 ) then {
                _configName = configName _x;
                _itemType = _configName call BIS_fnc_itemType;
                if !( ( _itemType select 0 ) isEqualTo '' ) then {
                    switch ( _itemType select 0 ) do {
                        case 'Item' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualItemCargo;
                        };
                        case 'Weapon' : {
                            if !( ( _itemType select 1 ) isEqualTo 'VehicleWeapon' ) then {
                                if ( ( _configName call BIS_fnc_baseWeapon ) isEqualTo _configName ) then {
                                    [ _box, _configName, false ] call BIS_fnc_addVirtualWeaponCargo;
                                }else{
                                    ( _x >> 'LinkedItems' ) call _fnc_linkedItems;
                                };
                            };
                        };
                        case 'Magazine' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualMagazineCargo;
                        };
                        case 'Mine' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualMagazineCargo;
                        };
                        case 'Equipment' : {
                            if ( ( _itemType select 1 ) isEqualTo 'Backpack' ) then {
                                [ _box, _configName, false ] call BIS_fnc_addVirtualBackpackCargo;
                            }else{
                                [ _box, _configName, false ] call BIS_fnc_addVirtualItemCargo;
                            };
                        };
                    };
                };
            };
        "configClasses _x;
    }forEach [
        ( configFile >> "CfgWeapons" ),
        ( configFile >> "CfgMagazines" ),
        ( configFile >> "CfgVehicles" ),
        ( configFile >> "CfgGlasses" )
    ];
 
};
////--------End Function-----------////



////-------------------------------////
////**********Begin Main***********////
////-------------------------------////

//*Init Field of Box:
//null = [this] execVM "scripts\arsenalbox.sqf";

_ammoBox = _this select 0;

["AmmoboxInit",[_ammoBox,false]] spawn BIS_fnc_arsenal;

[_ammoBox,true] call LARs_fnc_addAllVirtualCargo;

_blacklistWeapons = ["CAF_AK47","CAF_AK74","CAF_PKM","CAF_RPG7","CAF_RPK74","CAF_STRELA","CAF_SVD"]

[_ammoBox,_blacklistWeapons,true] spawn BIS_fnc_removeVirtualWeaponCargo; // removes weapons from the virtualArsenal of the object myAmmoBox

Let me know if I did anything wrong.

Cheers 

Twak

Share this post


Link to post
Share on other sites

Use call on BIS_fnc_arsenal, or at least wait for the script to finish before running my function. And your missing a ; at the end of your blacklist array. Think that should do it. Let me know how you get on.

Changed my previous example to reflect this.

  • Like 1

Share this post


Link to post
Share on other sites

Use call on BIS_fnc_arsenal, or at least wait for the script to finish before running my function. And your missing a ; at the end of your blacklist array. Think that should do it. Let me know how you get on.

Changed my previous example to reflect this.

A yes that makes sense. Wanted to actually make your function a cfgFunction but was too lazy. 

And sorry for the stupid error with regards to the ";". Now I feel dumb :(

I will try it this afternoon and let you know the results but I think it will work perfectly!

Twak.

Share this post


Link to post
Share on other sites

This looks great. So if I want to blacklist a backpack, like "B_Mortar_01_weapon_F", would I list it in the _blacklistWeapons array or create a separate one (like _blacklistBackpacks) and run a line like

[_ammoBox,_blacklistBackpacks,true] spawn BIS_fnc_removeVirtualBackpackCargo; 

?

Share this post


Link to post
Share on other sites

This looks great. So if I want to blacklist a backpack, like "B_Mortar_01_weapon_F", would I list it in the _blacklistWeapons array or create a separate one (like _blacklistBackpacks) and run a line like

[_ammoBox,_blacklistBackpacks,true] spawn BIS_fnc_removeVirtualBackpackCargo;

?

 

Yes precisely. Here is my main loop I currently use:

_ammoBox = _this select 0;

_blacklistWeapons = ["CAF_AK47","CAF_AK74","CAF_AK74GL","CAF_PKM","CAF_RPG7","CAF_RPK74","CAF_STRELA","CAF_SVD"];
_blacklistMagazines = ["CAF_30RND_762x39_AK","CAF_30RND_545x39_AK","CAF_100RND_762x54_PKM","CAF_PG7V","CAF_OG7","CAF_75RND_545x39_RPK","CAF_AA_ROCKET","CAF_10RND_762X54_SVD"];
_blacklistItems = [];
_blacklistBackpacks = [];

["AmmoboxInit",[_ammoBox,false]] call BIS_fnc_arsenal;

[_ammoBox,true] call LARs_fnc_addAllVirtualCargo;

[_ammoBox,_blacklistWeapons,false] spawn BIS_fnc_removeVirtualWeaponCargo; // removes weapons from the virtualArsenal of the object myAmmoBox
[_ammoBox,_blacklistMagazines,false] spawn BIS_fnc_removeVirtualMagazineCargo; // removes ammotypes from the virtualArsenal of the object myAmmoBox
//[_ammoBox,_blacklistItems,false] spawn BIS_fnc_removeVirtualItemCargo; // removes weapons from the virtualArsenal of the object myAmmoBox
//[_ammoBox,_blacklistBackpacks,false] spawn BIS_fnc_removeVirtualBackpackCargo; // removes ammotypes from the virtualArsenal of the object myAmmoBox

Where when I have items or backpacks to blacklist, I just add them to the arrays and uncomment the appropriate "BIS_fnc_remove*Cargo" command line.

 

If you are going to use it publicly, just remember to give credit to Larrow for his amazing script. :)

 

Cheers

Twak.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, Twak (and Larrow!). I see some differences between the original posted script and this. I tried using the latest version there, and it's not working. So I will do a little testing and get back to you. I'm probably doing something wrong!

Share this post


Link to post
Share on other sites

OK, I don't get it. I have a feeling there are 1 or 2 small problems that are keeping this from working. I'd be very grateful to the person who can find the issue(s)!

 

Here's my version of what Twak posted. -BTW, what's the point of the first (commented out) line?

//[ myBox, isGlobal ] call LARs_fnc_addAllVirtualCargo;

LARs_fnc_addAllVirtualCargo = {

    if !( params [
        [ "_box", objNull, [ objNull ] ]
    ] ) exitWith {};

    _isGlobal = param[ 1, false, [ false ] ];
    if ( _isGlobal ) exitWith {
        [ _box ] remoteExec [ "LARs_fnc_addAllVirtualCargo", 0, true ];
    };

    _fnc_linkedItems = {
        "
            if ( isText( _x >> 'Item' ) ) then {
                [ _box, getText( _x >> 'Item' ), false ] call BIS_fnc_addVirtualItemCargo;
            };
        "configClasses _this;
    };


    {
        "
            if ( getNumber( _x >> 'scope' ) isEqualTo 2 ) then {
                _configName = configName _x;
                _itemType = _configName call BIS_fnc_itemType;
                if !( ( _itemType select 0 ) isEqualTo '' ) then {
                    switch ( _itemType select 0 ) do {
                        case 'Item' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualItemCargo;
                        };
                        case 'Weapon' : {
                            if !( ( _itemType select 1 ) isEqualTo 'VehicleWeapon' ) then {
                                if ( ( _configName call BIS_fnc_baseWeapon ) isEqualTo _configName ) then {
                                    [ _box, _configName, false ] call BIS_fnc_addVirtualWeaponCargo;
                                }else{
                                    ( _x >> 'LinkedItems' ) call _fnc_linkedItems;
                                };
                            };
                        };
                        case 'Magazine' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualMagazineCargo;
                        };
                        case 'Mine' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualMagazineCargo;
                        };
                        case 'Equipment' : {
                            if ( ( _itemType select 1 ) isEqualTo 'Backpack' ) then {
                                [ _box, _configName, false ] call BIS_fnc_addVirtualBackpackCargo;
                            }else{
                                [ _box, _configName, false ] call BIS_fnc_addVirtualItemCargo;
                            };
                        };
                    };
                };
            };
        "configClasses _x;
    }forEach [
        ( configFile >> "CfgWeapons" ),
        ( configFile >> "CfgMagazines" ),
        ( configFile >> "CfgVehicles" ),
        ( configFile >> "CfgGlasses" )
    ];

};

_ammoBox = _this select 0;

_blacklistWeapons = ["launch_B_Titan_short_F", "launch_I_Titan_short_F", "launch_O_Titan_short_F"];


_blacklistBackpacks = [
    "I_GMG_01_A_weapon_F",
    "B_GMG_01_A_weapon_F",
    "O_GMG_01_A_weapon_F",
    "I_HMG_01_A_weapon_F",
    "B_HMG_01_A_weapon_F",
    "O_HMG_01_A_weapon_F",
    "I_Mortar_01_support_F",
    "B_Mortar_01_support_F",
    "O_Mortar_01_support_F",
    "I_Mortar_01_weapon_F",
    "B_Mortar_01_weapon_F",
    "O_Mortar_01_weapon_F"
    ];

_blacklistMagazines = [
    "ATMine_Range_Mag",
    "SLAMDirectionalMine_wire_Ammo",
    "rhs_mine_tm62m_ammo"
    ];

_blacklistItems = [
    ];



["AmmoboxInit",[_ammoBox,false]] call BIS_fnc_arsenal;

[_ammoBox,true] call LARs_fnc_addAllVirtualCargo;

[_ammoBox,_blacklistWeapons,false] spawn BIS_fnc_removeVirtualWeaponCargo; // removes weapons from the virtualArsenal of the object _ammoBox
[_ammoBox,_blacklistMagazines,true] spawn BIS_fnc_removeVirtualMagazineCargo; // removes magazines from the virtualArsenal of the object _ammoBox
[_ammoBox,_blacklistBackpacks,true] spawn BIS_fnc_removeVirtualBackpackCargo; // removes backpacks from the virtualArsenal of the object _ammoBox
[_ammoBox,_blacklistItems,true] spawn BIS_fnc_removeVirtualItemCargo; // removes items from the virtualArsenal of the object _ammoBox

Share this post


Link to post
Share on other sites

 

OK, I don't get it. I have a feeling there are 1 or 2 small problems that are keeping this from working. I'd be very grateful to the person who can find the issue(s)!

 

Here's my version of what Twak posted. -BTW, what's the point of the first (commented out) line?

 

 

Just ignore or remove the commented stuff. I literally just copied and pasted Larrows script.

 

Okay so I tested your script and it works perfectly on my end. The Titan short launchers were not available and the Autonomous GMG and HMG's where not present (Didnt look at the mortars since I dont know which mortars those refers to.). I also commented out the magazines because I didnt have RHS running at the time. This is the main I used:

_ammoBox = _this select 0;

_blacklistWeapons = ["launch_B_Titan_short_F", "launch_I_Titan_short_F", "launch_O_Titan_short_F"];

_blacklistBackpacks = [
    "I_GMG_01_A_weapon_F",
    "B_GMG_01_A_weapon_F",
    "O_GMG_01_A_weapon_F",
    "I_HMG_01_A_weapon_F",
    "B_HMG_01_A_weapon_F",
    "O_HMG_01_A_weapon_F",
    "I_Mortar_01_support_F",
    "B_Mortar_01_support_F",
    "O_Mortar_01_support_F",
    "I_Mortar_01_weapon_F",
    "B_Mortar_01_weapon_F",
    "O_Mortar_01_weapon_F"
    ];

/*_blacklistMagazines = [
    "ATMine_Range_Mag",
    "SLAMDirectionalMine_wire_Ammo",
    "rhs_mine_tm62m_ammo"
     ]; */

//_blacklistItems = [ ];

["AmmoboxInit",[_ammoBox,false]] call BIS_fnc_arsenal;

[_ammoBox,true] call LARs_fnc_addAllVirtualCargo;

[_ammoBox,_blacklistWeapons,false] spawn BIS_fnc_removeVirtualWeaponCargo; // removes weapons from the virtualArsenal of the object _ammoBox
//[_ammoBox,_blacklistMagazines,false] spawn BIS_fnc_removeVirtualMagazineCargo; // removes magazines from the virtualArsenal of the object _ammoBox
[_ammoBox,_blacklistBackpacks,false] spawn BIS_fnc_removeVirtualBackpackCargo; // removes backpacks from the virtualArsenal of the object _ammoBox
//[_ammoBox,_blacklistItems,false] spawn BIS_fnc_removeVirtualItemCargo; // removes items from the virtualArsenal of the object _ammoBox

And this is the script I placed in the ammobos init in the editor:

null = [this] execVM "arsenalboxTest.sqf";

Let me know if you are still struggling.

Cheers

C

Share this post


Link to post
Share on other sites

First, thanks, Twak, for this help. I really appreciate it. 

 

I'm stumped! I am using this code, with the same thing to initiate it in the box's init box, and I can't stop the Titan's from showing up (I can't stop ANYTHING from showing up). I tried launching without our usual mods, but no change. I tried creating a clean mission with nothing else in it, but no dice. 

 

So I'm guessing that you and I, Twak, are making some different assumption about what we're doing. Let me go step by step and see if we can find it.

 

I've got a Land_CargoBox_V1_F object with this in its init box: 

null = [this] execVM "scripts\blacklistTest.sqf";

And blacklistTest.sqf looks like this:


//LARROW FUNCTION TO FILL CRATE WITH EVERYTHING SO THAT BLACKLISTING WORKS
LARs_fnc_addAllVirtualCargo = {

    if !( params [
        [ "_box", objNull, [ objNull ] ]
    ] ) exitWith {};

    _isGlobal = param[ 1, false, [ false ] ];
    if ( _isGlobal ) exitWith {
        [ _box ] remoteExec [ "LARs_fnc_addAllVirtualCargo", 0, true ];
    };

    _fnc_linkedItems = {
        "
            if ( isText( _x >> 'Item' ) ) then {
                [ _box, getText( _x >> 'Item' ), false ] call BIS_fnc_addVirtualItemCargo;
            };
        "configClasses _this;
    };


    {
        "
            if ( getNumber( _x >> 'scope' ) isEqualTo 2 ) then {
                _configName = configName _x;
                _itemType = _configName call BIS_fnc_itemType;
                if !( ( _itemType select 0 ) isEqualTo '' ) then {
                    switch ( _itemType select 0 ) do {
                        case 'Item' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualItemCargo;
                        };
                        case 'Weapon' : {
                            if !( ( _itemType select 1 ) isEqualTo 'VehicleWeapon' ) then {
                                if ( ( _configName call BIS_fnc_baseWeapon ) isEqualTo _configName ) then {
                                    [ _box, _configName, false ] call BIS_fnc_addVirtualWeaponCargo;
                                }else{
                                    ( _x >> 'LinkedItems' ) call _fnc_linkedItems;
                                };
                            };
                        };
                        case 'Magazine' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualMagazineCargo;
                        };
                        case 'Mine' : {
                            [ _box, _configName, false ] call BIS_fnc_addVirtualMagazineCargo;
                        };
                        case 'Equipment' : {
                            if ( ( _itemType select 1 ) isEqualTo 'Backpack' ) then {
                                [ _box, _configName, false ] call BIS_fnc_addVirtualBackpackCargo;
                            }else{
                                [ _box, _configName, false ] call BIS_fnc_addVirtualItemCargo;
                            };
                        };
                    };
                };
            };
        "configClasses _x;
    }forEach [
        ( configFile >> "CfgWeapons" ),
        ( configFile >> "CfgMagazines" ),
        ( configFile >> "CfgVehicles" ),
        ( configFile >> "CfgGlasses" )
    ];

};


//BEGIN MAIN SECTION//////////////////////////////////////

_ammoBox = _this select 0;

_blacklistWeapons = ["launch_B_Titan_short_F", "launch_I_Titan_short_F", "launch_O_Titan_short_F"];

_blacklistBackpacks = [
    "I_GMG_01_A_weapon_F",
    "B_GMG_01_A_weapon_F",
    "O_GMG_01_A_weapon_F",
    "I_HMG_01_A_weapon_F",
    "B_HMG_01_A_weapon_F",
    "O_HMG_01_A_weapon_F",
    "I_Mortar_01_support_F",
    "B_Mortar_01_support_F",
    "O_Mortar_01_support_F",
    "I_Mortar_01_weapon_F",
    "B_Mortar_01_weapon_F",
    "O_Mortar_01_weapon_F"
    ];

/*_blacklistMagazines = [
    "ATMine_Range_Mag",
    "SLAMDirectionalMine_wire_Ammo",
    "rhs_mine_tm62m_ammo"
     ]; */

//_blacklistItems = [ ];

["AmmoboxInit",[_ammoBox,false]] call BIS_fnc_arsenal;

[_ammoBox,true] call LARs_fnc_addAllVirtualCargo;

[_ammoBox,_blacklistWeapons,false] spawn BIS_fnc_removeVirtualWeaponCargo; // removes weapons from the virtualArsenal of the object _ammoBox
//[_ammoBox,_blacklistMagazines,false] spawn BIS_fnc_removeVirtualMagazineCargo; // removes magazines from the virtualArsenal of the object _ammoBox
[_ammoBox,_blacklistBackpacks,false] spawn BIS_fnc_removeVirtualBackpackCargo; // removes backpacks from the virtualArsenal of the object _ammoBox
//[_ammoBox,_blacklistItems,false] spawn BIS_fnc_removeVirtualItemCargo; // removes items from the virtualArsenal of the object _ammoBox

When I get in game, I give it 15 seconds for all the initialization to get settled. Then I try to use the Arsenal action on the crate. ...and everything is there, including the Titans.

 

Is there anything else, anywhere, that you're doing? In the init box? In the script? In the init.sqf or description.ext??

 

This is making me crazy!

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

×