Advertisement
OksmanTV

Untitled

Jun 5th, 2023 (edited)
2,343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 21.58 KB | None | 0 0
  1. /// CBA Keybind and Settings
  2. [
  3.     "WBK_DualWeapons_WhereWeaponAt",
  4.     "LIST",
  5.     "Where secon weapon is shown",
  6.     "WebKnight's Two Primary Weapons",
  7.     [["Pelvis", "Spine"], ["Pelvis", "Spine"], 0],
  8.     nil,
  9.     {  
  10.         params ["_value"];
  11.         WBK_LocalParamWhereWeaponIs = _value;
  12.     }
  13. ] call CBA_fnc_addSetting;
  14.  
  15. ["WebKnight's Two Primary Weapons", "WBK_DualWeapons_MainKeybind", ["Weapon on Back/Switch between weapons", "Put a weapon on a back/Switch current weapon with your second primary weapon."], {
  16.         if (((getText (configfile >> "CfgWeapons" >> currentWeapon player >> "reloadAction")) == (gestureState player)) or !(isNull objectParent player) or (lifeState player == "INCAPACITATED") or (captive player) or !(alive player) or (gestureState player == "WBK_TakeOutWeapon_High") or (gestureState player == "WBK_PutWeaponOnBack_Main")  or (gestureState player == "WBK_PistolPutBack") or (gestureState player == "DoubleWeapons_High_Out") or (gestureState player == "DoubleWeapons_Low_Out") or (gestureState player == "DoubleWeapons_High_Take") or (gestureState player == "DoubleWeapons_Low_Take")) exitWith {};
  17.         if (!(isNil {player getVariable "WBK_SecondWeapon"})) exitWith {player spawn WBK_CreateSwitchBetweenWeapons;};
  18.         player spawn WBK_CreateWeaponSecond;
  19.     }, {}, [5, [false, false, false]]] call cba_fnc_addKeybind;
  20.  
  21.  
  22. WBK_CreateSoundEffect = {
  23.     _unit = _this select 0;
  24.     _snd = _this select 1;
  25.     _dist = _this select 2;
  26.     _soundCache = "#particlesource" createVehicle position _unit;
  27.     _soundCache attachTo [_unit, [0, 0, 0.2], "Spine3"];
  28.     [_soundCache, _snd, _dist] call CBA_fnc_globalSay3d;
  29.     sleep 4;
  30.     deleteVehicle _soundCache;
  31. };
  32.  
  33. WBK_CreateSwitchBetweenWeapons = {
  34.     _unit = _this;
  35.  
  36.     if ((isNil {_unit getVariable "WBK_SecondWeapon"})) exitWith {};
  37.  
  38.     if (primaryWeapon _unit == "") exitWith {
  39.         [_unit,"WBK_Rifle_TakeBack",15] spawn WBK_CreateSoundEffect;
  40.         _crate = (_unit getVariable "WBK_SecondWeapon") select 0;
  41.         deleteVehicle _crate;
  42.  
  43.         // Variable Definitions
  44.         _weapAttached = (_unit getVariable "WBK_SecondWeapon") select 1;
  45.         _unit setVariable ["WBK_SecondWeapon",nil,true];
  46.  
  47.         _weapAttached params ["_weapon","_item1","_item2","_item3","_mag1","_mag2","_item4"];
  48.         _mag1 params ["_magAct","_magCnt"];
  49.         _mag2 params ["_mag2Act","_mag2Cnt"];
  50.         _magLaunch = "";
  51.         if (!(isNil "_mag2Act")) then {
  52.             _magLaunch = _mag2 select 0;
  53.         };
  54.  
  55.         // Add Weapons, Items and Magazine
  56.         _unit addMagazine _magAct;
  57.         _unit addWeapon _weapon;
  58.         {
  59.             _unit addPrimaryWeaponItem _x;  
  60.         } forEach [_item1,_item2,_item3,_item4, _magLaunch];
  61.         _unit setAmmo [primaryWeapon _unit, _magCnt];
  62.         _unit selectWeapon _weapon;
  63.  
  64.         // Animation
  65.         if (WBK_LocalParamWhereWeaponIs == "Pelvis") then {
  66.             _unit playActionNow "DoubleWeapons_Low_Take";
  67.             _unit playActionNow "DoubleWeapons_Low_Take";
  68.             _unit playActionNow "DoubleWeapons_Low_Take";
  69.         }else{
  70.             _unit playActionNow "DoubleWeapons_High_Take";
  71.             _unit playActionNow "DoubleWeapons_High_Take";
  72.             _unit playActionNow "DoubleWeapons_High_Take";
  73.         };
  74.     };
  75.  
  76.     if (WBK_LocalParamWhereWeaponIs == "Pelvis") then {
  77.         _unit spawn WBK_SwapWeapons_ByPlayer_Pelvis;
  78.     }else{
  79.         _unit spawn WBK_SwapWeapons_ByPlayer_Spine;
  80.     };
  81. };
  82.  
  83. WBK_CreateWeaponSecond = {
  84.  
  85.     _unit = _this;
  86.     if (!(isNil {_unit getVariable "WBK_SecondWeapon"})) exitWith {};
  87.     if (WBK_LocalParamWhereWeaponIs == "Pelvis") then {
  88.         _unit playActionNow "DoubleWeapons_Low_Out";
  89.         _unit playActionNow "DoubleWeapons_Low_Out";
  90.         _unit playActionNow "DoubleWeapons_Low_Out";
  91.     }
  92.     else
  93.     {
  94.         _unit playActionNow "DoubleWeapons_High_Out";
  95.         _unit playActionNow "DoubleWeapons_High_Out";
  96.         _unit playActionNow "DoubleWeapons_High_Out";
  97.     };
  98.  
  99.     switch true do {
  100.         case (stance _unit == "CROUCH"): {_unit switchMove "AmovPknlMstpSrasWrflDnon_AmovPknlMstpSnonWnonDnon";_unit playMoveNow "AmovPknlMstpSrasWrflDnon_AmovPknlMstpSnonWnonDnon";};
  101.         case (stance _unit == "PRONE"): {_unit switchMove "AmovPpneMstpSrasWrflDnon_AmovPpneMstpSnonWnonDnon";_unit playMoveNow "AmovPpneMstpSrasWrflDnon_AmovPpneMstpSnonWnonDnon";};
  102.     };
  103.    
  104.     [_unit,"WBK_PutInSlot",15] spawn WBK_CreateSoundEffect;
  105.  
  106.     _weap = primaryWeapon _unit;
  107.     _count = _unit ammo primaryWeapon _unit;
  108.     (primaryWeaponItems _unit) params ["_primaryWeaponItems1","_primaryWeaponItems2","_primaryWeaponItems3","_primaryWeaponItems4"];
  109.     (primaryWeaponMagazine _unit) params ["_primaryWeaponMagazine1","_primaryWeaponMagazineGl"];
  110.    
  111.     _primaryWeaponMagazine2 = [];
  112.     if (!(isNil "_primaryWeaponMagazineGl")) then {
  113.         _primaryWeaponMagazine2 = [_primaryWeaponMagazineGl,getNumber(configFile >> "CfgMagazines" >> _primaryWeaponMagazineGl >> "count")];
  114.     };  
  115.  
  116.     _primaryWeapon = [_weap, _primaryWeaponItems1, _primaryWeaponItems2, _primaryWeaponItems3, [_primaryWeaponMagazine1, _count], _primaryWeaponMagazine2, _primaryWeaponItems4];
  117.     _weaponHolder = createVehicle ["DummyWeapon_Wbk", getPosATL _unit, [], 0, "CAN_COLLIDE"];
  118.     _weaponHolder addWeaponWithAttachmentsCargoGlobal [_primaryWeapon, 1];
  119.     _unit setVariable ["WBK_SecondWeapon",[_weaponHolder,_primaryWeapon],true];
  120.  
  121.     if (WBK_LocalParamWhereWeaponIs == "Pelvis") then {
  122.         [_unit,_weaponHolder,"Pelvis"] call WBK_AdjustGunPos;
  123.     }
  124.     else
  125.     {
  126.         [_unit,_weaponHolder,"Spine_normal"] call WBK_AdjustGunPos;
  127.     };
  128.     _unit removeWeapon _weap;
  129. };
  130.  
  131. WKB_CreateWeaponSecond_Scripted = {
  132.     Params [
  133.         ["_unit",objNull,[objNull]],
  134.         ["_weap","arifle_MXC_F",[""]],
  135.         ["_primaryWeaponMagazine",["30Rnd_65x39_caseless_mag",""],[[]]],
  136.         ["_silencer","",[""]],
  137.         ["_laser","",[""]],
  138.         ["_optics","",[""]],
  139.         ["_bipod","",[""]] 
  140.     ];
  141.  
  142.     if (!(isNil {_unit getVariable "WBK_SecondWeapon"})) exitWith {};
  143.  
  144.     _primaryWeaponItems1 = _silencer;
  145.     _primaryWeaponItems2 = _laser;
  146.     _primaryWeaponItems3 = _optics;
  147.     _primaryWeaponItems4 = _bipod;
  148.     _primaryWeaponMagazine params ["_primaryWeaponMagazine1","_primaryWeaponMagazineGl"];
  149.     _primaryWeaponMagazine2 = [];
  150.  
  151.     if (!(isNil "_primaryWeaponMagazineGl")) then {
  152.         _primaryWeaponMagazine2 = [_primaryWeaponMagazineGl,getNumber(configFile >> "CfgMagazines" >> _primaryWeaponMagazineGl >> "count")];
  153.     };
  154.  
  155.     _primaryWeapon = [
  156.         _weap,
  157.         _primaryWeaponItems1,
  158.         _primaryWeaponItems2,
  159.         _primaryWeaponItems3,
  160.         [_primaryWeaponMagazine1, getNumber(configFile >> "CfgMagazines" >> _primaryWeaponMagazine1 >> "count")],
  161.         _primaryWeaponMagazine2,
  162.         _primaryWeaponItems4
  163.     ];
  164.     _weaponHolder = createVehicle ["DummyWeapon_Wbk", getPosATL _unit, [], 0, "CAN_COLLIDE"];
  165.     _weaponHolder addWeaponWithAttachmentsCargoGlobal [_primaryWeapon, 1];
  166.  
  167.     _unit setVariable ["WBK_SecondWeapon",[_weaponHolder,_primaryWeapon],true];
  168.  
  169.     if (WBK_LocalParamWhereWeaponIs == "Pelvis") then {
  170.         [_unit,_weaponHolder,"Pelvis"] call WBK_AdjustGunPos;
  171.     }
  172.     else
  173.     {
  174.         [_unit,_weaponHolder,"Spine_normal"] call WBK_AdjustGunPos;
  175.     };
  176.  
  177.     _unit removeWeapon _weap;
  178. };
  179.  
  180. WBK_SwapWeapons_Scripted = {
  181.  
  182.     _unit = _this;
  183.     if (isNil {_unit getVariable "WBK_SecondWeapon"}) exitWith {};
  184.    
  185.     _weap = primaryWeapon _unit;
  186.     _count = _unit ammo primaryWeapon _unit;
  187.     (primaryWeaponItems _unit) params ["_primaryWeaponItems1","_primaryWeaponItems2","_primaryWeaponItems3","_primaryWeaponItems4"];
  188.     (primaryWeaponMagazine _unit) params ["_primaryWeaponMagazine1","_primaryWeaponMagazineGl"];
  189.  
  190.     _primaryWeaponMagazine2 = [];
  191.     if (!(isNil "_primaryWeaponMagazineGl")) then {
  192.         _primaryWeaponMagazine2 = [_primaryWeaponMagazineGl,1];
  193.     };
  194.  
  195.     _primaryWeapon = [_weap, _primaryWeaponItems1, _primaryWeaponItems2, _primaryWeaponItems3, [_primaryWeaponMagazine1, _count], _primaryWeaponMagazine2, _primaryWeaponItems4];
  196.     _unit removeWeapon _weap;
  197.  
  198.     _crate = (_unit getVariable "WBK_SecondWeapon") select 0;
  199.     _weapAttached = (_unit getVariable "WBK_SecondWeapon") select 1;
  200.     deleteVehicle _crate;
  201.    
  202.     _weapAttached params ["_weapon","_item1","_item2","_item3","_mag1","_mag2","_item4"];
  203.     _mag1 params ["_magAct","_magCnt"];
  204.     _mag2 params ["_mag2Act","_mag2Cnt"];
  205.     _magLaunch = "";
  206.  
  207.     if (!(isNil "_mag2Act")) then {
  208.         _magLaunch = _mag2 select 0;
  209.     };
  210.  
  211.     _unit addMagazine _magAct;
  212.     _unit addWeapon _weapon;
  213.     {
  214.         _unit addPrimaryWeaponItem _x;
  215.     } forEach [_item1,_item2,_item3,_item4, _magLaunch];
  216.     _unit setAmmo [primaryWeapon _unit, _magCnt];
  217.  
  218.     _crateNew = createVehicle ["DummyWeapon_Wbk", getPosATL _unit, [], 0, "CAN_COLLIDE"];
  219.     _crateNew addWeaponWithAttachmentsCargoGlobal [_primaryWeapon, 1];
  220.     _unit setVariable ["WBK_SecondWeapon",[_crateNew,_primaryWeapon],true];
  221.     [_unit,_crateNew,"Pelvis"] call WBK_AdjustGunPos;
  222. };
  223.  
  224. WBK_AdjustGunPos = {
  225.     _unit = _this select 0;
  226.     _crate = _this select 1;
  227.     _param = _this select 2;
  228.     _crate lockInventory true;
  229.     _crate setDamage 1;
  230.     if (_param == "Melee_Spine") exitWith {
  231.         _crate attachTo [_unit,[0.1,-0.18,0.26],"Spine3",true];  
  232.         _y = 230;    
  233.         _p = -80;    
  234.         _r  = 310;    
  235.         _crate setVectorDirAndUp [            
  236.             [sin _y * cos _p, cos _y * cos _p, sin _p],            
  237.             [[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D            
  238.         ];      
  239.     };
  240.     if (_param == "Melee_Pelvis") exitWith {
  241.         _crate attachTo [_unit,[-0.25,0,0],"Pelvis",true];    
  242.         _y = 180;    
  243.         _p = -40;    
  244.         _r  = 110;      
  245.         _crate setVectorDirAndUp [            
  246.             [sin _y * cos _p, cos _y * cos _p, sin _p],            
  247.             [[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D            
  248.         ];      
  249.     };
  250.     if (_param == "Spine") exitWith {
  251.         _crate attachTo [_unit,[0.1,-0.2,0.02],"Spine3",true];
  252.         _y = 80;  
  253.         _p = 0;  
  254.         _r  = -82;  
  255.         _crate setVectorDirAndUp [          
  256.             [sin _y * cos _p, cos _y * cos _p, sin _p],          
  257.             [[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D          
  258.         ];    
  259.     };
  260.     if (_param == "Spine_normal") exitWith {
  261.         _crate attachTo [_unit,[-0.15,-0.185,0],"Spine3",true];  
  262.         _y = 110;    
  263.         _p = 0;    
  264.         _r  = -82;    
  265.         _crate setVectorDirAndUp [          
  266.             [sin _y * cos _p, cos _y * cos _p, sin _p],          
  267.             [[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D          
  268.         ];      
  269.     };
  270.     if (_param == "Pelvis") exitWith {
  271.         _crate attachTo [_unit,[-0.19,-0.17,-0.17],"Pelvis",true];  
  272.         _y = 310;    
  273.         _p = 150;    
  274.         _r  = -115;    
  275.         _crate setVectorDirAndUp [          
  276.             [sin _y * cos _p, cos _y * cos _p, sin _p],          
  277.             [[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D          
  278.         ];  
  279.     };
  280. };
  281.  
  282. WBK_SwapWeapons_ByPlayer_Pelvis = {
  283.     _unit = _this;
  284.     if (isNil {_unit getVariable "WBK_SecondWeapon"}) exitWith {};
  285.     if (WBK_IsCurrentWeaponMainOnPlayer) exitWith {
  286.         WBK_IsCurrentWeaponMainOnPlayer = false;
  287.         [_unit,"WBK_Rifle_PutAway",15] spawn WBK_CreateSoundEffect;
  288.  
  289.         _weap = currentWeapon _unit;
  290.         if (_weap == handGunWeapon _unit) then {
  291.             _unit playActionNow "WBK_PistolPutBack";
  292.             _unit playActionNow "WBK_PistolPutBack";
  293.             _unit playActionNow "WBK_PistolPutBack";
  294.             sleep 0.5;
  295.         }
  296.         else
  297.         {
  298.             _unit playActionNow "WBK_PutWeaponOnBack_Main";
  299.             _unit playActionNow "WBK_PutWeaponOnBack_Main";
  300.             _unit playActionNow "WBK_PutWeaponOnBack_Main";
  301.             sleep 0.9;
  302.         };
  303.        
  304.         if (!(currentWeapon _unit == _weap)) exitWith {};
  305.  
  306.         _weap = primaryWeapon _unit;
  307.         _count = _unit ammo primaryWeapon _unit;
  308.         (primaryWeaponItems _unit) params ["_primaryWeaponItems1","_primaryWeaponItems2","_primaryWeaponItems3","_primaryWeaponItems4"];
  309.         (primaryWeaponMagazine _unit) params ["_primaryWeaponMagazine1","_primaryWeaponMagazineGl"];
  310.        
  311.         _primaryWeaponMagazine2 = [];
  312.         if (!(isNil "_primaryWeaponMagazineGl")) then {
  313.             _primaryWeaponMagazine2 = [_primaryWeaponMagazineGl,1];
  314.         };      
  315.        
  316.         _primaryWeapon = [_weap, _primaryWeaponItems1, _primaryWeaponItems2, _primaryWeaponItems3, [_primaryWeaponMagazine1, _count], _primaryWeaponMagazine2, _primaryWeaponItems4];
  317.         _unit removeWeapon _weap;
  318.         _crate = (_unit getVariable "WBK_SecondWeapon") select 0;
  319.         _weapAttached = (_unit getVariable "WBK_SecondWeapon") select 1;
  320.         deleteVehicle _crate;
  321.  
  322.         _weapAttached params ["_weapon","_item1","_item2","_item3","_mag1","_mag2","_item4"];
  323.         _mag1 params ["_magAct","_magCnt"];
  324.         _mag2 params ["_mag2Act","_mag2Cnt"];
  325.         _magLaunch = "";
  326.  
  327.         if (!(isNil "_mag2Act")) then {
  328.             _magLaunch = _mag2Act;
  329.         };
  330.  
  331.         _unit addMagazine _magAct;
  332.         _unit addWeapon _weapon;
  333.         {
  334.             _unit addPrimaryWeaponItem _x;
  335.         } forEach [_item1,_item2,_item3,_item4, _magLaunch];
  336.         _unit setAmmo [primaryWeapon _unit, _magCnt];
  337.  
  338.         _crateNew = createVehicle ["DummyWeapon_Wbk", getPosATL _unit, [], 0, "CAN_COLLIDE"];
  339.         _crateNew addWeaponWithAttachmentsCargoGlobal [_primaryWeapon, 1];
  340.  
  341.         _unit setVariable ["WBK_SecondWeapon",[_crateNew,_primaryWeapon],true];
  342.         [_unit,_crateNew,"Spine"] call WBK_AdjustGunPos;
  343.  
  344.         _unit selectWeapon _weapon;
  345.         _unit playActionNow "DoubleWeapons_Low_Take";
  346.         _unit playActionNow "DoubleWeapons_Low_Take";
  347.         _unit playActionNow "DoubleWeapons_Low_Take";
  348.     };
  349.  
  350.     WBK_IsCurrentWeaponMainOnPlayer = true;
  351.     [_unit,"WBK_Rifle_TakeBack",15] spawn WBK_CreateSoundEffect;
  352.  
  353.     _weap = currentWeapon _unit;
  354.     if (_weap == handGunWeapon _unit) then {
  355.         _unit playActionNow "WBK_PistolPutBack";
  356.         _unit playActionNow "WBK_PistolPutBack";
  357.         _unit playActionNow "WBK_PistolPutBack";
  358.     }
  359.     else
  360.     {
  361.         _unit playActionNow "DoubleWeapons_Low_Out";
  362.         _unit playActionNow "DoubleWeapons_Low_Out";
  363.         _unit playActionNow "DoubleWeapons_Low_Out";
  364.         sleep 0.7;
  365.     };
  366.  
  367.     if (!(currentWeapon _unit == _weap)) exitWith {};
  368.  
  369.     _weap = primaryWeapon _unit;
  370.     _count = _unit ammo primaryWeapon _unit;
  371.     (primaryWeaponItems _unit) params ["_primaryWeaponItems1","_primaryWeaponItems2","_primaryWeaponItems3","_primaryWeaponItems4"];
  372.     (primaryWeaponMagazine _unit) params ["_primaryWeaponMagazine1","_primaryWeaponMagazineGl"];
  373.    
  374.     _primaryWeaponMagazine2 = [];
  375.     if (!(isNil "_primaryWeaponMagazineGl")) then {
  376.         _primaryWeaponMagazine2 = [_primaryWeaponMagazineGl,1];
  377.     };
  378.     _primaryWeapon = [_weap, _primaryWeaponItems1, _primaryWeaponItems2, _primaryWeaponItems3, [_primaryWeaponMagazine1, _count], _primaryWeaponMagazine2, _primaryWeaponItems4];
  379.    
  380.     _unit removeWeapon _weap;
  381.     _crate = (_unit getVariable "WBK_SecondWeapon") select 0;
  382.     _weapAttached = (_unit getVariable "WBK_SecondWeapon") select 1;
  383.     deleteVehicle _crate;
  384.  
  385.     _weapAttached params ["_weapon","_item1","_item2","_item3","_mag1","_mag2","_item4"];
  386.     _mag1 params ["_magAct","_magCnt"];
  387.     _mag2 params ["_mag2Act","_mag2Cnt"];
  388.     _magLaunch = "";
  389.  
  390.     if (!(isNil "_mag2Act")) then {
  391.         _magLaunch = _mag2Act;
  392.     };
  393.  
  394.     _unit addMagazine _magAct;
  395.     _unit addWeapon _weapon;
  396.     {
  397.         _unit addPrimaryWeaponItem _x;
  398.     } forEach [_item1,_item2,_item3,_item4, _magLaunch];
  399.     _unit setAmmo [primaryWeapon _unit, _magCnt];
  400.  
  401.     _crateNew = createVehicle ["DummyWeapon_Wbk", getPosATL _unit, [], 0, "CAN_COLLIDE"];
  402.     _crateNew addWeaponWithAttachmentsCargoGlobal [_primaryWeapon, 1];
  403.  
  404.     _unit setVariable ["WBK_SecondWeapon",[_crateNew,_primaryWeapon],true];
  405.     [_unit,_crateNew,"Pelvis"] call WBK_AdjustGunPos;
  406.  
  407.     _unit selectWeapon _weapon;
  408.     _unit playActionNow "WBK_TakeOutWeapon_High";
  409.     _unit playActionNow "WBK_TakeOutWeapon_High";
  410.     _unit playActionNow "WBK_TakeOutWeapon_High";
  411. };
  412.  
  413. WBK_SwapWeapons_ByPlayer_Spine = {
  414.     _unit = _this;
  415.     if (isNil {_unit getVariable "WBK_SecondWeapon"}) exitWith {};
  416.     if (WBK_IsCurrentWeaponMainOnPlayer) exitWith {
  417.         [_unit,"WBK_Rifle_PutAway",15] spawn WBK_CreateSoundEffect;
  418.         WBK_IsCurrentWeaponMainOnPlayer = false;
  419.         _weap = currentWeapon _unit;
  420.        
  421.         if (_weap == handGunWeapon _unit) then {
  422.             _unit playActionNow "WBK_PistolPutBack";
  423.             _unit playActionNow "WBK_PistolPutBack";
  424.             _unit playActionNow "WBK_PistolPutBack";
  425.             sleep 0.5;
  426.         }
  427.         else
  428.         {
  429.             _unit playActionNow "WBK_PutWeaponOnBack_Main";
  430.             _unit playActionNow "WBK_PutWeaponOnBack_Main";
  431.             _unit playActionNow "WBK_PutWeaponOnBack_Main";
  432.             sleep 0.8;
  433.         };
  434.  
  435.         if (!(currentWeapon _unit == _weap)) exitWith {};
  436.  
  437.         _weap = primaryWeapon _unit;
  438.         _count = _unit ammo primaryWeapon _unit;
  439.         (primaryWeaponItems _unit) params ["_primaryWeaponItems1","_primaryWeaponItems2","_primaryWeaponItems3","_primaryWeaponItems4"];
  440.         (primaryWeaponMagazine _unit) params ["_primaryWeaponMagazine1","_primaryWeaponMagazineGl"];
  441.    
  442.         _primaryWeaponMagazine2 = [];
  443.         if (!(isNil "_primaryWeaponMagazineGl")) then {
  444.             _primaryWeaponMagazine2 = [_primaryWeaponMagazineGl,1];
  445.         };
  446.         _primaryWeapon = [_weap, _primaryWeaponItems1, _primaryWeaponItems2, _primaryWeaponItems3, [_primaryWeaponMagazine1, _count], _primaryWeaponMagazine2, _primaryWeaponItems4];
  447.        
  448.         _unit removeWeapon _weap;
  449.         _crate = (_unit getVariable "WBK_SecondWeapon") select 0;
  450.         _weapAttached = (_unit getVariable "WBK_SecondWeapon") select 1;
  451.         deleteVehicle _crate;
  452.  
  453.         _weapAttached params ["_weapon","_item1","_item2","_item3","_mag1","_mag2","_item4"];
  454.         _mag1 params ["_magAct","_magCnt"];
  455.         _mag2 params ["_mag2Act","_mag2Cnt"];
  456.         _magLaunch = "";
  457.  
  458.         if (!(isNil "_mag2Act")) then {
  459.             _magLaunch = _mag2Act;
  460.         };
  461.         _unit addMagazine _magAct;
  462.         _unit addWeapon _weapon;
  463.         {
  464.             _unit addPrimaryWeaponItem _x;
  465.         } forEach [_item1,_item2,_item3,_item4, _magLaunch];
  466.         _unit setAmmo [primaryWeapon _unit, _magCnt];
  467.  
  468.         _crateNew = createVehicle ["DummyWeapon_Wbk", getPosATL _unit, [], 0, "CAN_COLLIDE"];
  469.         _crateNew addWeaponWithAttachmentsCargoGlobal [_primaryWeapon, 1];
  470.  
  471.         _unit setVariable ["WBK_SecondWeapon",[_crateNew,_primaryWeapon],true];
  472.         [_unit,_crateNew,"Spine"] call WBK_AdjustGunPos;
  473.  
  474.         _unit selectWeapon _weapon;
  475.         _unit playActionNow "DoubleWeapons_High_Take";
  476.         _unit playActionNow "DoubleWeapons_High_Take";
  477.         _unit playActionNow "DoubleWeapons_High_Take";
  478.     };
  479.  
  480.     WBK_IsCurrentWeaponMainOnPlayer = true;
  481.     [_unit,"WBK_Rifle_TakeBack",15] spawn WBK_CreateSoundEffect;
  482.     _weap = currentWeapon _unit;
  483.     if (_weap == handGunWeapon _unit) then {
  484.         _unit playActionNow "WBK_PistolPutBack";
  485.         _unit playActionNow "WBK_PistolPutBack";
  486.         _unit playActionNow "WBK_PistolPutBack";
  487.     }
  488.     else
  489.     {
  490.         _unit playActionNow "DoubleWeapons_High_Out";
  491.         _unit playActionNow "DoubleWeapons_High_Out";
  492.         _unit playActionNow "DoubleWeapons_High_Out";
  493.     };
  494.     sleep 0.6;
  495.     if (!(currentWeapon _unit == _weap)) exitWith {};
  496.  
  497.     _weap = primaryWeapon _unit;
  498.     _count = _unit ammo primaryWeapon _unit;
  499.     (primaryWeaponItems _unit) params ["_primaryWeaponItems1","_primaryWeaponItems2","_primaryWeaponItems3","_primaryWeaponItems4"];
  500.     (primaryWeaponMagazine _unit) params ["_primaryWeaponMagazine1","_primaryWeaponMagazineGl"];
  501.  
  502.     _primaryWeaponMagazine2 = [];
  503.     if (!(isNil "_primaryWeaponMagazineGl")) then {
  504.         _primaryWeaponMagazine2 = [_primaryWeaponMagazineGl,1];
  505.     };
  506.     _primaryWeapon = [_weap, _primaryWeaponItems1, _primaryWeaponItems2, _primaryWeaponItems3, [_primaryWeaponMagazine1, _count], _primaryWeaponMagazine2, _primaryWeaponItems4];
  507.     _unit removeWeapon _weap;
  508.  
  509.     _crate = (_unit getVariable "WBK_SecondWeapon") select 0;
  510.     _weapAttached = (_unit getVariable "WBK_SecondWeapon") select 1;
  511.     deleteVehicle _crate;
  512.  
  513.     _weapAttached params ["_weapon","_item1","_item2","_item3","_mag1","_mag2","_item4"];
  514.     _mag1 params ["_magAct","_magCnt"];
  515.     _mag2 params ["_mag2Act","_mag2Cnt"];
  516.     _magLaunch = "";
  517.  
  518.     if (!(isNil "_mag2Act")) then {
  519.         _magLaunch = _mag2Act;
  520.     };
  521.     _unit addMagazine _magAct;
  522.     _unit addWeapon _weapon;
  523.     {
  524.         _unit addPrimaryWeaponItem _x;
  525.     } forEach [_item1,_item2,_item3,_item4, _magLaunch];
  526.     _unit setAmmo [primaryWeapon _unit, _magCnt];
  527.  
  528.     _crateNew = createVehicle ["DummyWeapon_Wbk", getPosATL _unit, [], 0, "CAN_COLLIDE"];
  529.     _crateNew addWeaponWithAttachmentsCargoGlobal [_primaryWeapon, 1];
  530.  
  531.     _unit setVariable ["WBK_SecondWeapon",[_crateNew,_primaryWeapon],true];
  532.     [_unit,_crateNew,"Spine_normal"] call WBK_AdjustGunPos;
  533.  
  534.     _unit selectWeapon _weapon;
  535.     _unit playActionNow "WBK_TakeOutWeapon_High";
  536.     _unit playActionNow "WBK_TakeOutWeapon_High";
  537.     _unit playActionNow "WBK_TakeOutWeapon_High";
  538. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement