Jump to content
Riouken

[Working] MP ammo box script

Recommended Posts

This is a WORKING ammo box script. I have seen quite a few posts for class names and a lot of people are posting class names that don't work currently.

This has all the working items in game that I can find so far, no errors or blanks in the ammo box. You should be able to put on most of this gear and attachments.(But I have not tried every singe one).

It will refil every 500 seconds. You can change that at the bottom of the script.

thanks to porter707 I mixed some of his classnames and corrected all of his broken ones with the ones I found.

Put this in the init of your ammo box.

nul =[this] execVM "ammo_box.sqf";

ammo_box.sqf

/////////   MP Ammo Box script
/////////   By: Riouken
/////////   For Arma 3

if (! isServer) exitWith {};


_crate = _this select 0;




while {alive _crate} do
{


clearMagazineCargo _crate;
clearWeaponCargo _crate;
clearItemCargoGlobal _crate;
///NATO Weapons///


_crate addWeaponCargoGlobal ["arifle_MX_F", 50];
_crate addWeaponCargoGlobal ["arifle_MX_GL_F", 50];
_crate addWeaponCargoGlobal ["arifle_MXC_F", 50];
_crate addWeaponCargoGlobal ["arifle_TRG20_F", 50];
_crate addWeaponCargoGlobal ["arifle_TRG21_F", 50];
_crate addWeaponCargoGlobal ["arifle_TRG21_GL_F", 50];
//_crate addWeaponCargoGlobal ["arifle_MSM_F", 50];
_crate addWeaponCargoGlobal ["srifle_EBR_F", 50];
_crate addWeaponCargoGlobal ["LMG_Mk200_F", 50];






///OPFOR Weapons////
_crate addWeaponCargoGlobal ["arifle_Khaybar_F", 50];
_crate addWeaponCargoGlobal ["arifle_Khaybar_C_F", 50];
_crate addWeaponCargoGlobal ["arifle_Khaybar_GL_F", 50];
_crate addWeaponCargoGlobal ["hgun_rook40_F", 50];


///AMMO///


_crate addMagazineCargoGlobal ["30Rnd_65x39_Caseless_mag", 200];
_crate addMagazineCargoGlobal ["100Rnd_65x39_Caseless_mag", 200];
_crate addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag_Tracer", 200];
_crate addMagazineCargoGlobal ["100Rnd_65x39_caseless_mag_Tracer", 200];
//_crate addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag_green", 200];
_crate addMagazineCargoGlobal ["30Rnd_65x39_case_mag", 200];
_crate addMagazineCargoGlobal ["20Rnd_762x45_Mag", 200];
_crate addMagazineCargoGlobal ["16Rnd_9x21_Mag", 200];
_crate addMagazineCargoGlobal ["30Rnd_9x21_Mag", 200];
_crate addMagazineCargoGlobal ["20Rnd_556x45_UW_Mag", 200];
_crate addMagazineCargoGlobal ["30RND_556x45_Stanag", 200];
_crate addMagazineCargoGlobal ["200RND_65x39_Cased_box_Tracer", 200];


////Launchers////


_crate addWeaponCargoGlobal ["launch_NLAW_F", 50];
_crate addWeaponCargoGlobal ["launch_RPG32_F", 50];


////Launcher Ammo////


_crate addMagazineCargoGlobal ["RPG32_F", 50];
_crate addMagazineCargoGlobal ["NLAW_F", 50];


/////Explosives////


_crate addMagazineCargoGlobal ["ATMine_Range_Mag", 50];
_crate addMagazineCargoGlobal ["APERSMine_Range_Mag", 50];
_crate addMagazineCargoGlobal ["ClaymoreDirectionalMine_Remote_Mag", 50];
_crate addMagazineCargoGlobal ["DemoCharge_Remote_Mag", 50];
_crate addMagazineCargoGlobal ["APERSBoundingMine_Range_Mag", 50];
_crate addMagazineCargoGlobal ["SLAMDirectionalMine_Wire_Mag", 50];
_crate addMagazineCargoGlobal ["APERSTripMine_Wire_Mag", 50];
_crate addWeaponCargoGlobal ["ToolKit", 50];
_crate addWeaponCargoGlobal ["MineDetector", 50];
_crate addWeaponCargoGlobal ["Medikit", 50];




/////Grenades////


_crate addMagazineCargoGlobal ["1Rnd_HE_Grenade_shell", 50];
_crate addMagazineCargoGlobal ["1Rnd_Smoke_Grenade_shell", 50];
_crate addMagazineCargoGlobal ["1Rnd_SmokeGreen_Grenade_shell", 50];
_crate addMagazineCargoGlobal ["1Rnd_SmokeYellow_Grenade_shell", 50];
_crate addMagazineCargoGlobal ["1Rnd_SmokePurple_Grenade_shell", 50];
_crate addMagazineCargoGlobal ["1Rnd_SmokeBlue_Grenade_shell", 50];
_crate addMagazineCargoGlobal ["1Rnd_SmokeOrange_Grenade_shell", 50];
_crate addMagazineCargoGlobal ["SmokeShellRed", 50];
_crate addMagazineCargoGlobal ["SmokeShell", 50];
_crate addMagazineCargoGlobal ["SmokeShellGreen", 50];
_crate addMagazineCargoGlobal ["SmokeShellYellow", 50];
_crate addMagazineCargoGlobal ["SmokeShellPurple", 50];
_crate addMagazineCargoGlobal ["SmokeShellBlue", 50];
_crate addMagazineCargoGlobal ["SmokeShellOrange", 50];


///Attachments///


_crate addItemCargoGlobal ["Zasleh2",50]; 
_crate addItemCargoGlobal ["muzzle_snds_H", 50]; 
_crate addItemCargoGlobal ["muzzle_snds_L", 50]; 
_crate addItemCargoGlobal ["muzzle_snds_B", 50]; 
_crate addItemCargoGlobal ["muzzle_snds_H_MG", 50]; 
_crate addItemCargoGlobal ["optic_Arco", 50]; 
_crate addItemCargoGlobal ["optic_Hamr", 50]; 
_crate addItemCargoGlobal ["optic_Aco", 50]; 
_crate addItemCargoGlobal ["optic_ACO_grn",50]; 
_crate addItemCargoGlobal ["optic_Holosight", 50]; 
_crate addItemCargoGlobal ["acc_flashlight", 50]; 
_crate addItemCargoGlobal ["acc_pointer_IR", 50];


////Items////


/////Items////


_crate addItemCargoGlobal ["FirstAidKit", 50];
_crate addItemCargoGlobal ["Toolkit", 50];


////Uniforms(working)////


_crate addItemCargoGlobal ["U_BasicBody", 50];
_crate addItemCargoGlobal ["U_B_CombatUniform_mcam", 50];
_crate addItemCargoGlobal ["U_B_CombatUniform_mcam_tshirt", 50];
_crate addItemCargoGlobal ["U_B_CombatUniform_mcam_vest", 50];
_crate addItemCargoGlobal ["U_B_HeliPilotCoveralls", 50];
_crate addItemCargoGlobal ["U_B_Wetsuit", 50];
_crate addItemCargoGlobal ["U_OI_CombatUniform_ocamo", 50];
_crate addItemCargoGlobal ["U_OI_PilotCoveralls", 50];
_crate addItemCargoGlobal ["U_OI_Wetsuit", 50];
_crate addItemCargoGlobal ["U_C_Poloshirt_blue", 50];
_crate addItemCargoGlobal ["U_C_Poloshirt_burgundy", 50];
_crate addItemCargoGlobal ["U_C_Poloshirt_stripped", 50];
_crate addItemCargoGlobal ["U_C_Poloshirt_tricolour", 50];
_crate addItemCargoGlobal ["U_C_Poloshirt_salmon", 50];
_crate addItemCargoGlobal ["U_C_Poloshirt_redwhite", 50];
_crate addItemCargoGlobal ["U_C_Commoner1_1", 50];
_crate addItemCargoGlobal ["U_C_Commoner1_2", 50];
_crate addItemCargoGlobal ["U_C_Commoner1_3", 50];
_crate addItemCargoGlobal ["U_Rangemaster", 50];


////Vests(working)////


_crate addItemCargoGlobal ["V_Rangemaster_belt", 50];
_crate addItemCargoGlobal ["V_BandollierB_khk", 50];
_crate addItemCargoGlobal ["V_BandollierB_rgr", 50];
_crate addItemCargoGlobal ["V_BandollierB_cbr", 50];
_crate addItemCargoGlobal ["V_PlateCarrier1_rgr", 50];
_crate addItemCargoGlobal ["V_PlateCarrier1_cbr", 50];
_crate addItemCargoGlobal ["V_PlateCarrier2_rgr", 50];
_crate addItemCargoGlobal ["V_PlateCarrierGL_rgr", 50];
_crate addItemCargoGlobal ["V_Chestrig_khk", 50];
_crate addItemCargoGlobal ["V_ChestrigB_rgr", 50];
_crate addItemCargoGlobal ["V_TacVest_khk", 50];
_crate addItemCargoGlobal ["V_TacVest_brn", 50];
_crate addItemCargoGlobal ["V_TacVest_oli", 50];
_crate addItemCargoGlobal ["V_HarnessO_brn", 50];
_crate addItemCargoGlobal ["V_HarnessOGL_brn", 50];
_crate addItemCargoGlobal ["V_RebreatherB", 50];
_crate addItemCargoGlobal ["V_RebreatherIR", 50];


////Helmets(working)////
_crate addItemCargoGlobal ["H_HelmetB", 50];
_crate addItemCargoGlobal ["H_Booniehat_khk", 50];
_crate addItemCargoGlobal ["H_Booniehat_mcamo", 50];
_crate addItemCargoGlobal ["H_Booniehat_ocamo", 50];
_crate addItemCargoGlobal ["H_HelmetB_paint", 50];
_crate addItemCargoGlobal ["H_HelmetB_light", 50];
_crate addItemCargoGlobal ["H_Cap_red", 50];
_crate addItemCargoGlobal ["H_Cap_brn_SERO", 50];
_crate addItemCargoGlobal ["H_Cap_blu", 50];
_crate addItemCargoGlobal ["H_Cap_headphones", 50];
_crate addItemCargoGlobal ["H_PilotHelmetHeli_B", 50];
_crate addItemCargoGlobal ["H_PilotHelmetHeli_O", 50];
_crate addItemCargoGlobal ["H_HelmetO_ocamo", 50];
_crate addItemCargoGlobal ["H_MilCap_ocamo", 50];
_crate addItemCargoGlobal ["H_MilCap_mcamo", 50];


sleep 500;
};

