Advertisement
Guest User

randomEquipment.sqf

a guest
May 26th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 7.49 KB | None | 0 0
  1. //Script made by ante185
  2. //param : unit
  3. _unit = _this select 0;
  4.  
  5. _akList = [
  6.     "rhs_weap_ak103",
  7.     "rhs_weap_ak104",
  8.     "rhs_weap_ak105",
  9.     "rhs_weap_ak74",
  10.     "rhs_weap_ak74_2",
  11.     "rhs_weap_aks74_2_folded",
  12.     "rhs_weap_ak74_3",
  13.     "rhs_weap_ak74n",
  14.     "rhs_weap_aks74n",
  15.     "rhs_weap_aks74n_folded",
  16.     "rhs_weap_aks74un",
  17.     "rhs_weap_aks74un_folded",
  18.     "rhs_weap_akm",
  19.     "rhs_weap_akms",
  20.     "rhs_weap_ak74m",
  21.     "rhs_weap_ak74m_2mag",
  22.     "rhs_weap_ak74m_2mag_camo",
  23.     "rhs_weap_ak74m_folded",
  24.     "rhs_weap_ak74m_camo",
  25.     "rhs_weap_ak74m_camo_folded",
  26.     "rhs_weap_ak74m_desert",
  27.     "rhs_weap_ak74m_desert_folded",
  28.     "rhs_weap_ak74m_fullplum",
  29.     "rhs_weap_ak74m_plummag_folded"
  30. ];
  31. _akList = _akList call BIS_fnc_arrayShuffle;
  32. _akList = _akList + _akList;
  33.  
  34. _akCount = count _akList;
  35.  
  36. _akgpList = [
  37.     "rhs_weap_ak103_gp25",
  38.     "rhs_weap_ak74_gp25",
  39.     "rhs_weap_akm_gp25",
  40.     "rhs_weap_akms_gp25",
  41.     "rhs_weap_ak74n_gp25",
  42.     "rhs_weap_aks74n_gp25",
  43.     "rhs_weap_ak74m_gp25",
  44.     "rhs_weap_ak74m_gp25_folded",
  45.     "rhs_weap_ak74m_fullplum_gp25",
  46.     "rhs_weap_ak74m_fullplum_gp25_folded"
  47. ];
  48. _akgpList = _akgpList call BIS_fnc_arrayShuffle;
  49. _akgpList = _akgpList + _akgpList;
  50.  
  51. _akgpCount = count _akgpList;
  52.  
  53. _arList = [
  54.     "rhs_weap_m16a4_carryhandle",
  55.     "rhs_weap_m4_carryhandle",
  56.     "rhs_weap_m4a1"
  57. ];
  58. _arList = _arList call BIS_fnc_arrayShuffle;
  59. _arList = _arList + _arList;
  60.  
  61. _arCount = count _arList;
  62.  
  63.  
  64.  
  65. _argpList = [
  66.     "rhs_weap_m16a4_carryhandle_M203",
  67.     "rhs_weap_m4_m203S",
  68.     "rhs_weap_m4a1_carryhandle_m203S"
  69. ];
  70. _argpList = _argpList call BIS_fnc_arrayShuffle;
  71. _argpList = _argpList + _argpList;
  72.  
  73. _argpCount = count _argpList;
  74.  
  75. //array of the AK and AR list, for randomization purposes
  76. _arakList = [_arList, _akList];
  77. _gpList = [_argpList, _akgpList];
  78.  
  79. _mgList = [
  80.     "rhs_weap_m249",
  81.     "rhs_weap_m249_pip",
  82.     "rhs_weap_pkm"
  83. ];
  84. _mgList = _mgList call BIS_fnc_arrayShuffle;
  85. _mgList = _mgList + _mgList;
  86.  
  87. _mgCount = count _mgList;
  88.    
  89. _rifleList = [
  90.     "rhs_weap_svd_pso1",
  91.     "rhs_weap_svds_pso1",
  92.     "rhs_weap_svdp_pso1",
  93.     "rhs_weap_m24sws_blk_leu",
  94.     "srifle_DMR_06_camo_F",
  95.     "srifle_DMR_06_camo_khs_F",
  96.     "srifle_DMR_06_olive_F"
  97. ];
  98. _rifleList = _rifleList call BIS_fnc_arrayShuffle;
  99. _rifleList = _rifleList + _rifleList;
  100.  
  101. _rifleCount = count _rifleList;
  102.  
  103. _rpgList = [
  104.     "rhs_weap_m72a7",
  105.     "rhs_weap_rpg7_pgo",
  106.     "rhs_weap_rpg7",
  107.     "rhs_weap_rpg26",
  108.     "rhs_weap_m72a7",
  109.     "rhs_weap_rpg7",
  110.     "rhs_weap_rpg26"
  111. ];
  112. _rpgList = _rpgList call BIS_fnc_arrayShuffle;
  113. _rpgList = _rpgList + _rpgList;
  114.  
  115. _rpgCount = count _rpgList;
  116.  
  117. if (isServer) then {
  118.     BIS_randomSeed1 = [];
  119.     BIS_randomSeed2 = [];
  120.     BIS_randomSeed3 = [];
  121.     BIS_randomSeed4 = [];
  122.     BIS_randomSeed5 = [];
  123.     BIS_randomSeed6 = [];
  124.     BIS_randomSeed7 = [];
  125.     _rnd1 = floor random _akCount;    
  126.     _unit setVariable ["BIS_randomSeed1", _rnd1, TRUE];
  127.     _rnd2 = floor random _akgpCount;
  128.     _unit setVariable ["BIS_randomSeed2", _rnd2, TRUE];
  129.     _rnd3 = floor random _arCount;    
  130.     _unit setVariable ["BIS_randomSeed3", _rnd3, TRUE];
  131.     _rnd4 = floor random _argpCount;
  132.     _unit setVariable ["BIS_randomSeed4", _rnd4, TRUE];
  133.     _rnd5 = floor random _mgCount;    
  134.     _unit setVariable ["BIS_randomSeed5", _rnd5, TRUE];
  135.     _rnd6 = floor random _rifleCount;
  136.     _unit setVariable ["BIS_randomSeed6", _rnd6, TRUE];
  137.     _rnd7 = floor random _rpgCount;
  138.     _unit setVariable ["BIS_randomSeed7", _rnd7, TRUE];
  139.     _arorak = floor random 2;
  140.     _unit setVariable ["BIS_randomSeed8", _arorak, TRUE];
  141. };
  142.  
  143. _items = items _unit; // Medkits, ToolKits etc.
  144. _assitems = assignedItems _unit; // NVG's, GPS etc.
  145. _oldWeapon = currentWeapon _unit;
  146. sleep 0.01;
  147. _check = false;
  148. _addRpg = false;
  149. _rpg = [];
  150. _getArray = [];
  151. _getWeapon = [];
  152. _fiaAR = ["arifle_Mk20_F", "arifle_Mk20C_ACO_F","arifle_TRG20_ACO_F","arifle_TRG20_F","arifle_TRG21_F", "arifle_TRG21_MRCO_F"];
  153. _fiaGL = ["arifle_Mk20_GL_ACO_F", "arifle_TRG21_GL_F"];
  154. _fiaRIFLE = ["srifle_DMR_06_camo_khs_F", "arifle_Mk20_MRCO_F"];
  155. _fiaMG = ["LMG_Mk200_BI_F"];
  156. _fiaRPG = ["G_FieldPack_LAT"]; //checks for the ammo backpack rather than launcher
  157.  
  158. if (_oldWeapon in _fiaAR) then {
  159.  
  160.     waitUntil {!(isNil {_unit getVariable "BIS_randomSeed1"})};
  161.     waitUntil {!(isNil {_unit getVariable "BIS_randomSeed3"})};
  162.     waitUntil {!(isNil {_unit getVariable "BIS_randomSeed8"})};
  163.    
  164.     _randomSeed1 = _unit getVariable "BIS_randomSeed1";
  165.     _randomSeed3 = _unit getVariable "BIS_randomSeed3";
  166.     _randomSeed8 = _unit getVariable "BIS_randomSeed8";
  167.    
  168.     _getArray = (_arakList select _randomSeed8);
  169.     if (_getArray isEqualTo _akList) then {
  170.         _getWeapon = (_akList select _randomSeed1);
  171.     }
  172.     else {
  173.         _getWeapon = (_arList select _randomSeed3);
  174.     };
  175.     _check = true;
  176. };
  177.  
  178. if (_oldWeapon in _fiaGL) then {
  179.  
  180.     waitUntil {!(isNil {_unit getVariable "BIS_randomSeed1"})};
  181.     waitUntil {!(isNil {_unit getVariable "BIS_randomSeed2"})};
  182.     waitUntil {!(isNil {_unit getVariable "BIS_randomSeed8"})};
  183.    
  184.     _randomSeed2 = _unit getVariable "BIS_randomSeed2";
  185.     _randomSeed4 = _unit getVariable "BIS_randomSeed4";
  186.     _randomSeed8 = _unit getVariable "BIS_randomSeed8";
  187.    
  188.     _getArray = (_gpList select _randomSeed8);
  189.     if (_getArray isEqualTo _akgpList) then {
  190.         _getWeapon = (_akgpList select _randomSeed2);
  191.     }
  192.     else {
  193.         _getWeapon = (_argpList select _randomSeed4);
  194.     };
  195.     _check = true;
  196. };
  197.  
  198. if (_oldWeapon in _fiaRIFLE) then {
  199.  
  200.     waitUntil {!(isNil {_unit getVariable "BIS_randomSeed6"})};
  201.    
  202.     _randomSeed6 = _unit getVariable "BIS_randomSeed6";
  203.    
  204.     _getWeapon = (_rifleList select _randomSeed6);
  205.     _check = true;
  206. };
  207.  
  208. if (_oldWeapon in _fiaMG) then {
  209.  
  210.     waitUntil {!(isNil {_unit getVariable "BIS_randomSeed5"})};
  211.    
  212.     _randomSeed5 = _unit getVariable "BIS_randomSeed5";
  213.    
  214.     _getWeapon = (_mgList select _randomSeed5);
  215.     _check = true;
  216. };
  217.  
  218. if ((backpack _unit) in _fiaRPG) then {
  219.     waitUntil {!(isNil {_unit getVariable "BIS_randomSeed7"})};
  220.    
  221.     _randomSeed7 = _unit getVariable "BIS_randomSeed7";
  222.     _rpg = (_rpgList select _randomSeed7);
  223.     _addRpg = true;
  224. };
  225.  
  226. if (_check) then {
  227.  
  228.     removeAllWeapons _unit;
  229.    
  230.     _unit addItemToUniform "FirstAidKit";
  231.     _unit addItemToUniform "Chemlight_blue";
  232.     _unit addItemToVest "SmokeShell";
  233.     _unit addItemToVest "SmokeShellGreen";
  234.    
  235.     for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
  236.     for "_i" from 1 to 2 do {_unit addItemToVest "MiniGrenade";};
  237.        
  238.     if (_getWeapon in _akgpList) then {
  239.         for "_i" from 1 to 4 do {_unit addItemToVest "rhs_VOG25";};
  240.         for "_i" from 1 to 2 do {_unit addItemToVest "rhs_GRD40_White";};
  241.         _unit addItemToVest "rhs_GRD40_Green";
  242.         _unit addItemToVest "rhs_GRD40_Red";
  243.         _unit addItemToVest "rhs_GRD40_Red";
  244.         _unit addItemToVest "rhs_GDM40";
  245.     };
  246.     if (_getWeapon in _argpList) then{
  247.         for "_i" from 1 to 4 do {_unit addItemToVest "1Rnd_HE_Grenade_shell";};
  248.         for "_i" from 1 to 3 do {_unit addItemToVest "1Rnd_Smoke_Grenade_shell";};
  249.         _unit addItemToVest "1Rnd_SmokeGreen_Grenade_shell";
  250.         _unit addItemToVest "1Rnd_SmokeRed_Grenade_shell";
  251.         _unit addItemToVest "1Rnd_SmokeBlue_Grenade_shell";
  252.     };
  253.    
  254.     if (_getWeapon in _mgList) then {
  255.         _unit addBackpack "B_Kitbag_rgr";
  256.     };
  257.    
  258.     if (_addRpg) then {
  259.    
  260.         removeBackpack _unit;
  261.        
  262.         if (_rpg == "rhs_weap_rpg7_pgo" or _rpg == "rhs_weap_rpg7") then {
  263.        
  264.             _unit addBackpack "rhs_rpg_empty";
  265.            
  266.         };
  267.        
  268.         [_unit, _rpg, 4] call BIS_fnc_addWeapon;
  269.        
  270.     };
  271.    
  272.     [_unit, _getWeapon, 6] call BIS_fnc_addWeapon;
  273.  
  274.    
  275.     {_unit addItem _x} forEach _items;
  276.     {_unit addItem _x} forEach _assitems;
  277.     {_unit assignItem _x} forEach _assitems;
  278. };
  279.  
  280. getUnitLoadout _unit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement