Announcement

Collapse
No announcement yet.

Arma 3 - Class Based Ammo Crate.

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

  • Arma 3 - Class Based Ammo Crate.

    This is inspired by BL1P's patrol ops edit and Xeno's domination ammobox (I used some of their code also). Should be easily scalable to fully define what each class has access to. Ammobox refills every 30 (editable) minutes and managed by the client side.


    Place a marker on the map named "ammobox"

    Put this in your init.sqf

    Code:
    null = [] execVM "ammo.sqf";
    The ammo.sqf is:

    Code:
    /*Class based ammo box by B. The class based ammobox is created on client side. 
    It replenishes every 30 minutes.
    
    Usage: 
    1. Must have a marker names ammobox on the map in the editor.
    2. Each soldier should have correct class.
    */
    
    _box = "I_supplyCrate_F" createVehicleLocal getMarkerPos "ammobox"; //Place this vehicle(box) on the marker called "ammobox".
    _box setDir 90; // Sets the direction of the box
    
    _weapons    = []; // array of weapons' classnames
    _magazines  = []; // array of magazines' classnames
    _items      = []; // array of items' classnames
    
    _type = typeOf player;
    switch (_type) do
    {    
        case "B_Soldier_SL_F": {
            hint "SL";
            _weapons   = _weapons   + ["arifle_MX_GL_F", "hgun_P07_snds_F"];
            _magazines = _magazines + ["30Rnd_65x39_caseless_mag", "16Rnd_9x21_Mag"];
            _items     = _items     + ["optic_Holosight", "optic_Arco"];
        };
        case "B_soldier_AR_F": {
            hint "AR";
            _weapons   = _weapons   + ["arifle_MX_F", "hgun_P07_F"];
            _magazines = _magazines + ["30Rnd_65x39_caseless_mag", "16Rnd_9x21_Mag"];
            _items     = _items     + ["optic_Aco", "optic_ACO_grn"];
        };
        default {false};
    };
    
    player reveal _box;
    
    //refill the box every 30 minutes
    while {alive _box} do 
    {
        clearMagazineCargo _box;
        clearWeaponCargo   _box;
        clearItemCargo     _box;
        
        _timer = 180; //times 10 will be how long it will take
        
        {_box addWeaponCargo   [_x, 1];} foreach _weapons;
        {_box addMagazineCargo [_x, 5];} foreach _magazines;
        {_box addItemCargo     [_x, 1];} foreach _items;
        
    	while {_timer > 0 } do { sleep 10; _timer = _timer - 1; };
    };
    Last edited by hedgehog; 08-06-2013, 10:24 AM.


  • #2
    Re: Arma 3 - Class Based Ammo Crate.

    One way to solve the ammobox time problem is for the mission developers to give the players what they need right from the start... With this in mind I was working on fully geared up soldiers a while back (which I did not finish...). Just gonna put what I have here as reference. These predefined loads are completely full and are very heavy. But they have everything a player might need as that class.

    Squad Leader:

    Code:
    /* -----------------------------------Usage:--------------------------------------------------------
    Copy and paste the following line in SL's Initilization field in the Arma 3 editor:
        [this] call compile preprocessfile "SL_gear_heavy.sqf"
    
    Place a copy of this sqf file into your mission folder.
    ---------------------------------------------------------------------------------------------------*/
    
    //================================Control Parameters ================================================
    _unit               = _this select 0;
    
    _numMainWepMag      = 16;   //Change number of magazines in the main weapon
    _numMainWepTrMag    = 13;   //Change number of tracer magazines in the main weapon
    _numFirstAidKit     = 6;    //Change number of first aid kids in inventory
    
    _numWhiteSmoke      = 7;    //Change number of throwable white smokes
    _numGreenSmoke      = 10;   //Change number of throwable green smokes
    _numRedSmoke        = 3;    //Change number of throwable red smokes
    _numYellowSmoke     = 1;    //Change number of throwable yellow smokes
    _numPurpleSmoke     = 1;    //Change number of throwable purple smokes
    _numBlueSmoke       = 1;    //Change number of throwable blue smokes
    _numOrangeSmoke     = 1;    //Change number of throwable orange smokes
    
    _numSideArmMag      = 5;    //Change number of side arm magazines
    _numDemoCharge      = 4;    //Change number of demolitions charges
    _numRGOFrag         = 12;   //Change number of throwable grenades in inventory
    
    _numChemGreen       = 3;    //Change number of green chemlights in inventory
    _numChemRed         = 2;    //Change number of red chemlights
    _numChemYellow      = 1;    //Change number of yellow chemlights
    _numChemBlue        = 1;    //Change number of blue chemlights
    //===================================================================================================
    
    if(!local _unit) exitWith{};
    
    removeallweapons _unit;
    removeHeadgear _unit;
    
    _unit addbackpack "B_Carryall_base";
    _unit addHeadgear "H_Booniehat_khk";
    
    _unit addItem "optic_Hamr";
    _unit addItem "optic_MRCO";
    _unit addItem "optic_Arco";
    
    _unit addWeapon "Rangefinder";
    _unit addItem "itemgps";
    _unit assignItem "itemgps";
    
    _unit addWeapon "arifle_MX_Holo_pointer_F";
    _unit addItem "acc_flashlight";
    _unit addItem "muzzle_snds_H";
     
    _unit addWeapon "hgun_P07_F";
    _unit addItem "muzzle_snds_L";
    
    
    for [{_i = 0}, {_i < _numMainWepMag}, {_i=_i + 1}]  do {_unit addmagazine "30Rnd_65x39_caseless_mag"};
    for [{_i = 0}, {_i < _numMainWepTrMag}, {_i=_i + 1}]do {_unit addmagazine "30Rnd_65x39_caseless_mag_Tracer"};
    
    for [{_i = 0}, {_i < _numSideArmMag}, {_i=_i + 1}]  do {_unit addmagazine "16Rnd_9x21_Mag"};
    
    for [{_i = 0}, {_i < _numFirstAidKit}, {_i=_i + 1}] do {_unit addItem "FirstAidKit"};
    
    for [{_i = 0}, {_i < _numDemoCharge}, {_i=_i + 1}]  do {_unit addMagazine "DemoCharge_Remote_Mag"};
    
    for [{_i = 0}, {_i < _numGreenSmoke}, {_i=_i + 1}]  do {_unit addMagazine "SmokeShellGreen"};
    for [{_i = 0}, {_i < _numRedSmoke}, {_i=_i + 1}]    do {_unit addMagazine "SmokeShellRed"};
    for [{_i = 0}, {_i < _numWhiteSmoke}, {_i=_i + 1}]  do {_unit addMagazine "SmokeShell"};
    for [{_i = 0}, {_i < _numYellowSmoke}, {_i=_i + 1}] do {_unit addMagazine "SmokeShellYellow"};
    for [{_i = 0}, {_i < _numPurpleSmoke}, {_i=_i + 1}] do {_unit addMagazine "SmokeShellPurple"};
    for [{_i = 0}, {_i < _numBlueSmoke}, {_i=_i + 1}]   do {_unit addMagazine "SmokeShellBlue"};
    
    for [{_i = 0}, {_i < _numRGOFrag}, {_i=_i + 1}]     do {_unit addMagazine "HandGrenade"};
    
    for [{_i = 0}, {_i < _numChemGreen}, {_i=_i + 1}]   do {_unit addMagazine "Chemlight_green"};
    for [{_i = 0}, {_i < _numChemRed}, {_i=_i + 1}]     do {_unit addMagazine "Chemlight_red"};
    for [{_i = 0}, {_i < _numChemYellow}, {_i=_i + 1}]  do {_unit addMagazine "Chemlight_yellow"};
    for [{_i = 0}, {_i < _numChemBlue}, {_i=_i + 1}]    do {_unit addMagazine "Chemlight_blue"};
    Medic:

    Code:
    /* -----------------------------------Usage:--------------------------------------------------------
    Copy and paste the following line in Medic's Initilization field in the Arma 3 editor:
        [this] call compile preprocessfile "Med_gear_heavy.sqf"
    
    Place a copy of this sqf file into your mission folder.
    ---------------------------------------------------------------------------------------------------*/
    
    //================================Control Parameters ================================================
    _unit               = _this select 0;
    
    _numMainWepMag      = 21;   //Change number of magazines in the main weapon
    _numFirstAidKit     = 36;   //Change number of first aid kids in inventory
    
    _numWhiteSmoke      = 17;   //Change number of throwable white smokes
    _numGreenSmoke      = 6;    //Change number of throwable green smokes
    
    _numSideArmMag      = 6;    //Change number of side arm magazines
    _numRGOFrag         = 5;   //Change number of throwable grenades in inventory
    
    _numChemGreen       = 5;    //Change number of green chemlights in inventory
    //===================================================================================================
    
    if(!local _unit) exitWith{};
    
    removeallweapons _unit;
    removeBackpack _unit;
    
    _unit addbackpack "B_Carryall_base";
    
    _unit addItem "optic_Hamr"; //RCO comment line to restrict
    _unit addItem "optic_MRCO"; //MRCO comment line to restrict
    _unit addItem "optic_Arco"; //ARCO comment line to restrict
    
    _unit addWeapon "Rangefinder";
    
    _unit addItem "itemgps";
    _unit assignItem "itemgps";
    
    _unit addWeapon "arifle_MX_Holo_pointer_F";
    _unit addItem "acc_flashlight";
    _unit addItem "muzzle_snds_H";
    
     
    _unit addWeapon "hgun_P07_F";
    _unit addItem "muzzle_snds_L";
    
    
    for [{_i = 0}, {_i < _numMainWepMag},   {_i=_i + 1}] do {_unit addmagazine "30Rnd_65x39_caseless_mag"};
    for [{_i = 0}, {_i < _numSideArmMag},   {_i=_i + 1}] do {_unit addmagazine "16Rnd_9x21_Mag"};
    for [{_i = 0}, {_i < _numFirstAidKit},  {_i=_i + 1}] do {_unit addItem "FirstAidKit"};
    for [{_i = 0}, {_i < _numGreenSmoke},   {_i=_i + 1}] do {_unit addMagazine "SmokeShellGreen"};
    for [{_i = 0}, {_i < _numWhiteSmoke},   {_i=_i + 1}] do {_unit addMagazine "SmokeShell"};
    for [{_i = 0}, {_i < _numRGOFrag},      {_i=_i + 1}] do {_unit addMagazine "HandGrenade"};
    for [{_i = 0}, {_i < _numChemGreen},    {_i=_i + 1}] do {_unit addMagazine "Chemlight_green"};
    AT:
    Code:
    /* -----------------------------------Usage:--------------------------------------------------------
    Copy and paste the following line in SL's Initilization field in the Arma 3 editor:
        [this] call compile preprocessfile "AT_gear_heavy.sqf"
    
    Place a copy of this sqf file into your mission folder.
    ---------------------------------------------------------------------------------------------------*/
    
    //================================Control Parameters ================================================
    _unit               = _this select 0;
    
    _numMainWepMag      = 14;   //Change number of magazines in the main weapon
    _numFirstAidKit     = 4;    //Change number of first aid kids in inventory
    _numATMissiles      = 5;    //Change number of AT missiles
    _numAPMissiles      = 1;    //Change number of AP missiles
    
    _numSideArmMag      = 3;    //Change number of side arm magazines
    _numRGOFrag         = 5;   //Change number of throwable grenades in inventory
    //===================================================================================================
    
    if(!local _unit) exitWith{};
    
    removeallweapons _unit;
    removeBackpack _unit;
    
    _unit addbackpack "B_Carryall_base";
    
    _unit addItem "optic_Hamr";
    _unit addItem "optic_MRCO";
    _unit addItem "optic_Arco";
    
    _unit addWeapon "Rangefinder";
    
    _unit addItem "itemgps";
    _unit assignItem "itemgps";
    
    _unit addWeapon "arifle_MX_Holo_pointer_F";
    _unit addItem "acc_flashlight";
    _unit addItem "muzzle_snds_H";
     
    _unit addWeapon "hgun_P07_F";
    _unit addItem "muzzle_snds_L";
    _unit addWeapon "launch_B_Titan_short_F";
    
    for [{_i = 0}, {_i < _numMainWepMag},   {_i=_i + 1}] do {_unit addmagazine "30Rnd_65x39_caseless_mag"};
    for [{_i = 0}, {_i < _numSideArmMag},   {_i=_i + 1}] do {_unit addmagazine "16Rnd_9x21_Mag"};
    for [{_i = 0}, {_i < _numFirstAidKit},  {_i=_i + 1}] do {_unit addItem "FirstAidKit"};
    for [{_i = 0}, {_i < _numRGOFrag},      {_i=_i + 1}] do {_unit addMagazine "HandGrenade"};
    for [{_i = 0}, {_i < _numATMissiles},   {_i=_i + 1}] do {_unit addmagazine "Titan_AT"};
    for [{_i = 0}, {_i < _numAPMissiles},   {_i=_i + 1}] do {_unit addmagazine "Titan_AP"};

    Comment


    • #3
      Re: Arma 3 - Class Based Ammo Crate.

      Finally I see a solution!! I like the idea of "force kitting" roles out. This will avoid so many issues and reduce time it takes to kick a mission off. I am a firm believer that roles like a engineer do not need sniper rifles rather something pertinent to being a engineer!!
      "The chief foundations of all states, new as well as old or composite, are good laws and good arms; and as there cannot be good laws where the state is not well armed, it follows that where they are well armed they have good laws." -Machiavelli

      Comment


      • #4
        Re: Arma 3 - Class Based Ammo Crate.

        Originally posted by |TG| B View Post
        One way to solve the ammobox time problem
        What time problem ?

        Nice that you have it working from a single sqf btw
        The path of my life is strewn with cowpats from the devil's own satanic herd.

        Comment


        • #5
          Re: Arma 3 - Class Based Ammo Crate.

          Expansion on the Classed ammo box.

          Example of how to stop players picking up or swapping weapons they are not classed for.

          Code:
          //---bl1p bla bla created bla bla this bla bla bla
          
          _layer = 85125; 
          _block = false; 
          _type = typeOf player;
          
          //--- classes 
          
          if 
          (
          _type == "B_Soldier_A_F" || 
          _type == "B_soldier_AR_F" || 
          _type == "B_medic_F" || 
          _type == "B_engineer_F" || 
          _type == "B_soldier_exp_F" || 
          _type == "B_Soldier_GL_F" ||
          //_type == "B_soldier_M_F" ||
          _type == "B_soldier_AA_F" || 
          _type == "B_soldier_AT_F" || 
          _type == "B_officer_F" || 
          _type == "B_soldier_repair_F" || 
          _type == "B_Soldier_F" || 
          _type == "B_soldier_LAT_F" || 
          _type == "B_Soldier_lite_F" || 
          _type == "B_Soldier_SL_F" || 
          _type == "B_Soldier_TL_F" || 
          _type == "O_Soldier_A_F" || 
          _type == "O_soldier_AR_F" ||
          _type == "O_medic_F" || 
          _type == "O_engineer_F" || 
          _type == "O_soldier_exp_F" || 
          _type == "O_Soldier_GL_F" || 
          //_type == "O_soldier_M_F" ||
          _type == "O_soldier_AA_F" || 
          _type == "O_soldier_AT_F" || 
          _type == "O_officer_F" || 
          _type == "O_soldier_repair_F" || 
          _type == "O_Soldier_F" || 
          _type == "O_soldier_LAT_F" || 
          _type == "O_Soldier_lite_F" || 
          _type == "O_Soldier_SL_F" || 
          _type == "O_Soldier_TL_F" 
          ) 
          then {
          
          //--- bl1p dudes who cant use the sniper guns
          _restrictedClassesA = ["B_Soldier_A_F","B_soldier_AR_F","B_medic_F","B_engineer_F","B_soldier_exp_F","B_Soldier_GL_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_soldier_repair_F","B_Soldier_F","B_soldier_LAT_F","B_Soldier_lite_F","B_Soldier_SL_F","B_Soldier_TL_F","O_Soldier_A_F","O_soldier_AR_F","O_medic_F","O_engineer_F","O_soldier_exp_F","O_Soldier_GL_F","O_soldier_AA_F","O_soldier_AT_F","O_officer_F","O_soldier_repair_F","O_Soldier_F","O_soldier_LAT_F","O_Soldier_lite_F","O_Soldier_SL_F","O_Soldier_TL_F"]; 
          
          //--- bl1p the sniper guns
          _restrictedWeaponsA = ["srifle_EBR_F","srifle_LRR_F","srifle_EBR_F","srifle_GM6_F"]; 
          
          	while {true} do 
          	{ 
          		 if (({player isKindOf _x} count _restrictedClassesA > 0) && 
                  {{player hasWeapon _x} count _restrictedWeaponsA > 0}) then 
          		{ 
          			if (!_block) then 
          			{ 
          				//player action ["dropWeapon", _x] count _restrictedWeaponsA > 0;
          				_layer cutText ["This sniper rifle/scope is confusing you. Please drop it.", "BLACK OUT"]; 
          				_block = true; 
          			}; 
          		} 
          		else 
          		{ 
          			if (_block) then 
          			{ 
          				_layer cutText ["", "PLAIN"]; 
          				_block = false; 
          			}; 
          		}; 
          		sleep 1; 
          	};  
          };

          Messy but does the job this is for sniper restrictions.
          Feel free to make it pritty.

          Disclaimer I Copy pasted other peoples work 98% and typed 2% :)
          The path of my life is strewn with cowpats from the devil's own satanic herd.

          Comment


          • #6
            Re: Arma 3 - Class Based Ammo Crate.

            That is simply sexy!!
            "The chief foundations of all states, new as well as old or composite, are good laws and good arms; and as there cannot be good laws where the state is not well armed, it follows that where they are well armed they have good laws." -Machiavelli

            Comment


            • #7
              Re: Arma 3 - Class Based Ammo Crate.

              This is what I used to operation furious poke. The result was infantries being ready to go within seconds. The hold up was planning by the command element. Soldiers simply sat around waiting for them to come up with the plan. Negative effect was that enemy dead bodies were looted for better scopes. lol.

              Oh one of the classnames changed in dev build. Once that is changed, it should be usable and editable.

              Code:
              /************************************************************************************************
              Author: B
              
              A simple predetermined gearing up script based on player class.
              
              Usage:
              Place an object and in its init in the editor, place the following:
              this addAction["<t color='#ff1111'>GEAR UP</t>", "gearUp.sqf"]; this allowDamage false;
              
              
              Place playable units on the map in editor and give them names (sword, scabbard. etc...):
              You may remove their default weapons. Players can get their predesignated gears with the action
              menu "GEAR UP" once they approach the object.
              
              Credits: Unkl for his original script.
              ************************************************************************************************/
              _unit = _this select 0;
              _caller = _this select 1;
              
              _caller groupChat "Standby... Getting Loadout.";
              
              removeAllWeapons _caller;
              removeBackpack _caller;
              
              switch (_caller) do
              {
                  //---------------------------Command Element-----------------------------
                  case sword: { //Commander
                      _caller addWeapon "arifle_MXC_Holo_pointer_snds_F";
                      _caller addItem "optic_Aco";
                      _caller addItem "MineDetector";
                      _caller addGoggles "G_Tactical_Clear";        
                      
                      _caller addBackpack "B_AssaultPack_mcamo";
                      _caller addWeapon "hgun_P07_snds_F";        
                      
                      _caller addWeapon "Binocular";
                      _caller addItem "NVGoggles";
                      _caller assignItem "NVGoggles";
                      
                      for [{_i = 0}, {_i < 10},{_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag_Tracer"};
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellGreen"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellRed"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellBlue"};
                      
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_green"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_red"};
                  };
                  case scabbard: { //Medic
                      _caller addWeapon "arifle_MXC_Holo_pointer_snds_F";
                      _caller addItem "optic_Aco";
                      
                      _caller addBackpack "B_Kitbag_mcamo";
                      _caller addWeapon "hgun_P07_snds_F";
                      _caller addGoggles "G_Combat";
                      _caller addWeapon "Binocular";        
                      
                      _caller addItem "ItemGPS";
                      _caller assignItem "ItemGPS";
                      
                      _caller addItem "Medikit";
                      
                      for [{_i = 0}, {_i < 20}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      
                      for [{_i = 0}, {_i < 14}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
                      for [{_i = 0}, {_i < 10}, {_i=_i + 1}] do {_caller addMagazine "SmokeShell"};
                  };
                  //---------------------------Dagger 11----------------------------------
                  case dagger11: { // TL
                      _caller addWeapon "arifle_MX_Holo_pointer_F";
                      _caller addItem "optic_Aco";
                      _caller addItem "muzzle_snds_H";
                      _caller addGoggles "G_Tactical_Black";
                      _caller addBackpack "B_AssaultPack_mcamo";
                      _caller addWeapon "hgun_P07_snds_F";
                      _caller addItem "MineDetector";
                      
                      _caller addWeapon "Rangefinder";        
                      
                      for [{_i = 0}, {_i < 5},{_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag_Tracer"};
                      for [{_i = 0}, {_i < 13}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                           
                      
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addMagazine "HandGrenade"};
                      
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellGreen"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellRed"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellBlue"};
                      
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_green"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_red"};
                  };
                  case dagger12: { //Explosive Specialist
                      _caller addBackpack "B_Carryall_mcamo";
                      
                      _caller addWeapon "Binocular";
                      _caller addGoggles "G_Combat";                
                      
                      _caller addItem "ItemGPS";
                      _caller assignItem "ItemGPS";
                      
                      _caller addWeapon "arifle_MX_Holo_pointer_F";
                      _caller addItem "optic_Aco";
                      _caller addItem "muzzle_snds_H";
                      _caller addItem "MineDetector";
                      
                      _caller addWeapon "hgun_P07_snds_F";
              
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
              
                      for [{_i = 0}, {_i < 12}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
                      for [{_i = 0}, {_i < 4}, {_i=_i + 1}] do {_caller addMagazine "SatchelCharge_Remote_Mag"};
                  };
                  case dagger13: { //Engineer
                      _caller addBackpack "B_Bergen_mcamo";
                      
                      _caller addWeapon "Binocular";
                      _caller addGoggles "G_Combat";        
                      
                      _caller addItem "ItemGPS";
                      _caller assignItem "ItemGPS";
                      
                      _caller addItem "ToolKit";
                      
                      _caller addWeapon "arifle_MX_Holo_pointer_F";
                      _caller addItem "optic_Aco";
                      _caller addItem "muzzle_snds_H";
                      _caller addItem "MineDetector";
                      
                      _caller addWeapon "hgun_P07_snds_F";
              
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addMagazine "HandGrenade"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "DemoCharge_Remote_Mag"};
              
                      for [{_i = 0}, {_i < 15}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};        
                  };
                  case dagger14: { // Medic
                      _caller addWeapon "arifle_MXC_Holo_pointer_snds_F";
                      _caller addItem "optic_Aco";
                      
                      _caller addGoggles "G_Combat";
                      _caller addBackpack "B_Kitbag_mcamo";
                      _caller addWeapon "hgun_P07_snds_F";
                      
                      _caller addItem "ItemGPS";
                      _caller assignItem "ItemGPS";
                      
                      _caller addWeapon "Binocular";        
                      
                      _caller addItem "Medikit";
                      
                      for [{_i = 0}, {_i < 20}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      
                      for [{_i = 0}, {_i < 14}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
                      for [{_i = 0}, {_i < 10}, {_i=_i + 1}] do {_caller addMagazine "SmokeShell"};
                  };
                  
                  //---------------------------Dagger 12----------------------------------
                  case dagger21: { //TL
                      _caller addWeapon "arifle_MX_Holo_pointer_F";
                      _caller addItem "optic_Aco";
                      _caller addItem "muzzle_snds_H";
                      _caller addGoggles "G_Tactical_Black";
                      _caller addBackpack "B_AssaultPack_mcamo";
                      _caller addWeapon "hgun_P07_snds_F";
                      _caller addItem "MineDetector";
                              
                      _caller addWeapon "Rangefinder";
                      _caller addItem "NVGoggles";
                      _caller assignItem "NVGoggles";
                      
                      for [{_i = 0}, {_i < 5},{_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag_Tracer"};
                      for [{_i = 0}, {_i < 13}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                      
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addMagazine "HandGrenade"};
                      
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellGreen"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellRed"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellBlue"};
                      
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_green"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_red"};
                  };
                  case dagger22: { //AT
                      //add loadout for sword
                      _caller addBackpack "B_Carryall_mcamo";
                      _caller addWeapon "Binocular";
                      _caller addGoggles "G_Combat";
                      _caller addWeapon "launch_B_Titan_short_F";
                      
                      _caller addItem "NVGoggles";
                      _caller assignItem "NVGoggles";        
                      
                      _caller addItem "ItemGPS";
                      _caller assignItem "ItemGPS";
                      
                      _caller addWeapon "arifle_MX_Holo_pointer_F";
                      _caller addItem "optic_Aco";
                      _caller addItem "muzzle_snds_H";
                      
                      _caller addWeapon "hgun_P07_snds_F";
              
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
              
                      for [{_i = 0}, {_i < 15}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                      
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "Titan_AT"};
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addMagazine "HandGrenade"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
                      
                      
                  };
                  case dagger23: { //AR
                      _caller addBackpack "B_AssaultPack_mcamo";
                      
                      _caller addWeapon "arifle_MX_SW_pointer_F";
                      _caller addPrimaryWeaponItem "optic_Holosight";
                      
                      _caller addItem "optic_Aco";
                      
                      _caller addItem "muzzle_snds_H";
                      _caller addGoggles "G_Combat";
                      _caller addWeapon "Binocular";
                      _caller addItem "NVGoggles";
                      _caller assignItem "NVGoggles";
                      
                      _caller addItem "ItemGPS";
                      _caller assignItem "ItemGPS";
                      
                      _caller addWeapon "hgun_P07_snds_F";
                      _caller addItem "MineDetector";
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};        
                      for [{_i = 0}, {_i < 13},{_i=_i + 1}] do {_caller addMagazine "100Rnd_65x39_caseless_mag"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "HandGrenade"};        
                  };
                  case dagger24: { //GR
                      _caller addBackpack "B_AssaultPack_mcamo";
                      _caller addGoggles "G_Combat";
                      _caller addWeapon "arifle_MX_GL_Holo_pointer_snds_F";
                      _caller addItem "optic_Aco";
                      _caller addWeapon "hgun_P07_snds_F";
                      
                      _caller addWeapon "Rangefinder";
                      
                      _caller addItem "NVGoggles";
                      _caller assignItem "NVGoggles";
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
              
                      for [{_i = 0}, {_i < 14}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
              
                      for [{_i = 0}, {_i < 6}, {_i=_i + 1}] do {_caller addMagazine "3Rnd_HE_Grenade_shell"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "3Rnd_SmokeGreen_Grenade_shell"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "3Rnd_SmokeBlue_Grenade_shell"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "3Rnd_SmokeRed_Grenade_shell"};
                  };
                  
                  //-----------------------------Needle------------------------------------
                  case needle1: { //Sniper        
                      _caller addBackpack "B_AssaultPack_mcamo";
                      
                      _caller addWeapon "srifle_LRR_SOS_F";
                      _caller addWeapon "Rangefinder";
                      _caller addWeapon "hgun_P07_snds_F";
                      
                      for [{_i = 0}, {_i < 7}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};        
                      for [{_i = 0}, {_i < 20}, {_i=_i + 1}] do {_caller addMagazine "7Rnd_408_Mag"};
                      
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "HandGrenade"};
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellGreen"};
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellRed"};
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellBlue"};
                      
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_green"};
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_red"};
                      
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "ClaymoreDirectionalMine_Remote_Mag"};
                  };
                  case needle2: { //Spotter
                      _caller addBackpack "B_AssaultPack_mcamo";
                      _caller addWeapon "Rangefinder";
                      _caller addWeapon "hgun_P07_snds_F";
                      
                      _caller addWeapon "arifle_MX_Holo_pointer_F";
                      _caller addItem "optic_Hamr";
                      _caller addItem "muzzle_snds_H";
                      _caller addItem "MineDetector";
                      
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addMagazine "HandGrenade"};
                      for [{_i = 0}, {_i < 15}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_65x39_caseless_mag"};
                      for [{_i = 0}, {_i < 5}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "DemoCharge_Remote_Mag"};
                  };    
                  
                  //------------------------------Axe--------------------------------------
                  case axe1: { //Pilot        
                      _caller addWeapon "SMG_02_ACO_F";
                      _caller addWeapon "hgun_P07_snds_F";
                      
                      _caller addItem "muzzle_snds_L";
                      _caller addItem "acc_pointer_IR";        
                      
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      for [{_i = 0}, {_i < 7}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_9x21_Mag"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};        
                      
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "HandGrenade"};
                      
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellGreen"};
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellRed"};
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellBlue"};
                      
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_green"};
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_red"};
                  };
                  case axe2: { //Pilot        
                      _caller addWeapon "SMG_02_ACO_F";
                      _caller addWeapon "hgun_P07_snds_F";
                      
                      _caller addItem "muzzle_snds_L";
                      _caller addItem "acc_pointer_IR";        
                      
                      for [{_i = 0}, {_i < 3}, {_i=_i + 1}] do {_caller addItem "FirstAidKit"};
                      for [{_i = 0}, {_i < 7}, {_i=_i + 1}] do {_caller addMagazine "30Rnd_9x21_Mag"};
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "16Rnd_9x21_Mag"};        
                      
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "HandGrenade"};
                      
                      for [{_i = 0}, {_i < 2}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellGreen"};
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellRed"};
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "SmokeShellBlue"};
                      
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_green"};
                      for [{_i = 0}, {_i < 1}, {_i=_i + 1}] do {_caller addMagazine "Chemlight_red"};
                  };
                  
                  default {false};
              };
              _caller groupChat "Loadout completed.";

              Comment


              • #8
                Re: Arma 3 - Class Based Ammo Crate.

                Great thanks B.

                From BIS change log: "One of the SMGs had to be renamed. Welcome to the Sting SMG." They don't have the class name posted.
                |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
                "We quickly advance in the opposite direction and take cover in a house on the SW side of town." - BadStache

                Comment


                • #9
                  Re: Arma 3 - Class Based Ammo Crate.

                  nar dont think so..
                  Last edited by BL1P; 09-11-2013, 08:55 AM.
                  The path of my life is strewn with cowpats from the devil's own satanic herd.

                  Comment


                  • #10
                    Re: Arma 3 - Class Based Ammo Crate.

                    What I used for Operation Heracles' Fist. Pretty happy about how it worked. Turns out I had a few bugs in the previous version which seems to be fixed in this one.

                    Code:
                    /*Class based ammo box by B. The class based ammobox is created on client side.
                    It replenishes every _timer seconds.
                    
                    Usage: 
                    1. Must have a marker with a name where you want the ammobox to appear.
                    2. Add the following line into the init field of the playable soldier.
                    
                    _null = this execVM "ammo.sqf";
                    
                    3. Place this code into a file named ammo.sqf and place it within the mission folder.
                    */
                    waitUntil { !isNil {player} };
                    waitUntil { player == player };
                    
                    
                    _timer = 1200;
                    _marker = "ammobox";
                    _boxType = "B_supplyCrate_F";
                    
                    if (_this != player) exitWith {};  // exit all other clients.
                    
                    //default items, weapons and backpacks
                    _weapons    = ["hgun_P07_snds_F", "Binocular"]; // array of weapons' classnames
                    _magazines  = ["16Rnd_9x21_Mag", "HandGrenade","30Rnd_65x39_caseless_mag", "SmokeShellGreen", "SmokeShellRed", "SmokeShellBlue" ]; // array of magazines' classnames
                    _items      = ["optic_Aco", "optic_Holosight", "optic_Hamr"]; // array of items' classnames
                    _backpacks 	= ["B_AssaultPack_mcamo"];
                    _fac_count 	= 1;
                    
                    
                    //specialized weapons based on class. classnames
                    _type = typeOf player;
                    switch (_type) do
                    {
                    //---------------------------------------------NATO----------------------------------
                    	case "B_officer_F": {_weapons   = _weapons   + ["arifle_MXC_F"];};
                    	case "B_engineer_F": {
                            _weapons   = _weapons   + ["arifle_MX_F"];
                            _magazines = _magazines + ["DemoCharge_Remote_Mag", "SatchelCharge_Remote_Mag"];
                            _items     = _items     + ["MineDetector","ToolKit"];
                    		_backpacks = _backpacks + ["B_Bergen_mcamo"];
                        };
                    	case "B_medic_F": {
                            _weapons   = _weapons   + ["arifle_MXC_F"];
                            _magazines = _magazines + ["SmokeShell"];
                            _items     = _items     + ["Medikit"];
                    		_backpacks = _backpacks + ["B_Kitbag_mcamo", "B_Carryall_mcamo"];
                    		_fac_count 	= 30;
                        };
                        case "B_Soldier_SL_F": {        
                            _weapons   = _weapons   + ["arifle_MX_F", "Rangefinder", "Laserdesignator"];
                            _magazines = _magazines + ["30Rnd_65x39_caseless_mag_Tracer", "Laserbatteries"];        
                        };
                    	case "B_Soldier_TL_F": {        
                            _weapons   = _weapons   + ["arifle_MX_F", "Rangefinder", "Laserdesignator"];
                            _magazines = _magazines + ["30Rnd_65x39_caseless_mag_Tracer", "Laserbatteries"];        
                        };
                    	case "B_soldier_AT_F": {        
                            _weapons   = _weapons   + ["arifle_MXC_F", "launch_B_Titan_short_F"];
                            _magazines = _magazines + ["Titan_AT"];
                            _items     = _items     + [];
                    		_backpacks = _backpacks + ["B_Carryall_mcamo"];
                        };
                    	case "B_soldier_AR_F": {
                            _weapons   = _weapons   + ["arifle_MX_SW_F"];
                            _magazines = _magazines + ["100Rnd_65x39_caseless_mag"];
                        };
                    	case "B_soldier_exp_F": {        
                            _weapons   = _weapons   + ["arifle_MX_F"];
                            _magazines = _magazines + ["DemoCharge_Remote_Mag", "SatchelCharge_Remote_Mag"];
                            _items     = _items     + ["ToolKit", "MineDetector"];
                    		_backpacks = _backpacks + ["B_Carryall_mcamo"];
                        };
                    	case "B_Soldier_GL_F": {        
                            _weapons   = _weapons   + ["arifle_MX_GL_F", "Rangefinder"];
                            _magazines = _magazines + ["3Rnd_HE_Grenade_shell", "3Rnd_SmokeRed_Grenade_shell"];        
                    		_backpacks = _backpacks + ["B_Kitbag_mcamo"];
                        };
                    	case "B_soldier_UAV_F": {_weapons   = _weapons   + ["arifle_MX_F"];};
                    	case "B_Helipilot_F": {        
                            _weapons   = _weapons   + ["SMG_01_F"];
                            _magazines = _magazines + ["30Rnd_45ACP_Mag_SMG_01"];
                            _items     = _items     + ["ItemGPS"];		
                        };
                    	case "B_crew_F": {        
                            _weapons   = _weapons   + ["arifle_MXC_F"];        
                            _items     = _items     + ["ItemGPS"];		
                        };
                        default {false};
                    };
                    
                    _box = _boxType createVehicleLocal (getMarkerPos _marker); //Place this vehicle(box) on the marker called "ammobox".
                    _box setDir 149; // Sets the direction of the box
                    
                    player reveal _box;
                    
                    //refill the box every _timer seconds
                    while {alive _box} do 
                    {
                        clearMagazineCargo _box;
                        clearWeaponCargo   _box;
                        clearItemCargo     _box;
                    	clearBackpackCargo _box;    
                        
                        {_box addWeaponCargo   [_x, 1];} foreach _weapons;
                        {_box addMagazineCargo [_x, 15];} foreach _magazines;
                        {_box addItemCargo     [_x, 1];} foreach _items;
                        {_box addBackpackCargo [_x, 1];} foreach _backpacks;
                    	_box addItemCargo     ["FirstAidKit", _fac_count];
                    	
                    	sleep _timer;
                    };
                    Last edited by hedgehog; 09-22-2013, 09:43 PM.

                    Comment


                    • #11
                      Re: Arma 3 - Class Based Ammo Crate.

                      Backing up the structure of class based ammo crate as I updated it to more of a function that can called easily from one file.

                      Steps:
                      1. Create markers in the editor with names "ammobox", "clothes" and "side_box"
                      2. In the init.sqf (client, can be done in initPlayerLocal.sqf) following call:
                      Code:
                      0 = [getMarkerPos("ammobox") , 
                      	 getMarkerPos("clothes") , 
                      	 getMarkerPos("side_box"), 
                      	 markerDir	 ("ammobox") , 
                      	 player						] execVM 'ammo.sqf';
                      3. Where the ammo.sqf contents are:
                      Code:
                      waitUntil { !isNil {player} };
                      waitUntil { player == player };
                      
                      _primarypos 	= _this select 0;//ammobox position
                      _clothespos 	= _this select 1;//clothes position
                      _sidepos    	= _this select 2;//side_box position
                      _direction		= _this select 3;//direction of the ammobox marker
                      _caller    	    = _this select 4;//the player
                      
                      if (_caller != player) exitWith {};  // exit all other clients.
                      
                      removeAllWeapons _caller; 
                      removeBackpack _caller;
                      _caller unassignItem "NVGoggles"; 
                      _caller removeItem "NVGoggles";
                      _caller unassignItem "ItemRadio"; 
                      _caller removeItem "ItemRadio";
                      
                      
                      _timer = 1200;
                      
                      //default items, weapons and backpacks
                      _weapons    = [	"arifle_MX_F", "arifle_MX_Black_F", "arifle_MXC_F", "arifle_MXC_Black_F"];
                      				
                      _magazines  = [	"30Rnd_65x39_caseless_mag", "30Rnd_65x39_caseless_mag_Tracer"];
                      				
                      _items      = [	"optic_Holosight",
                      				"optic_Hamr",				
                      				"optic_Aco",
                      				"muzzle_snds_H",				
                      				"acc_flashlight"];
                      
                      _backpacks 	= ["B_AssaultPack_mcamo"];
                      
                      _clothes	= [	"H_Bandanna_mcamo",				
                                      "H_Watchcap_blk",
                      				"H_Booniehat_mcamo",				
                      				"H_Cap_tan_specops_US", 
                      				"H_HelmetB", 
                      				"H_HelmetB_light",
                      				"G_Combat",
                      				"G_Aviator",
                      				"G_Spectacles",
                      				"G_Sport_Blackred",
                      				"G_Tactical_Clear",
                                      "V_Chestrig_rgr",
                                      "V_TacVest_khk",
                      				"V_PlateCarrier3_rgr", 
                      				"V_PlateCarrierGL_rgr",
                                      "V_PlateCarrierSpec_rgr",				
                      				"ItemMap",
                      				"ItemRadio",
                      				"ItemWatch",
                      				"ItemCompass",
                      				"ItemGPS"];
                      				
                      _sidewpns	= ["hgun_P07_snds_F", "hgun_Pistol_heavy_01_MRD_F"];
                      _sideitms   = ["muzzle_snds_acp"];
                      _sidemags 	= [ "16Rnd_9x21_Mag",
                                      "11Rnd_45ACP_Mag",
                                      "HandGrenade",
                                      "MiniGrenade",
                      				"SmokeShell", 
                      				"SmokeShellRed", 
                      				"SmokeShellGreen",
                                      "Chemlight_green",
                                      "Chemlight_red",
                      				"DemoCharge_Remote_Mag", 
                                      "Titan_AT"];
                                      
                      _fac_count 	= 1;
                      
                      _leaders    = ["B_Soldier_SL_F", "B_Soldier_TL_F"];
                      _medics     = ["B_medic_F"];
                      _ats        = ["B_soldier_AT_F"];
                      _ars        = ["B_soldier_AR_F"];
                      _engis      = ["B_engineer_F"];
                      
                      
                      //specialized weapons based on class. classnames
                      _type = typeOf _caller;
                      switch (true) do
                      {
                      	case (_type IN _medics): {
                      		_items     = _items     + ["Medikit"];		
                              _fac_count = 30;
                              _backpacks 	= [	"B_Carryall_mcamo"];        
                      	};
                          case (_type IN _leaders): {        
                              _weapons   = ["arifle_MX_GL_F", "arifle_MX_GL_Black_F", "Rangefinder"];
                      		_magazines  = _magazines + ["3Rnd_HE_Grenade_shell", "3Rnd_SmokeRed_Grenade_shell", "3Rnd_SmokeGreen_Grenade_shell", "3Rnd_UGL_FlareGreen_F", "3Rnd_UGL_FlareRed_F"];
                      		
                      		
                      	};	
                      	case (_type IN _ats): {        
                      		_sidewpns = _sidewpns + ["launch_B_Titan_short_F"];
                              _sidemags  = _sidemags  + ["Titan_AP"];
                          };
                      	case (_type IN _ars): {
                      		_weapons    = ["arifle_MX_SW_F", "arifle_MX_SW_Black_F"];
                      		_magazines  = ["100Rnd_65x39_caseless_mag", "100Rnd_65x39_caseless_mag_Tracer"];
                      		_items      =  _items - ["muzzle_snds_H"] + ["muzzle_snds_H_SW"];
                          };	
                      	case (_type IN _engis): {
                      		_magazines = _magazines + ["SatchelCharge_Remote_Mag", "APERSMine_Range_Mag", "SLAMDirectionalMine_Wire_Mag"];
                      		_items     = _items     + ["ToolKit", "MineDetector"];		
                              _backpacks 	= [	"B_Kitbag_mcamo"];
                              
                          };
                      	
                          default {false};
                      };
                      
                      _box = "Box_NATO_AmmoVeh_F" createVehicleLocal 	(_primarypos); //Place this vehicle(box) on the marker called "ammobox".
                      _box1 = "B_supplyCrate_F" createVehicleLocal 	(_clothespos); //Place this vehicle(box) on the marker called "ammobox".
                      _box2 = "Box_NATO_AmmoVeh_F" createVehicleLocal (_sidepos);
                      
                      _box setDir _direction; // Sets the direction of the box
                      _box1 setDir _direction; // Sets the direction of the box
                      _box2 setDir _direction; // Sets the direction of the box
                      
                      _box allowDamage false; // Sets the direction of the box
                      _box1 allowDamage false; // Sets the direction of the box
                      _box2 allowDamage false; // Sets the direction of the box
                      
                      _box1 addAction ["<t color='#00ffff'>Get Long Range Radio</t> ", "call long_radio"];
                      _box1 addAction ["<t color='#008db8'>Get Short Range Radio</t> ", "call short_radio"];
                      
                      player reveal _box;
                      player reveal _box1;
                      player reveal _box2;
                      //refill the box every _timer seconds
                      
                      while {true} do
                      {
                          clearMagazineCargo _box;
                          clearWeaponCargo   _box;
                          clearItemCargo     _box;
                      	clearBackpackCargo _box;
                      	
                      	clearMagazineCargo _box1;
                          clearWeaponCargo   _box1;
                          clearItemCargo     _box1;
                      	clearBackpackCargo _box1;    
                      	
                      	clearMagazineCargo _box2;
                          clearWeaponCargo   _box2;
                          clearItemCargo     _box2;
                      	clearBackpackCargo _box2;
                          
                          {_box addWeaponCargo   [_x, 1];} foreach _weapons;
                          {_box addMagazineCargo [_x, 10];} foreach _magazines;
                          {_box addItemCargo     [_x, 1];} foreach _items;
                      
                      	_box addItemCargo     ["FirstAidKit", _fac_count];
                      	
                      	//clothes	
                          {_box1 addItemCargo     [_x, 1];} foreach _clothes;
                          {_box1 addBackpackCargo [_x, 1];} foreach _backpacks;
                      	
                      	//launchers
                      	{_box2 addWeaponCargo   [_x, 1];} foreach _sidewpns;
                          {_box2 addItemCargo   [_x, 1];} foreach _sideitms;
                          {_box2 addMagazineCargo [_x, 5];} foreach _sidemags;
                      	
                      	sleep _timer;
                      };

                      Comment


                      • #12
                        Re: Arma 3 - Class Based Ammo Crate.

                        Backing up the restricted arsenal. CSAT Enemy Assault v3_tg3

                        Code:
                        //fn_tgInit.sqf
                        [ammobox, player] call TG_fnc_ammo;
                        Code:
                        //fn_ammo.sqf
                        
                        /*Class based arsenal.
                        Usage: [ammobox, player] call TG_fnc_ammo;
                        where ammobox is an editor object name.
                        */
                        
                        _obj 		= _this select 0;
                        _caller 	= _this select 1;
                        
                        if (_caller != player) exitWith {};  // exit all other clients.
                        
                        _obj removeAction (_obj getVariable ["bis_fnc_arsenal_action", 0]);
                        
                        //Remove everything from the _obj
                        [_obj, [_obj] call BIS_fnc_getVirtualBackpackCargo] call BIS_fnc_removeVirtualBackpackCargo;
                        [_obj, [_obj] call BIS_fnc_getVirtualItemCargo] call BIS_fnc_removeVirtualItemCargo;
                        [_obj, [_obj] call BIS_fnc_getVirtualMagazineCargo] call BIS_fnc_removeVirtualMagazineCargo;
                        [_obj, [_obj] call BIS_fnc_getVirtualWeaponCargo] call BIS_fnc_removeVirtualWeaponCargo;
                        
                        //default items, weapons and backpacks
                        _weapons    = [	"arifle_Katiba_F", 
                        					"arifle_Katiba_C_F", 
                        					"Binocular", 
                        					"Rangefinder", 
                        					"hgun_Rook40_snds_F", 
                        					"hgun_Pistol_heavy_02_Yorris_F"];
                        					
                        _magazines  = [	"30Rnd_65x39_caseless_green", 
                        					"30Rnd_65x39_caseless_green_mag_Tracer",
                        					
                        					"150Rnd_762x54_Box",
                        					"150Rnd_762x54_Box_Tracer",
                        					
                        					"150Rnd_93x64_Mag",					
                        					
                        					"10Rnd_762x54_Mag", 
                        					"10Rnd_127x54_Mag", 
                        					"10Rnd_93x64_DMR_05_Mag",				
                        					
                        					"16Rnd_9x21_Mag", 
                        					"6Rnd_45ACP_Cylinder", 
                        					
                        					"HandGrenade", 
                        					"MiniGrenade",
                        					"SmokeShell", 
                        					"SmokeShellRed", 
                        					"SmokeShellGreen",
                        					"Chemlight_green", 
                        					"Chemlight_red",
                        					
                        					"DemoCharge_Remote_Mag",
                        					"SatchelCharge_Remote_Mag", 
                        					"APERSMine_Range_Mag", 
                        					"SLAMDirectionalMine_Wire_Mag", 
                        					"APERSTripMine_Wire_Mag", 
                        					"ClaymoreDirectionalMine_Remote_Mag", 
                        					"APERSBoundingMine_Range_Mag", 
                        					"ATMine_Range_Mag",					
                        					
                        					"1Rnd_HE_Grenade_shell", 
                        					"1Rnd_SmokeRed_Grenade_shell", 
                        					"1Rnd_SmokeGreen_Grenade_shell", 
                        					"UGL_FlareGreen_F",
                        					"UGL_FlareRed_F",			
                        					
                        					"Laserbatteries",
                        					
                        					"RPG32_F", 
                        					"RPG32_HE_F", 
                        					
                        					"Titan_AT", 
                        					"Titan_AP", 
                        					"Titan_AA"];	
                        
                        					
                        _items      = ["optic_ACO_grn", 
                        				"optic_Holosight",
                        				"optic_Aco",
                        				
                        				"muzzle_snds_H", 
                        				"muzzle_snds_93mmg", 
                        				"muzzle_snds_93mmg_tan",
                        				"muzzle_snds_B", 
                        				"bipod_02_F_blk",
                        				"bipod_02_F_tan", 
                        				"bipod_02_F_hex",
                        				
                        				"acc_flashlight", 
                        				"acc_pointer_IR",
                        				
                        				"H_Bandanna_cbr",
                                        "H_Watchcap_blk",
                        				"H_Booniehat_khk",				
                        				"H_Cap_tan",
                        				"H_HelmetO_ocamo",
                        				"H_HelmetLeaderO_ocamo",
                                        "H_HelmetSpecO_ocamo",                
                        				
                        				"G_Aviator",
                        				"G_Spectacles",
                        				"G_Sport_Blackred",
                        				"G_Balaclava_blk",				
                        				"G_Bandanna_beast",
                        				"G_Bandanna_tan",
                        				
                                        "V_HarnessOGL_brn",
                                        "V_HarnessO_brn",
                                        "V_HarnessO_gry",
                        				"V_TacVest_brn", 
                        				"V_Chestrig_khk",
                                        "V_TacVest_khk",
                        				
                        				"ItemMap",
                        				"ItemRadio",
                        				"ItemWatch",
                        				"ItemCompass",
                        				"ItemGPS",
                        				
                        				"FirtAidKit",
                        				"ToolKit", 
                        				"MineDetector",
                        				"NVGoggles_OPFOR"];
                        				
                        _backpacks = ["B_AssaultPack_ocamo",
                        				"B_Respawn_TentA_F", 
                        				"B_Respawn_Sleeping_bag_brown_F", 
                        				"B_Parachute",
                        				"O_HMG_01_support_F",
                        				"O_GMG_01_A_weapon_F",
                        				"O_HMG_01_A_weapon_F",
                        				"O_HMG_01_weapon_F",
                        				"O_GMG_01_weapon_F",
                        				"O_HMG_01_support_high_F",
                        				"O_HMG_01_high_weapon_F",
                        				"O_GMG_01_high_weapon_F",
                        				"O_AA_01_weapon_F",
                        				"O_AT_01_weapon_F",				
                        				"O_Static_Designator_02_weapon_F",				
                        				"O_Mortar_01_support_F",
                        				"O_Mortar_01_weapon_F"];
                        				
                        _leaders		= ["O_officer_F", "O_Soldier_SL_F", "O_Soldier_TL_F"];
                        _grenadier		= ["O_Soldier_GL_F"];
                        _mules		  	= ["O_Soldier_A_F"];
                        _medics     	= ["O_medic_F"];
                        _lats       	= ["O_Soldier_LAT_F"];
                        _ars        	= ["O_Soldier_AR_F"];
                        _engis      	= ["O_engineer_F"];
                        _crewmen    	= ["O_crew_F"];
                        _marksmen 	 	= ["O_soldier_M_F"];
                        _heavyGunner 	= ["O_HeavyGunner_F"];
                        _asstHeavyGun = ["O_Soldier_AAR_F"];
                        _heavyAT 		= ["O_Soldier_AT_F"];
                        _aat 			= ["O_Soldier_AAT_F"];
                        _heavyAA		= ["O_Soldier_AA_F"];
                        _aaa			= ["O_Soldier_AAA_F"];
                        _helo 			= ["O_helipilot_F"];
                        _uav 			= ["O_soldier_UAV_F"];
                        
                        //specialized weapons based on class. classnames
                        _type = typeOf _caller;
                        switch (true) do
                        {
                        	case (_type IN _medics): {_items = _items + ["Medikit"];};
                        	case (_type IN _mules): {_backpacks = _backpacks + ["B_Carryall_ocamo"];};
                            case (_type IN _leaders): {_weapons = _weapons + ["arifle_Katiba_GL_F", "Laserdesignator_02"]; _items = _items + ["optic_Arco"];};
                        	case (_type IN _grenadier): {_weapons   = _weapons + ["arifle_Katiba_GL_F"];};
                        	case (_type IN _lats): {_weapons = _weapons + ["launch_RPG32_F"];};
                        	case (_type IN _ars): {_weapons    = _weapons + ["LMG_Zafir_F"];};
                        	case (_type IN _engis): {_backpacks = _backpacks + ["B_Carryall_ocamo"];};
                            case (_type IN _crewmen): {
                        		_items = ["V_BandollierB_khk", "H_HelmetCrew_O", "optic_ACO_grn","ItemMap","ItemRadio","ItemWatch","ItemCompass","ItemGPS","FirtAidKit","NVGoggles_OPFOR"];
                                _backpacks 	= [];
                                _weapons    = ["arifle_Katiba_C_F"];
                                _magazines  = ["30Rnd_65x39_caseless_green", "30Rnd_65x39_caseless_green_mag_Tracer"];
                            };
                        	case (_type IN _marksmen): {
                                _weapons   = _weapons + ["srifle_DMR_01_F", "srifle_DMR_05_blk_F", "srifle_DMR_05_hex_F", "srifle_DMR_05_tan_f", "srifle_DMR_04_F", "srifle_DMR_04_Tan_F"];
                        		_items      = _items + ["optic_DMS", "optic_KHS_hex", "optic_KHS_blk", "optic_KHS_old", "optic_KHS_tan", "optic_Nightstalker"];		
                            };
                        	case (_type IN _heavyGunner): {_weapons    = _weapons + ["LMG_Zafir_F", "MMG_01_hex_F", "MMG_01_tan_F"];	_items      = _items + ["optic_Arco"];};
                        	case (_type IN _asstHeavyGun): {_backpacks 	= _backpacks + ["B_Carryall_ocamo"];};
                        	case (_type IN _heavyAT): {_weapons = _weapons + ["launch_O_Titan_short_F"];};
                        	case (_type IN _aat): {_backpacks 	= _backpacks + ["B_Carryall_ocamo"];};
                        	case (_type IN _heavyAA): {_weapons = _weapons + ["launch_O_Titan_F"];};
                        	case (_type IN _aaa): {_backpacks 	= _backpacks + ["B_Carryall_ocamo"];};
                        	case (_type IN _helo): {		
                                _backpacks 	= [];
                                _weapons    = ["SMG_02_F"];
                                _magazines  = ["30Rnd_9x21_Mag"];
                                _items      = ["V_TacVest_khk", "H_PilotHelmetHeli_O", "ItemMap","ItemRadio","ItemWatch","ItemCompass","ItemGPS",	"FirtAidKit","NVGoggles_OPFOR", "optic_ACO_grn_smg"];
                            };
                        	case (_type IN _uav): {_items      = _items + ["O_UavTerminal "];_backpacks = _backpacks + ["O_UAV_01_backpack_F"];};
                            default {false};
                        };
                        
                        //Add the new ones to the object
                        [_obj, _backpacks] call BIS_fnc_addVirtualBackpackCargo; 
                        [_obj, _items] call BIS_fnc_addVirtualItemCargo; 
                        [_obj, _magazines] call BIS_fnc_addVirtualMagazineCargo; 
                        [_obj, _weapons] call BIS_fnc_addVirtualWeaponCargo;
                        
                        _action = _obj addaction [
                        	"Arsenal",
                        	{
                        		_box = _this select 0;
                        		_unit = _this select 1;
                        		["Open",[nil,_box]] call bis_fnc_arsenal;
                        	},
                        	[],
                        	6,
                        	true,
                        	false,
                        	"",
                        	"
                        		_cargo = _target getvariable ['bis_addVirtualWeaponCargo_cargo',[[],[],[],[]]];
                        		if ({count _x > 0} count _cargo == 0) then {
                        			_target removeaction (_target getvariable ['bis_fnc_arsenal_action',-1]);
                        			_target setvariable ['bis_fnc_arsenal_action',nil];
                        		};
                        		_condition = _target getvariable ['bis_fnc_arsenal_condition',{true}];
                        		alive _target && {_target distance _this < 8} && {call _condition}
                        	"
                        ];
                        _obj setVariable ["bis_fnc_arsenal_action", _action];

                        Comment

                        Connect

                        Collapse

                        TeamSpeak 3 Server

                        Collapse

                        Advertisement

                        Collapse

                        Twitter Feed

                        Collapse

                        Working...
                        X