Share this post


Link to post
Share on other sites

Thanks, when yous say uniforms are working do you just mean these are the ones that are finished in this release of the Alpha? The reason I ask is I haven't found a way to change uniform at the ammo box.

Share this post


Link to post
Share on other sites

uniforms are limited to your side, like the civ and the opfor uniforms. They are included in this box. You can force wearing them.. but you have to script it. For the greatest amount of options, use this ammo box along with my RGM- Riouken's Gear Menu, links in my sig.

Share this post


Link to post
Share on other sites

Nope not at all, you are free to edit, use and change all my code, just please leave in a credit to me please.

Share this post


Link to post
Share on other sites

Hey man, this is really great stuff, I confess I am pretty clueless about MP scripting. However, I have combined your script with the other info I have found online thus far, and made some changes that should enable this thing to be very easily expanded as the classes in-game are changed. I went through the classnames alongside those in a post from another forum by Pzar, and there are a couple others in this one.

If you like, feel free to use this script and take all the credit for yourself. When called like your script, afaik it functions identically. Sorry if there are bugs :)

/* Arma 3 Weapon Crate Filler
MP Compatible.
Loops when using default quantities.
Does not loop with optional args set.

 Updated:  7 March 2013

 Authors:  Riouken
           Pzar
    dwringer

 Arguments: [box 
  (&optional numBag 
      numItem 
      numMod 
      numWeapon 
      numAmmo)]
*/

