Announcement

Collapse
No announcement yet.

Ammo Box Maker - Script with a Mission To Make it Easier

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ammo Box Maker - Script with a Mission To Make it Easier

    I've been working on getting away from the Arsenal since players can now load a preset using objects a mission maker has removed. So what is the point of spending hours getting the balance right in the equipment to see s blufor player grab their fav CSAT stealth uniform, and a nice heavy caliber MG with a sniper scope?

    Well, this script is not yet complete but I wanted to share it as a work in progress.

    boxFiller.sqf
    Code:
    //usage: [yourBox<object>,typeOfBox<string>,refillOnTimer<bool>,refillTimer<number-not less than 60****RECOMMENDED TIME IS 300 MIN******>]execVM "boxFiller.sqf";
    //type of boxes: [all,weapons,ammo,containers,special,radio]
    //
    //make sure to set this variable to be able to stop any running loops if needed
    //haltAllBoxFiller = "false"; publicVariable "haltAllBoxFiller"; //run it on the server only at scenario start
    
    if !(isServer) exitWith {};
    
    
    _box = _this select 0;
    _type = _this select 1;
    _refill = _this select 2;
    _refillTimer = _this select 3;
    _boxTypes = ["all","weapons","ammo","containers","special","radio"];
    if !(_type in _boxTypes) then {_type = "weapons";};
    if (haltAllBoxFiller == "true") exitWith {"BoxFiller Halted." remoteExec ["hint",0,false];}; //make sure there is a way to stop the script if needed
    if !(alive _box) exitWith {};  //make sure to end this loop if the box is gone
    player sideChat format ["boxFiller: _box = %1",_box];
    
    clearBackPackCargoGlobal _box;
    clearItemCargoGlobal _box;
    clearMagazineCargoGlobal _box;
    clearWeaponCargoGlobal _box;
    
    _availableWeapons = [
                                ["arifle_MX_F",10],
                                ["arifle_MX_Black_F",10],
                                ["arifle_MXC_F",10],
                                ["arifle_MXC_Black_F",10],
                                ["arifle_MX_GL_F",10],
                                ["arifle_MX_GL_Black_F",10],
                                ["arifle_MX_SW_F",10],
                                ["arifle_MX_SW_Black_F",10],
                                ["LMG_Mk200_BI_F",10],
                                ["arifle_MXM_F",4],
                                ["srifle_DMR_02_F",1],
                                ["srifle_DMR_03_multicam_F",1],
                                ["MMG_01_tan_F",10],
                                ["MMG_02_camo_F",10],
                                ["MMG_02_black_F",10],
                                ["MMG_02_sand_F",10],
                                ["arifle_SDAR_F",10],
                                ["srifle_dmr_02_F",1],
                                ["srifle_dmr_03_F",1],
                                ["srifle_DMR_04_F",1],
                                ["srifle_dmr_05_blk_f",1],
                                ["srifle_DMR_05_tan_f",1],
                                ["srifle_dmr_06_camo_f",1],
                                ["arifle_Mk20_plain_F",10],
                                ["arifle_Mk20C_plain_F",10],
                                ["arifle_Mk20_GL_plain_F",10],
    
    
                                ["hgun_P07_F",10],
                                ["hgun_Pistol_heavy_01_MRD_F",10],
    
                                ["SMG_01_F",10],
                                ["SMG_02_F",10],
    
                                ["launch_NLAW_F",10],
                                ["launch_B_Titan_short_F",10],
                                ["launch_B_Titan_F",10],
                                ["launch_RPG32_F",10],
    
                                ["Binocular",50],
                                ["Laserdesignator",10],
                                ["Rangefinder",10]];
    
    if (_type == "all" || _type == "weapons") then
    {
        {_box addWeaponCargoGlobal _x;}forEach _availableWeapons;
    };
    
    _availableMagazines = [
                                ["30Rnd_65x39_caseless_mag",80],
                                ["30Rnd_65x39_caseless_mag_Tracer",80],
                                ["20Rnd_556x45_UW_mag",80],
                                ["30Rnd_556x45_Stanag",80],
                                ["30Rnd_556x45_Stanag_Tracer_Red",80],
                                ["30Rnd_556x45_Stanag_Tracer_Green",80],
                                ["30Rnd_556x45_Stanag_Tracer_Yellow",80],
    
                                ["30Rnd_45ACP_Mag_SMG_01",50],
                                ["30Rnd_45ACP_Mag_SMG_01_tracer_green",50],
                                ["30Rnd_9x21_Mag",50],
    
                                ["100Rnd_65x39_caseless_mag",80],
                                ["100Rnd_65x39_caseless_mag_Tracer",80],
                                ["200Rnd_65x39_cased_Box_Tracer",80],
                                ["200Rnd_65x39_cased_Box",50],
                                ["150Rnd_93x64_Mag",50],
    
                                ["10Rnd_338_Mag",30],
                                ["10Rnd_127x54_Mag",30],
                                ["10Rnd_93x64_DMR_05_Mag",50],
                                ["130Rnd_338_Mag",50],
                                ["20Rnd_762x51_Mag",50],
    
                                ["16Rnd_9x21_Mag",50],
                                ["11Rnd_45ACP_Mag",50],
    
                                ["NLAW_F",20],
                                ["Titan_AP",20],
                                ["Titan_AT",20],
                                ["Titan_AA",20],
                                ["RPG32_F",20],
                                ["RPG32_HE_F",20],
    
                                ["HandGrenade",80],
                                ["MiniGrenade",80],
    
                                ["SmokeShell",50],
                                ["SmokeShellBlue",50],
                                ["SmokeShellGreen",50],
                                ["SmokeShellOrange",50],
                                ["SmokeShellPurple",50],
                                ["SmokeShellRed",50],
                                ["SmokeShellYellow",50],
    
                                ["B_IR_Grenade",50],
    
                                ["Chemlight_green",50],
                                ["Chemlight_red",50],
                                ["Chemlight_blue",50],
                                ["Chemlight_yellow",50],
    
                                ["DemoCharge_Remote_Mag",50],
                                ["APERSBoundingMine_Range_Mag",50],
                                ["APERSMine_Range_Mag",50],
                                ["APERSTripMine_Wire_Mag",50],
                                ["ATMine_Range_Mag",50],
                                ["ClaymoreDirectionalMine_Remote_Mag",50],
                                ["SLAMDirectionalMine_Wire_Mag",50],
                                ["SatchelCharge_Remote_Mag",50],
    
                                ["3Rnd_HE_Grenade_shell",50],
                                ["3Rnd_SmokeRed_Grenade_shell",50],
                                ["3Rnd_SmokeGreen_Grenade_shell",50],
                                ["3Rnd_SmokeBlue_Grenade_shell",50],
                                ["3Rnd_SmokeOrange_Grenade_shell",50],
                                ["3Rnd_SmokePurple_Grenade_shell",50],
                                ["3Rnd_SmokeRed_Grenade_shell",50],
                                ["3Rnd_SmokeYellow_Grenade_shell",50],
                                ["3Rnd_UGL_FlareWhite_F",50],
                                ["3Rnd_UGL_FlareGreen_F",50],
                                ["3Rnd_UGL_FlareRed_F",50],
                                ["3Rnd_UGL_FlareYellow_F",50],
                                ["3Rnd_UGL_FlareCIR_F",50],
                                ["1Rnd_HE_Grenade_shell",50],
                                ["1Rnd_Smoke_Grenade_shell",50],
                                ["1Rnd_SmokeBlue_Grenade_shell",50],
                                ["1Rnd_SmokeGreen_Grenade_shell",50],
                                ["1Rnd_SmokeOrange_Grenade_shell",50],
                                ["1Rnd_SmokePurple_Grenade_shell",50],
                                ["1Rnd_SmokeRed_Grenade_shell",50],
                                ["1Rnd_SmokeYellow_Grenade_shell",50],
                                ["UGL_FlareWhite_F",50],
                                ["UGL_FlareGreen_F",50],
                                ["UGL_FlareRed_F",50],
                                ["UGL_FlareYellow_F",50],
                                ["UGL_FlareCIR_F",50],
    
                                ["Laserbatteries",50]];
    
    if (_type == "all" || _type == "weapons" || _type == "ammo") then
    {
        {_box addMagazineCargoGlobal _x;}forEach _availableMagazines;
    };
    
    _availableWeaponItems = [
                            ["optic_Holosight",50],
                            ["optic_Hamr",20],
                            ["optic_Aco",20],
                            ["optic_Aco_smg",20],
                            ["optic_Holosight_smg",20],
                            ["optic_Aco_grn",20],
                            ["Optic_Arco",20],
                            ["Optic_MRCO",40],
                            ["optic_SOS",2],
                            ["optic_DMS",2],
                            ["optic_LRPS",2],
                            ["optic_Nightstalker",2],
                            ["optic_Holosight",20],
                            ["optic_Aco_smg",20],
                            ["optic_ACO_grn_smg",20],
                            ["optic_AMS_snd",2],
                            ["optic_tws",2],
                            ["optic_tws_mg",2],
                            ["optic_MRD",10],
    
                            ["muzzle_snds_H",20],
                            ["muzzle_snds_L",20],
                            ["muzzle_snds_acp",20],
                            ["muzzle_snds_H_SW",20],
                            ["muzzle_snds_B",20],
                            ["muzzle_snds_338_sand",20],
                            ["muzzle_snds_338_black",20],
                            ["muzzle_snds_M",20],
    
    
                            ["acc_flashlight",20],
                            ["acc_pointer_IR",20],
                            ["bipod_01_F_snd",20],
                            ["bipod_01_F_mtp",20],
                            ["bipod_01_F_blk",20],
                            ["bipod_03_F_blk",20]];
    
    if (_type == "all" || _type == "weapons") then
    {
        {_box addItemCargoGlobal _x;}forEach _availableWeaponItems;
    };                        
    
    _availableItems = [
                            ["ItemMap",20],
                            ["ItemRadio",20],
                            ["ItemWatch",20],
                            ["ItemCompass",20],
                            ["ItemGPS",20],
                            ["B_UavTerminal",2],
                            ["Medikit",10],
                            ["ToolKit",10],
                            ["MineDetector",4],
    
                            ["FirstAidKit",100],
                            ["NVGoggles",40]];
    
    if (_type == "all" || _type == "weapons" || _type == "ammo") then
    {
        {_box addItemCargoGlobal _x;}forEach _availableItems;
    };
    
    _availableUniforms = [
                            //"H_Bandanna_mcamo",
                            //"H_Watchcap_blk",
                            //"H_Booniehat_mcamo",
                            //"H_Cap_tan_specops_US",
                            ["H_HelmetB",20],
                            ["H_HelmetB_desert",20],
                            ["H_HelmetB_light",20],
                            ["H_HelmetB_light_desert",20],
                            ["H_HelmetB_light_grass",20],
                            ["H_HelmetB_snakeskin",20],
                            ["H_HelmetB_grass",20],
                            ["H_HelmetSpecB_paint2",20],
                            ["H_HelmetSpecB_blk",20],
                            ["U_B_Wetsuit",20],
    
                            ["G_Combat",20],
                            //"G_Aviator",
                            //"G_Spectacles",
                            //"G_Sport_Blackred",
                            ["G_Tactical_Clear",20],
                            //"G_Balaclava_blk",
                            //"G_Balaclava_combat",
                            //"G_Bandanna_beast",
                            //"G_Bandanna_tan",
                            ["G_Diving",20],
    
                            ["V_Chestrig_rgr",5],
                            ["V_TacVest_khk",5],
                            ["V_PlateCarrier3_rgr",5],
                            ["V_PlateCarrierGL_rgr",5],
                            ["V_PlateCarrierSpec_rgr",5],
                            ["V_PlateCarrier2_rgr",5],
                            ["V_PlateCarrier1_rgr",5],
                            ["U_B_CombatUniform_mcam",5],
                            ["U_B_CombatUniform_mcam_tshirt",5],
                            ["V_BandollierB_rgr",5],
                            ["V_Rangemaster_belt",5],
                            ["V_RebreatherB",10]];
    
    if (_type == "all" || _type == "containers") then
    {
        {_box addItemCargoGlobal _x;}forEach _availableUniforms;
    };
    
    _availableBackpacks = [
                            ["B_AssaultPack_mcamo",4],
                            ["B_AssaultPack_rgr",4],
                            ["B_Kitbag_rgr",4],
                            ["B_Kitbag_mcamo",4],
                            ["B_Carryall_mcamo",4],
                            ["B_Bergen_mcamo",4],
                            ["B_TacticalPack_mcamo",4],
                            ["B_UAV_01_backpack_F",2],
                            ["B_Mortar_01_weapon_F",1],
                            ["B_HMG_01_A_high_weapon_F",1],
                            ["B_GMG_01_high_weapon_F",1],
                            ["B_GMG_01_A_high_weapon_F",1],
                            ["B_AT_01_weapon_F",1],
                            ["B_GMG_01_weapon_F",1],
                            ["B_HMG_01_weapon_F",1],
                            ["B_Mortar_01_support_F",1],
                            ["B_AA_01_weapon_F",1],
                            ["B_HMG_01_support_high_F",1],
                            ["B_Parachute",20],
                            ["B_HMG_01_support_F",1]];
    
    if (_type == "all" || _type == "containers") then
    {
        {_box addBackpackCargoGlobal _x;}forEach _availableBackpacks;
    };
    
    if (_refill) then
    {
        if (haltAllBoxFiller == "true") exitWith {"BoxFiller Halted." remoteExec ["hint",0,false];}; //make sure there is a way to stop the script if needed
        if !(alive _box) exitWith {};  //make sure to end this loop if the box is gone
        if (_refillTimer < 60) then {_refillTimer = 60;}; //set minimum time to wait for next refill to be 60 
        sleep _refillTimer;
        _handle = [_box,_type,true,_refillTimer]execVM "boxFiller.sqf";
    };
    As you can see, you can adjust the following items:
    1. Change the amounts you want of specific types of gear by changing the numbers after each classname
    2. Change if you want a box to only have ammo, weapons & ammo, or everything, or even just containers (uniforms, vests, backpacks).
    3. You can set it to refill or not
    4. You can set how long it will wait to refill (60 seconds minimum wait)
    This is all set in what variable you pass to the script.

    1.Object - the object or vehicle you want to act as the crate, this is the editor name
    2. String - one of the following strings, "all" - will load everything from the script, "weapons" will load all but no containers, "ammo" will load just ammo, "containers" will load just containers"
    3. Boolean - true will make it so the script will run itself again after a time period you specify, this will refill the box, false will make it so it will fill only once and the script will not loop
    4. Number - the time that will elapse until the box is refilled (min 60 - recommended 30 mins really)

    For example:
    handle = [myAmmoBox,"all",true,600]execVM "boxFiller.sqf";

    Also, make sure you set the variable to stop all the running scripts if you need to do so via the debug. Add this line to your initServer.sqf:
    Code:
    haltAllBoxFiller = "false"; publicVariable "haltAllBoxFiller"; //added for boxFiller.sqf handling of supplies

    THE LINK TO A MISSION
    I used this mission to build a loadout and test an ammo box out while setting it up for a mission.


    |TG-189th| Unkl
    ArmA 3 Game Officer
    Dean of Tactical Gamer University
    189th Infantry Brigade Member

    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN

Connect

Collapse

TeamSpeak 3 Server

Collapse

Advertisement

Collapse

Twitter Feed

Collapse

Working...
X