if (!isServer) exitWith {};

///init
private ["_box", "_loop", "_wait",
 "_numWeapon", "_numAmmo", "_numMod", "_numItem", "_numBag",
 "_natoWeapons", "_opforWeapons", "_launchers", "_oculars",
 "_cartAmmo", "_launcherAmmo", "_glAmmo", "_manAmmo",
 "_attachments", "_items", "_hats", "_dress", "_chest",
 "_backpacks"];

_box = _this select 0; 
_loop = true; 
// Defaults:
_wait = 500;
_numBag = 0;
_numItem = 50;
_numMod = 50;
_numWeapon = 50;
_numAmmo = 200;

switch (count _this) do { 
case 2 : {
	_numBag = _this select 1;};
case 3 : {
	_numBag = _this select 1;
	_numItem = _this select 2;};
case 4 : {
	_numBag = _this select 1;
	_numItem = _this select 2;
	_numMod = _this select 3;};
case 5 : {
	_numBag = _this select 1;
	_numItem = _this select 2;
	_numMod = _this select 3;
	_numWeapon = _this select 4;};
case 6 : {
	_numBag = _this select 1;
	_numItem = _this select 2;
	_numMod = _this select 3;
	_numWeapon = _this select 4;
	_numAmmo = _this select 5;};};

_natoWeapons = [
"arifle_MX_F",
"arifle_MX_GL_F",
"arifle_MX_SW_F",
"arifle_MXC_F",
"arifle_MXM_F",
"arifle_SDAR_F",
"arifle_TRG20_F",
"arifle_TRG21_F",
"arifle_TRG21_GL_F",
"hgun_P07_F",
"LMG_Mk200_F",
"srifle_EBR_F"
];	

_opforWeapons = [
"arifle_Khaybar_C_F",
"arifle_Khaybar_F",
"arifle_Khaybar_GL_F",
"hgun_Rook40_F"
];

_launchers = [
"launch_NLAW_F",
"launch_RPG32_F"
];

_oculars = [
"Binocular"
];


_cartAmmo = [
"30Rnd_65x39_caseless_green",
"30Rnd_65x39_caseless_green_mag_Tracer",
"30Rnd_65x39_caseless_mag",
"30Rnd_65x39_caseless_mag_Tracer",
"100Rnd_65x39_caseless_mag",
"100Rnd_65x39_caseless_mag_Tracer",
"20Rnd_762x45_mag",
"20Rnd_556x45_UW_mag",
"30Rnd_556x45_Stanag",
"30Rnd_65x39_case_mag",
"30Rnd_65x39_case_mag_Tracer",
"16Rnd_9x21_Mag",
"30Rnd_9x21_Mag",
"200Rnd_65x39_cased_box",
"200Rnd_65x39_cased_box_Tracer"
];

_launcherAmmo = [
"NLAW_F",
"RPG32_F",
"RPG32_AA_F"
];

_glAmmo = [
"1Rnd_HE_Grenade_shell",
"UGL_FlareWhite_F",
"UGL_FlareGreen_F",
"UGL_FlareRed_F",
"UGL_FlareYellow_F",
"UGL_FlareCIR_F",
"1Rnd_Smoke_Grenade_shell",
"1Rnd_SmokeRed_Grenade_shell",
"1Rnd_SmokeGreen_Grenade_shell",
"1Rnd_SmokeYellow_Grenade_shell",
"1Rnd_SmokePurple_Grenade_shell",
"1Rnd_SmokeBlue_Grenade_shell",
"1Rnd_SmokeOrange_Grenade_shell",
"3Rnd_HE_Grenade_shell",
"3Rnd_UGL_FlareWhite_F",
"3Rnd_UGL_FlareGreen_F",
"3Rnd_UGL_FlareRed_F",
"3Rnd_UGL_FlareYellow_F",
"3Rnd_UGL_FlareCIR_F",
"3Rnd_Smoke_Grenade_shell",
"3Rnd_SmokeRed_Grenade_shell",
"3Rnd_SmokeGreen_Grenade_shell",
"3Rnd_SmokeYellow_Grenade_shell",
"3Rnd_SmokePurple_Grenade_shell",
"3Rnd_SmokeBlue_Grenade_shell",
"3Rnd_SmokeOrange_Grenade_shell"
];
// Omitted FlareGreen_F, FlareRed_F, FlareWhite_F, FlareYellow_F, because while they -do- work
//  and load up, I was unable to find a launcher for these ones yet.

_manAmmo = [
"APERSBoundingMine_Range_Mag",
"APERSMine_Range_Mag",
"ATMine_Range_Mag",
"Chemlight_blue",
"Chemlight_green",
"Chemlight_red",
"Chemlight_yellow",
"ClaymoreDirectionalMine_Remote_Mag",
"DemoCharge_Remote_Mag",
"HandGrenade",
"HandGrenade_Stone",
"MiniGrenade",
"SatchelCharge_Remote_Mag",
"SLAMDirectionalMine_Wire_Mag",
"SmokeShell",
"SmokeShellBlue",
"SmokeShellGreen",
"SmokeShellOrange",
"SmokeShellPurple",
"SmokeShellRed",
"SmokeShellYellow"
];


_attachments = [
"acc_flashlight",
"acc_pointer_IR",
"muzzle_snds_B",
"muzzle_snds_H",
"muzzle_snds_H_MG",
"muzzle_snds_L",
"optic_Aco",
"optic_ACO_grn",
"optic_Arco",
"optic_Hamr",
"optic_Holosight"
];
// (I omitted Zasleh2 because it comes up as a blank box for me)

_items = [
"FirstAidKit",
"ItemCompass",
"ItemGPS",
"ItemMap",
"ItemRadio",
"ItemWatch",
"Medikit",
"MineDetector",
"NVGoggles",
"ToolKit"
];

_hats = [
"H_Cap_blu",
"H_Cap_brn_SERO",
"H_Cap_headphones",
"H_Cap_red",
"H_HelmetB",
"H_HelmetB_light",
"H_HelmetB_paint",
"H_HelmetO_ocamo",
"H_MilCap_mcamo",
"H_MilCap_ocamo",
"H_PilotHelmetHeli_B",
"H_PilotHelmetHeli_O"
];
// (left the booniehats out due to no textures)

_dress = [
"U_B_CombatUniform_mcam",
"U_B_CombatUniform_mcam_tshirt",
"U_B_CombatUniform_mcam_vest",
"U_B_HeliPilotCoveralls",
"U_B_Wetsuit",
"U_BasicBody",
"U_C_Commoner1_1",
"U_C_Commoner1_2",
"U_C_Commoner1_3",
"U_C_Poloshirt_blue",
"U_C_Poloshirt_burgundy",
"U_C_Poloshirt_redwhite",
"U_C_Poloshirt_salmon",
"U_C_Poloshirt_stripped",
"U_C_Poloshirt_tricolour",
"U_OI_CombatUniform_ocamo",
"U_OI_PilotCoveralls",
"U_OI_Wetsuit"
//	"U_Rangemaster"
];
// (Note you can only wear your faction's clothing, and I'm not sure 
//  who can even wear rangemaster, so it is commented out)

_chest = [
"V_BandollierB_cbr",
"V_BandollierB_khk",
"V_BandollierB_rgr",
"V_Chestrig_khk",
"V_ChestrigB_rgr",
"V_HarnessO_brn",
"V_HarnessOGL_brn",
"V_PlateCarrier1_cbr",
"V_PlateCarrier1_rgr",
"V_PlateCarrier2_rgr",
"V_PlateCarrierGL_rgr",
"V_Rangemaster_belt",
"V_RebreatherB",
"V_RebreatherIR",
"V_TacVest_brn",
"V_TacVest_khk",
"V_TacVest_oli"
];


_backpacks = [
"B_AssaultPack_Base",
"B_AssaultPack_blk",
"B_AssaultPack_blk_DiverExp",
"B_AssaultPack_blk_DiverTL",
"B_AssaultPack_cbr",
"B_AssaultPack_dgtl",
"B_AssaultPack_khk",
"B_AssaultPack_khk_holder",
"B_AssaultPack_mcamo",
"B_AssaultPack_ocamo",
"B_AssaultPack_rgr",
"B_AssaultPack_rgr_Medic",
"B_AssaultPack_rgr_Repair",
"B_AssaultPack_sgg",
"B_Bergen_Base",
"B_Bergen_sgg",
"B_Bergen_sgg_Exp",
"B_Carryall_Base",
"B_Carryall_ocamo",
"B_Carryall_oucamo",
"B_Carryall_oucamo_Exp",
"B_FieldPack_Base",
"B_FieldPack_blk",
"B_FieldPack_blk_DiverExp",
"B_FieldPack_blk_DiverTL",
"B_FieldPack_cbr",
"B_FieldPack_cbr_AT",
"B_FieldPack_cbr_Repair",
"B_FieldPack_ocamo",
"B_FieldPack_ocamo_Medic",
"B_FieldPack_oucamo",
"B_Kitbag_Base",
"B_Kitbag_cbr",
"B_Kitbag_mcamo",
"B_Kitbag_sgg",
"Bag_Base"
];
// (B_Mk6, B_Mk6Mortar_Support, B_Mk6Mortar_Wpn, and Weapon_Bag_Base omitted due to acting funny, also note 
//  that the *_Medic *_AT etc bags come with stuff in them, and who doesn't like free stuff. Also, *_Base just 
//  comes up as a generic bag, but it does work)



///run
while {_loop && (alive _box)} 
do {
clearMagazineCargo _box;
clearWeaponCargo _box;
clearItemCargoGlobal _box;

{_box addWeaponCargoGlobal [_x, _numWeapon];} 
	forEach (_natoWeapons + _opforWeapons + _launchers + _oculars);

{_box addMagazineCargoGlobal [_x, _numAmmo];} 
	forEach (_cartAmmo + _launcherAmmo + _glAmmo + _manAmmo);

{_box addItemCargoGlobal [_x, _numMod];} 
	forEach (_attachments);

{_box addItemCargoGlobal [_x, _numItem];} 
	forEach (_items + _hats + _dress + _chest);

{_box addBackpackCargoGlobal [_x, _numBag];} 
	forEach (_backpacks);

if ((count _this) > 1) then {
	_loop = false;}
else {
	sleep _wait;};
};



// Also Glasses, I could not get these into a box, so you have to set them on something (or more correctly, 
//  someone!) with a glasses/goggles slot, this also overrides any they have set in preferences, and 
//  interestingly enough, none is implemented as an object, instead of just deleting them:

//this addGoggles "G_Diving";
//this addGoggles "G_Shades_Black";
//this addGoggles "G_Shades_Blue";
//this addGoggles "G_Sport_Blackred";
//this addGoggles "G_Tatical_Clear";
//this addGoggles "None";

Edited by dwringer
Edited loop logic - clear cargo regardless of what args were used.

Share this post


Link to post
Share on other sites

Error when using your version dwringer

File C:\Users\Alex\Documents\Arma 3 Alpha - Other Profiles\LtCol%20Holmes\mpmissions\co64_1msob_tvt_siegemaxwell.Stratis\msob_scripts\crate_filler.sqf, line 30
Error in expression < "_chest",
"_backpacks"];

_box = _this select 0; 
_loop = true; 

_wait = 500;
>
 Error position: <select 0; 
_loop = true; 

_wait = 500;
>

Share this post


Link to post
Share on other sites

The position it seems to be referencing is the line that says:

_box = _this select 0;

Are you still calling the script with _fill = [this] execVM "crate_filler.sqf"; from within the crate's init field?

I have copy-pasted it just now and tested it, and examined my arma.rpt thoroughly, but I do not see or encounter errors.

Or perhaps this is an issue with something in my code being run on the server that I failed to comprehend? I have only been able to test it locally, but the line of code that you're getting an error from is identical to the one in the OP except i changed the word "_crate" to "_box".

EDIT: I reproduced something similar to your error in my .rpt by calling it without brackets around "this". This is what i got:

Error in expression < "_chest",
"_backpacks"];

_box = _this select 0; 
_loop = true; 

_wait = 500;
>
 Error position: <select 0; 
_loop = true; 

_wait = 500;
>
 Error select: Type Object, expected Array,Config entry
File C:\Users\dwringer\Documents\Arma 3 Alpha\missions\AgiaCivs.Stratis\box_filler.sqf, line 30

So just make sure you're using brackets ;)

If that's really not the issue, then I apologize :!

Edited by dwringer

Share this post


Link to post
Share on other sites

Hey Riouken, can you help me out? This works brilliantly in the editor, LAN and singleplayer but it dosent work on the network for some reason. Is their something I am forgetting? Do I need server gamelogic?

The script works, but only once. Upon mission init I get my set amount of weapons in the crate and than thats it. No loop. The only think I did was add a titletext string between the weapon and sleep timer. And Also changed the sleep timer but I cant imagine that would mess it up. plus again, it works in LAN/singleplayer.

/////////   MP Ammo Box script
/////////   By: Riouken
/////////   For Arma 3

if (! isServer) exitWith {};


_crate = _this select 0;




while {alive _crate} do
{


clearMagazineCargo _crate;
clearWeaponCargo _crate;
clearItemCargoGlobal _crate;


/////Explosives////


_crate addMagazineCargoGlobal ["SatchelCharge_Remote_Mag", 2];


sleep 120;
};

Thanks a bunch.

Edited by CombatComm

Share this post


Link to post
Share on other sites

this may sound stupid, but how do i put it in? and does anyone know how you put in respawn?

Share this post


Link to post
Share on other sites

this thread is so old, im wondering if anyone has a MP ammobox script working with the released 1.0 version of A3 yet?

Share this post


Link to post
Share on other sites
this thread is so old, im wondering if anyone has a MP ammobox script working with the released 1.0 version of A3 yet?

I am looking for the same thing...

Share this post


Link to post
Share on other sites

You would have to use the "Global" variants of this commands to empty and fill the crates like it did in the below script:

- Script works with the names of the ammocrates, so no need to add anything to the innitbox. Just give them a name and add the name to the array in the script

- Start the script by calling it in the innit.sqf: execVM "scripts\ammo_box.sqf";

- Less sluggish on the server as it only runs 1 timer for all ammocrates, instead of a single timer for each crate

- Currently allows 2 different reconfigured crates, but can easily be expanded by adding more foreach loops

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Crate script for "Transport & Ambush"
// Written by Kamaradski & Jester 2014
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

if (!isServer) exitWith {};			// run this script only on the server

kamAllowedRocketCrates = [box1,box3];	// crates that have this script enabled for Rockets
kamAllowedWeaponCrates = [box2];	// crates that have this script enabled for Weapons & ammo


while {true} do {

kamActiveRocketCrates = [];			// crates that are not destroyed
kamActiveWeaponCrates = [];			// crates that are not destroyed



// Check if alive ROCKETCRATES
{
	if (alive _x) then {
		kamActiveRocketCrates = kamActiveRocketCrates + [_x];
	};
	sleep 0.1;
} foreach kamAllowedRocketCrates;



// Check if alive WEAPONCRATES
{
	if (alive _x) then {
		kamActiveWeaponCrates = kamActiveWeaponCrates + [_x]; 
	};
	sleep 0.1;
} foreach kamAllowedWeaponCrates;





// Populate ROCKETCRATES
{
	clearWeaponCargoGlobal _x; 
	clearMagazineCargoGlobal _x; 
	clearItemCargoGlobal  _x;
	_x addWeaponCargoGlobal ["launch_NLAW_F",2]; 
	_x addMagazineCargoGlobal ["NLAW_F",5];
	sleep 0.1;
} foreach kamAllowedRocketCrates;



// Populate WEAPONCRATES
{
	clearWeaponCargoGlobal _x; 
	clearMagazineCargoGlobal _x; 
	clearItemCargoGlobal  _x;
	_x addWeaponCargoGlobal ["hgun_Pistol_heavy_02_F",2]; 
	_x addMagazineCargoGlobal ["6Rnd_45ACP_Cylinder",10];

	_x addWeaponCargoGlobal ["srifle_EBR_ARCO_pointer_snds_F",2]; 
	_x addMagazineCargoGlobal ["20Rnd_762x51_Mag",20];
	sleep 0.1;
} foreach kamAllowedWeaponCrates;


// Sleep xxx seconds before reloading
sleep 120;

}	// end while loop

Share this post


Link to post
Share on other sites

Hello,

Is there a way to disable reloading of ammocrates (for more realism) ? :)

Thanks a lot :)

Share this post


Link to post
Share on other sites

For this script, just remove the sleep and the while loop. But note that this is also rather obsolete.

Share this post


Link to post
Share on other sites

Hello,

Thanks a lot,

What do you mean by obsolete ? I just need a script to fill ammo, with no reload, and no capacity limitation.

But if there is a way to optimize it, I'm interested.

I use VAS (virtual ammo box) at base, but during mission we drop the scripted ammo box to resupply units (so no reload).

Thanks a lot

Share this post


Link to post
Share on other sites

By obsolete I mean because it is an old-school refill script (lists individual classnames), and because it is a year old at this point. This means that I can guarantee it is missing classnames, and has non-existent ones in it. VAS or my Filler Script (in my signature) are the way to go. Not sure about VAS, but I know my script will accomplish your goal.

Share this post


Link to post
Share on other sites

if(!isServer) exitWith {};
private["_box","_CfgWeapons","_weapons","_items","_wep","_wep_type","_mags","_misc","_mag"];
_box = _this select 0;

while {alive _box} do
{
clearWeaponCargoGlobal _box;
clearMagazineCargoGlobal _box;
clearItemCargoGlobal _box;
clearBackpackCargoGlobal _box;

_CfgWeapons = configFile >> "cfgWeapons";
_weapons = [];
_items = [];
_misc = [];

for "_i" from 0 to (count _Cfgweapons)-1 do
{
_weapon = _CfgWeapons select _i;

if(isClass _weapon) then
{
	_wep = configName _weapon;
	_wep_type = getNumber(_weapon >> "type");
	_scope = getNumber(_weapon >> "scope");

	if(_scope == 2 && _wep_type != 65536) then
	{
	if(_wep_type in [1,2,4,5,4096] && _wep != "NVGoggles") then
	{
		_weapons set[count _weapons,_wep];
	}
		else
	{
		_items set[count _items,_wep];
	};
	};
};
};

{_misc=_misc+getArray (configFile/"CfgWeapons"/"Throw"/_x/"magazines")} forEach getArray (configFile/"CfgWeapons"/"Throw"/"muzzles");  
{_misc=_misc+getArray (configFile/"CfgWeapons"/"Put"/_x/"magazines")} forEach getArray (configFile/"CfgWeapons"/"Put"/"muzzles");

{
_box addMagazineCargoGlobal [_x,5];
} foreach _misc;

{
_box addWeaponCargoGlobal [_x,1];
diag_log format["Weapon %1 added", _x];

_mags = getArray(configFile >> "CfgWeapons" >> _x >> "magazines");

if(count _mags > 0) then
{
	{
		if(!(_x in ((getMagazineCargo _box) select 0))) then
		{
			_box addMagazineCargoGlobal [_x,5];
			diag_log format["Magazine %1 added", _x];
		};
	} foreach _mags;
};
} foreach _weapons;

{
_box addItemCargoGlobal [_x,1];
} foreach _items;

sleep 120;
};

PS: it has MOD SUPPORT!!!! :yay:

Edited by vortexHD

Share this post


Link to post
Share on other sites
PS: it has MOD SUPPORT!!!! :yay:

That's because the weapons are being pulled from the game's config. Isn't that part of Tonic's old crate script? Anyhow, the filtering process could be updated.

Edited by Iceman77

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

×