Advertisement
TheGamingChief

Untitled

Jun 18th, 2016
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.57 KB | None | 0 0
  1. /******************************************************************************
  2. * ,1 ,-===========.
  3. * /,| ___________((____________\\_ _
  4. * ,========.________//_|/===========._#############L_Y_....-----====//
  5. * (#######(==========\################\=======.______ --############((
  6. * `=======`" ` ===============|::::.___|[ ))[JW]#############\\
  7. * |####| ""\###| :##########\\
  8. * /####/ \##\ ```"""=,,,))
  9. * C R E A T E D B Y B T K /####/ \##\
  10. * '====' `=`
  11. *******************************************************************************
  12. *
  13. * The main script engine. This file executes the load AND drop functions...
  14. *
  15. ******************************************************************************/
  16.  
  17.  
  18. /// Include the Objects Setup
  19. #include "Settings_Objects.sqf";
  20.  
  21.  
  22. //// Variables
  23. _Transporter = _this select 0;
  24. _TransporterType = typeOf _Transporter;
  25. _TransporterName = getText (configFile >> "CfgVehicles" >> (typeOf _Transporter) >> "displayName");
  26. _Unit = _this select 1;
  27. _Action = _this select 2;
  28. _Selected = (_this select 3) select 0;
  29. //_Dir = random 359;
  30.  
  31.  
  32. /// Create variables for Transporter Setup detection
  33. _SelectedTransporterTypeS = false;_SelectedTransporterTypeM = false;_SelectedTransporterTypeL = false;_SelectedTransporterTypeXL = false;
  34.  
  35.  
  36. /// Include the Transporter Setup
  37. #include "Settings_Transporter.sqf";
  38.  
  39. OL_Tow_Vcl_Settings = [
  40. [["tahoe_pink", "nigga2", "nigga3"], [0,0,0]],
  41. [["faggot1", "faggot2", "faggot3"], [0,0,1]],
  42. [["asshole1", "asshole2", "asshole3"], [0,1,0]]
  43. ];
  44.  
  45. fnc_GetVclArrayIndex = {
  46. _vcl = _this select 0;
  47.  
  48. for[{_c=0},{_c < count OL_Tow_Vcl_Settings},{_c=_c+1}]do{
  49.  
  50. _index = OL_Tow_Vcl_Settings select _c;
  51.  
  52. {
  53. if (_x == _vcl) then {
  54. exitWith { (_index) select 1;};
  55. }
  56. } foreach _index select 0;
  57. };
  58.  
  59. false;
  60. };
  61.  
  62.  
  63. //// Supported types
  64. if (!(_SelectedTransporterTypeS) && !(_SelectedTransporterTypeM) && !(_SelectedTransporterTypeL) && !(_SelectedTransporterTypeXL)) exitWith {
  65.  
  66. //// BTK_Hint - Not supported
  67. hint parseText format ["
  68. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  69. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  70. <t align='left' color='#eaeaea' size='1.0'>This vehicle does not support cargo transports!</t>
  71. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  72. "];
  73.  
  74. _Transporter removeAction _Action;
  75. };
  76.  
  77. sleep 1;
  78.  
  79.  
  80. //// Unit in transporter
  81. if ((_Unit in _Transporter) && !(_Selected == "UnloadCargo")) exitWith {
  82.  
  83. //// BTK_Hint - You have to get out
  84. hint parseText format ["
  85. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  86. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  87. <t align='left' color='#eaeaea' size='1.0'>You have to <t color='#fdd785'>get out</t> to load cargo!</t>
  88. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  89. "];
  90.  
  91. _Transporter removeAction _Action;
  92. };
  93.  
  94.  
  95. //// Unload function
  96. if (_Selected == "UnloadCargo") exitWith {
  97.  
  98. //// 2low
  99. if (!((getpos _Transporter) select 2 <= 2.1) && ((getpos _Transporter) select 2 <= 50)) exitWith {
  100.  
  101. //// BTK_Hint - Flying too low
  102. hint parseText format ["
  103. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  104. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  105. <t align='left' color='#eaeaea' size='1.0'>You have to fly above <t color='#fdd785'>50m</t> to drop the cargo!</t>
  106. <br />
  107. <t align='left' color='#eaeaea' size='1.0'>Or hover below <t color='#fdd785'>2m</t> to unload the cargo!</t>
  108. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  109. "];
  110. };
  111.  
  112. _Transporter removeAction _Action;
  113.  
  114. if ((getpos _Transporter) select 2 <= 1.5) then {
  115. UnloadCargo = true;
  116. DoUnload = true;
  117. _Transporter setVariable ["BTK_CargoDrop_ActionAdded", false];
  118. _Transporter setVariable ["BTK_CargoDrop_TransporterLoaded", false];
  119. }
  120.  
  121. else {
  122. UnloadCargo = true;
  123. DoDrop = true;
  124. _Transporter setVariable ["BTK_CargoDrop_ActionAdded", false];
  125. _Transporter setVariable ["BTK_CargoDrop_TransporterLoaded", false];
  126. };
  127. };
  128.  
  129.  
  130. /******************************************************************************
  131. * Load in - Small
  132. ******************************************************************************/
  133. if ((_Selected == "LoadCargo") && (_SelectedTransporterTypeS)) exitWith {
  134.  
  135. //// Get nearest objects
  136. _TransporterPos = _Transporter modelToWorld [0,0,0];
  137. _ObjectsInRange = nearestObjects [_Transporter, _ObjectsS, 15];
  138.  
  139. //// If no objects, exit with
  140. if (count _ObjectsInRange < 1) exitWith {
  141.  
  142. //// BTK_Hint - Nothing to load in range
  143. hint parseText format ["
  144. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  145. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  146. <t align='left' color='#eaeaea' size='1.0'>Nothing to load in range!<br /><br />Please move the object closer to the transporter.</t>
  147. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  148. "];
  149. };
  150.  
  151. //// Else, select the object from list
  152. _Object = _ObjectsInRange select 0;
  153. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", true];
  154. _Transporter setVariable ["BTK_CargoDrop_TransporterLoaded", true];
  155.  
  156.  
  157. //// Get the object name
  158. _ObjectName = getText (configFile >> "CfgVehicles" >> (typeOf _Object) >> "displayName");
  159.  
  160. //// BTK_Hint - Loading in...
  161. hint parseText format ["
  162. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  163. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  164. <t align='left' color='#eaeaea' size='1.0'>Loading <t color='#fdd785'>%1</t> into <t color='#fdd785'>%2</t> ...</t>
  165. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  166. ",_ObjectName,_TransporterName];
  167.  
  168. //// remove the Action
  169. _Transporter removeAction _Action;
  170.  
  171. //// Animate ramp
  172. // sleep 1;
  173. // _Transporter animate ["ramp_top", 1];
  174. // _Transporter animate ["ramp_bottom", 1];
  175.  
  176. //// Attach object to transporter
  177. sleep 3;
  178.  
  179. _pos = [typeof _Object] call fnc_GetVclArrayIndex;
  180. if (_pos != false) then {
  181. _Object attachTo [_transporter, _pos];
  182. } else {
  183. _Object attachTo [_transporter, [0,-5,0.5]];
  184. }
  185.  
  186. /*
  187. //// Chinook/Car fix
  188. if (_Object isKindOf "Car" || _Object isKindOf "Truck" || _Object isKindOf "Wheeled_APC") then {
  189.  
  190. if (_Object isKindOf "ATV_US_EP1") then {
  191. _Object attachTo [_Transporter,[0,-2.4,2.1]];
  192. };
  193. }
  194. else {
  195. //// Fix for F35
  196. if (_Transporter isKindOf "F35_base") then {
  197. _Object attachTo [_Transporter,[0,0.5,3]];
  198. } else {
  199. _Object attachTo [_Transporter,[0,0.5,3]];
  200. };
  201. };
  202.  
  203. */
  204.  
  205. _Object enableSimulation false;
  206.  
  207. //// Disable R3F
  208. _Object setVariable ["R3F_LOG_disabled", true];
  209.  
  210. //// Animate ramp again
  211. // sleep 1;
  212. // _Transporter animate ["ramp_top", 0];
  213. // _Transporter animate ["ramp_bottom", 0];
  214.  
  215. //// BTK_Hint - Loaded
  216. hint parseText format ["
  217. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  218. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  219. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> loaded.</t>
  220. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  221. ", _ObjectName,_TransporterName];
  222.  
  223. //// add unload/drop Action
  224. _UnloadAction = _Transporter addAction [("<t color=""#FF0000"">" + ("Release Vehicle") + "</t>"),"BTK\Cargo Drop\Engine.sqf",["UnloadCargo"], 5];
  225.  
  226. //// Wait until unload
  227. waitUntil {UnloadCargo || !(alive _Transporter) || !(alive _Object)};
  228.  
  229.  
  230. //// If destroyed
  231. if (!(alive _Transporter) || !(alive _Object)) exitWith {};
  232.  
  233.  
  234. //// If unload
  235. if (DoUnload) then {
  236.  
  237. //// Reset variables
  238. DoUnload = false;
  239. DoDrop = false;
  240. UnloadCargo = false;
  241. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", false];
  242. _Object enableSimulation true;
  243.  
  244. //// BTK_Hint - Unloading...
  245. hint parseText format ["
  246. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  247. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  248. <t align='left' color='#eaeaea' size='1.0'>Unloading <t color='#fdd785'>%1</t> from <t color='#fdd785'>%2</t> ...</t>
  249. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  250. ",_ObjectName,_TransporterName];
  251.  
  252. //// Animate ramp
  253. // sleep 1;
  254. // _Transporter animate ["ramp_top", 1];
  255. // _Transporter animate ["ramp_bottom", 1];
  256.  
  257. //// Detach object
  258. sleep 3;
  259. _Object attachTo [_Transporter,[0,-12,0]];
  260. sleep 0.2;
  261. deTach _Object;
  262. sleep 0.2;
  263. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),0];
  264.  
  265. //// Enable R3F
  266. _Object setVariable ["R3F_LOG_disabled", false];
  267.  
  268. //// Animate ramp again
  269. // sleep 1;
  270. // _Transporter animate ["ramp_top", 0];
  271. // _Transporter animate ["ramp_bottom", 0];
  272.  
  273. //// BTK_Hint - Unloaded
  274. hint parseText format ["
  275. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  276. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  277. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> unloaded.</t>
  278. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  279. ",_ObjectName,_TransporterName];
  280. };
  281.  
  282. //// If drop
  283. if (DoDrop) then {
  284.  
  285. //// BTK_Hint - Dropping...
  286. hint parseText format ["
  287. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  288. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  289. <t align='left' color='#eaeaea' size='1.0'>Dropping <t color='#fdd785'>%1</t> ...</t>
  290. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  291. ",_ObjectName,_TransporterName];
  292.  
  293. //// Reset variables
  294. DoUnload = false;
  295. DoDrop = false;
  296. UnloadCargo = false;
  297. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", false];
  298. _Object enableSimulation true;
  299.  
  300. //// Animate ramp
  301. // sleep 1;
  302. // _Transporter animate ["ramp_top", 1];
  303. // _Transporter animate ["ramp_bottom", 1];
  304.  
  305.  
  306. //// Detach object (drop)
  307. sleep 2;
  308. _Object setVariable ["R3F_LOG_disabled", false];
  309. deTach _Object;
  310. _Object attachTo [_Transporter,[0,-21,0]];
  311. sleep 0.1;
  312. deTach _Object;
  313. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),(getPos _Object select 2)-6];
  314.  
  315. //// Create parachute and smoke
  316. sleep 2;
  317. _Parachute = "ParachuteBigWest" createVehicle position _Object;
  318. _Parachute setPos (getPos _Object);
  319. _BlueSmoke = "SmokeShellBlue" createVehicle position _Object;
  320. _BlueSmoke setPos (getPos _Object);
  321. _Object attachTo [_Parachute,[0,0,-1.5]];
  322.  
  323. //// Animate ramp again
  324. // sleep 1;
  325. // _Transporter animate ["ramp_top", 0];
  326. // _Transporter animate ["ramp_bottom", 0];
  327.  
  328. //// BTK_Hint - Dropped
  329. hint parseText format ["
  330. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  331. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  332. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> dropped.</t>
  333. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  334. ",_ObjectName,_TransporterName];
  335.  
  336. //// Wait until ground reached
  337. waitUntil {(getPos _Object select 2) < 2};
  338. deTach _Object;
  339. sleep 3;
  340. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),0.001];
  341.  
  342. //// Enable R3F
  343. _Object setVariable ["R3F_LOG_disabled", false];
  344.  
  345. //// Delete parachute and smoke
  346. sleep 15;
  347. deleteVehicle _BlueSmoke;
  348. deleteVehicle _Parachute;
  349. };
  350. };
  351.  
  352.  
  353. /******************************************************************************
  354. * Load in - Medium
  355. ******************************************************************************/
  356. if ((_Selected == "LoadCargo") && (_SelectedTransporterTypeM)) exitWith {
  357.  
  358. //// Get nearest objects
  359. _TransporterPos = _Transporter modelToWorld [0,0,0];
  360. _ObjectsInRange = nearestObjects [_Transporter, _ObjectsM, 15];
  361.  
  362. //// If no objects, exit with
  363. if (count _ObjectsInRange < 1) exitWith {
  364.  
  365. //// BTK_Hint - Nothing to load in range
  366. hint parseText format ["
  367. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  368. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  369. <t align='left' color='#eaeaea' size='1.0'>Nothing to load in range!<br /><br />Please move the object closer to the transporter.</t>
  370. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  371. "];
  372. };
  373.  
  374. //// Else, select the object from list
  375. _Object = _ObjectsInRange select 0;
  376. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", true];
  377. _Transporter setVariable ["BTK_CargoDrop_TransporterLoaded", true];
  378.  
  379.  
  380. //// Get the object name
  381. _ObjectName = getText (configFile >> "CfgVehicles" >> (typeOf _Object) >> "displayName");
  382.  
  383. //// BTK_Hint - Loading in...
  384. hint parseText format ["
  385. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  386. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  387. <t align='left' color='#eaeaea' size='1.0'>Loading <t color='#fdd785'>%1</t> into <t color='#fdd785'>%2</t> ...</t>
  388. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  389. ",_ObjectName,_TransporterName];
  390.  
  391. //// remove the Action
  392. _Transporter removeAction _Action;
  393.  
  394. //// Animate ramp
  395. // sleep 1;
  396. // _Transporter animate ["ramp_top", 1];
  397. // _Transporter animate ["ramp_bottom", 1];
  398.  
  399. //// Attach object to transporter
  400. sleep 3;
  401.  
  402. if (_Transporter isKindOf "il_silverado_red") then {
  403. _Object attachTo [_Transporter,[0,-3,2.5]];
  404. };
  405. if (_Transporter isKindOf "il_silverado_black") then {
  406. _Object attachTo [_Transporter,[0,-3,2.5]];
  407. };
  408. if (_Transporter isKindOf "il_silverado_orange") then {
  409. _Object attachTo [_Transporter,[0,-3,2.5]];
  410. };
  411. if (_Transporter isKindOf "hilux1_civil_1_open") then {
  412. _Object attachTo [_Transporter,[0,-2,1]];
  413. };
  414. if (_Transporter isKindOf "datsun1_civil_3_open") then {
  415. _Object attachTo [_Transporter,[0,-2,1]];
  416. };
  417. if (_Transporter isKindOf "datsun1_civil_1_open") then {
  418. _Object attachTo [_Transporter,[0,-2,1]];
  419. };
  420. if (_Transporter isKindOf "cooter") then {
  421. _Object attachTo [_Transporter,[0,-5,-0.2]];
  422. };
  423.  
  424. // _Object attachTo [_Transporter,[0,-2,1]];
  425.  
  426. //// Disable R3F
  427. _Object setVariable ["R3F_LOG_disabled", true];
  428.  
  429. //// Animate ramp again
  430. // sleep 1;
  431. // _Transporter animate ["ramp_top", 0];
  432. // _Transporter animate ["ramp_bottom", 0];
  433.  
  434. //// BTK_Hint - Loaded
  435. hint parseText format ["
  436. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  437. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  438. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> loaded.</t>
  439. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  440. ", _ObjectName,_TransporterName];
  441.  
  442. //// add unload/drop Action
  443. _UnloadAction = _Transporter addAction [("<t color=""#FF0000"">" + ("Release Vehicle") + "</t>"),"BTK\Cargo Drop\Engine.sqf",["UnloadCargo"], 5];
  444.  
  445. //// Wait until unload
  446. waitUntil {UnloadCargo || !(alive _Transporter) || !(alive _Object)};
  447.  
  448.  
  449. //// If destroyed
  450. if (!(alive _Transporter) || !(alive _Object)) exitWith {};
  451.  
  452.  
  453. //// If unload
  454. if (DoUnload) then {
  455.  
  456. //// Reset variables
  457. DoUnload = false;
  458. DoDrop = false;
  459. UnloadCargo = false;
  460. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", false];
  461.  
  462. //// BTK_Hint - Unloading...
  463. hint parseText format ["
  464. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  465. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  466. <t align='left' color='#eaeaea' size='1.0'>Unloading <t color='#fdd785'>%1</t> from <t color='#fdd785'>%2</t> ...</t>
  467. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  468. ",_ObjectName,_TransporterName];
  469.  
  470. //// Animate ramp
  471. // sleep 1;
  472. // _Transporter animate ["ramp_top", 1];
  473. // _Transporter animate ["ramp_bottom", 1];
  474.  
  475. //// Detach object
  476. sleep 3;
  477. _Object attachTo [_Transporter,[0,-5,-0.2]];
  478. sleep 2;
  479. deTach _Object;
  480. sleep 2;
  481. _Object setPos [(getPos _Transporter select 0)+0,-5,-0.2,(getPos _Transporter select 1),1];
  482.  
  483. //// Enable R3F
  484. _Object setVariable ["R3F_LOG_disabled", false];
  485.  
  486. //// Animate ramp again
  487. // sleep 1;
  488. // _Transporter animate ["ramp_top", 0];
  489. // _Transporter animate ["ramp_bottom", 0];
  490.  
  491. //// BTK_Hint - Unloaded
  492. hint parseText format ["
  493. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  494. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  495. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> unloaded.</t>
  496. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  497. ",_ObjectName,_TransporterName];
  498. };
  499.  
  500. //// If drop
  501. if (DoDrop) then {
  502.  
  503. //// BTK_Hint - Dropping...
  504. hint parseText format ["
  505. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  506. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  507. <t align='left' color='#eaeaea' size='1.0'>Dropping <t color='#fdd785'>%1</t> ...</t>
  508. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  509. ",_ObjectName,_TransporterName];
  510.  
  511. //// Reset variables
  512. DoUnload = false;
  513. DoDrop = false;
  514. UnloadCargo = false;
  515. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", false];
  516.  
  517. //// Animate ramp
  518. // sleep 1;
  519. // _Transporter animate ["ramp_top", 1];
  520. // _Transporter animate ["ramp_bottom", 1];
  521.  
  522. //// Detach object (drop)
  523. sleep 2;
  524. _Object setVariable ["R3F_LOG_disabled", false];
  525. deTach _Object;
  526. _Object attachTo [_Transporter,[0,-2,1]];
  527. sleep 0.1;
  528. deTach _Object;
  529. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),(getPos _Object select 2)-6];
  530.  
  531. //// Create parachute and smoke
  532. sleep 2;
  533. _Parachute = "ParachuteBigWest" createVehicle position _Object;
  534. _Parachute setPos (getPos _Object);
  535. _BlueSmoke = "SmokeShellBlue" createVehicle position _Object;
  536. _BlueSmoke setPos (getPos _Object);
  537. _Object attachTo [_Parachute,[0,0,-1.5]];
  538.  
  539. //// Animate ramp again
  540. // sleep 1;
  541. // _Transporter animate ["ramp_top", 0];
  542. // _Transporter animate ["ramp_bottom", 0];
  543.  
  544. //// BTK_Hint - Dropped
  545. hint parseText format ["
  546. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  547. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  548. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> dropped.</t>
  549. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  550. ",_ObjectName,_TransporterName];
  551.  
  552. //// Wait until ground reached
  553. waitUntil {(getPos _Object select 2) < 2};
  554. deTach _Object;
  555. sleep 3;
  556. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),0.001];
  557.  
  558. //// Enable R3F
  559. _Object setVariable ["R3F_LOG_disabled", false];
  560.  
  561. //// Delete parachute and smoke
  562. sleep 15;
  563. deleteVehicle _BlueSmoke;
  564. deleteVehicle _Parachute;
  565. };
  566. };
  567.  
  568.  
  569. /******************************************************************************
  570. * Load in - Large
  571. ******************************************************************************/
  572. if ((_Selected == "LoadCargo") && (_SelectedTransporterTypeL)) exitWith {
  573.  
  574. //// Get nearest objects
  575. _TransporterPos = _Transporter modelToWorld [0,0,0];
  576. _ObjectsInRange = nearestObjects [_Transporter, _ObjectsL, 15];
  577.  
  578. //// If no objects, exit with
  579. if (count _ObjectsInRange < 1) exitWith {
  580.  
  581. //// BTK_Hint - Nothing to load in range
  582. hint parseText format ["
  583. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  584. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  585. <t align='left' color='#eaeaea' size='1.0'>Nothing to load in range!<br /><br />Please move the object closer to the transporter.</t>
  586. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  587. "];
  588. };
  589.  
  590. //// Else, select the object from list
  591. _Object = _ObjectsInRange select 0;
  592. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", true];
  593. _Transporter setVariable ["BTK_CargoDrop_TransporterLoaded", true];
  594.  
  595.  
  596. //// Get the object name
  597. _ObjectName = getText (configFile >> "CfgVehicles" >> (typeOf _Object) >> "displayName");
  598.  
  599. //// BTK_Hint - Loading in...
  600. hint parseText format ["
  601. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  602. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  603. <t align='left' color='#eaeaea' size='1.0'>Loading <t color='#fdd785'>%1</t> into <t color='#fdd785'>%2</t> ...</t>
  604. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  605. ",_ObjectName,_TransporterName];
  606.  
  607. //// remove the Action
  608. _Transporter removeAction _Action;
  609.  
  610. //// Animate ramp
  611. // sleep 1;
  612. // _Transporter animate ["ramp_top", 1];
  613. // _Transporter animate ["ramp_bottom", 1];
  614.  
  615. //// Attach object to transporter
  616. sleep 3;
  617.  
  618. //// Chinook/Car fix
  619. if (_Object isKindOf "Car" || _Object isKindOf "Truck" || _Object isKindOf "Wheeled_APC") then {
  620.  
  621. if (_Object isKindOf "Car") then {
  622. _Object attachTo [_Transporter,[0,-2,.5]];
  623. };
  624. if (_Object isKindOf "Truck") then {
  625. _Object attachTo [_Transporter,[0,-4,1.2]];
  626. };
  627. if (_Object isKindOf "Wheeled_APC") then {
  628. _Object attachTo [_Transporter,[0,-2,1.2]];
  629. };
  630. }
  631. else {
  632. _Object attachTo [_Transporter,[0,-2,1.2]];
  633. };
  634. _object allowdamage false;
  635. //// Disable R3F
  636. _Object setVariable ["R3F_LOG_disabled", true];
  637.  
  638. //// Animate ramp again
  639. // sleep 1;
  640. // _Transporter animate ["ramp_top", 0];
  641. // _Transporter animate ["ramp_bottom", 0];
  642.  
  643. //// BTK_Hint - Loaded
  644. hint parseText format ["
  645. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  646. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  647. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> loaded.</t>
  648. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  649. ", _ObjectName,_TransporterName];
  650.  
  651. //// add unload/drop Action
  652. _UnloadAction = _Transporter addAction [("<t color=""#fadfbe"">" + ("Release Vehicle") + "</t>"),"BTK\Cargo Drop\Engine.sqf",["UnloadCargo"], 5];
  653.  
  654. //// Wait until unload
  655. waitUntil {UnloadCargo || !(alive _Transporter) || !(alive _Object)};
  656.  
  657.  
  658. //// If destroyed
  659. if (!(alive _Transporter) || !(alive _Object)) exitWith {};
  660.  
  661.  
  662. //// If unload
  663. if (DoUnload) then {
  664.  
  665. //// Reset variables
  666. DoUnload = false;
  667. DoDrop = false;
  668. UnloadCargo = false;
  669. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", false];
  670.  
  671. //// BTK_Hint - Unloading...
  672. hint parseText format ["
  673. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  674. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  675. <t align='left' color='#eaeaea' size='1.0'>Unloading <t color='#fdd785'>%1</t> from <t color='#fdd785'>%2</t> ...</t>
  676. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  677. ",_ObjectName,_TransporterName];
  678.  
  679. //// Animate ramp
  680. // sleep 1;
  681. // _Transporter animate ["ramp_top", 1];
  682. // _Transporter animate ["ramp_bottom", 1];
  683.  
  684. //// Detach object
  685. sleep 3;
  686. _Object attachTo [_Transporter,[0,-8,-1.2]];
  687. sleep 2;
  688. deTach _Object;
  689. sleep 2;
  690. _Object setPos [(getPos _Transporter select 0)+0,-5,-0.2,(getPos _Transporter select 1),1];
  691.  
  692. //// Enable R3F
  693. _Object setVariable ["R3F_LOG_disabled", false];
  694.  
  695. //// Animate ramp again
  696. // sleep 1;
  697. // _Transporter animate ["ramp_top", 0];
  698. // _Transporter animate ["ramp_bottom", 0];
  699. _object allowdamage true;
  700. //// BTK_Hint - Unloaded
  701. hint parseText format ["
  702. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  703. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  704. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> unloaded.</t>
  705. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  706. ",_ObjectName,_TransporterName];
  707. };
  708.  
  709. //// If drop
  710. if (DoDrop) then {
  711.  
  712. //// BTK_Hint - Dropping...
  713. hint parseText format ["
  714. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  715. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  716. <t align='left' color='#eaeaea' size='1.0'>Dropping <t color='#fdd785'>%1</t> ...</t>
  717. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  718. ",_ObjectName,_TransporterName];
  719.  
  720. //// Reset variables
  721. DoUnload = false;
  722. DoDrop = false;
  723. UnloadCargo = false;
  724. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", false];
  725.  
  726. //// Animate ramp
  727. // sleep 1;
  728. // _Transporter animate ["ramp_top", 1];
  729. // _Transporter animate ["ramp_bottom", 1];
  730.  
  731. //// Detach object (drop)
  732. sleep 2;
  733. _Object setVariable ["R3F_LOG_disabled", false];
  734. deTach _Object;
  735. _Object attachTo [_Transporter,[0,-21,0]];
  736. sleep 0.1;
  737. deTach _Object;
  738. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),(getPos _Object select 2)-6];
  739.  
  740. //// Create parachute and smoke
  741. sleep 2;
  742. _Parachute = "ParachuteBigWest" createVehicle position _Object;
  743. _Parachute setPos (getPos _Object);
  744. _BlueSmoke = "SmokeShellBlue" createVehicle position _Object;
  745. _BlueSmoke setPos (getPos _Object);
  746. _Object attachTo [_Parachute,[0,0,-1.5]];
  747.  
  748. //// Animate ramp again
  749. // sleep 1;
  750. // _Transporter animate ["ramp_top", 0];
  751. // _Transporter animate ["ramp_bottom", 0];
  752.  
  753. //// BTK_Hint - Dropped
  754. hint parseText format ["
  755. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  756. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  757. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> dropped.</t>
  758. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  759. ",_ObjectName,_TransporterName];
  760.  
  761. //// Wait until ground reached
  762. waitUntil {(getPos _Object select 2) < 2};
  763. deTach _Object;
  764. sleep 3;
  765. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),0.001];
  766.  
  767. //// Enable R3F
  768. _Object setVariable ["R3F_LOG_disabled", false];
  769.  
  770. //// Delete parachute and smoke
  771. sleep 15;
  772. deleteVehicle _BlueSmoke;
  773. deleteVehicle _Parachute;
  774. };
  775. };
  776.  
  777.  
  778. /******************************************************************************
  779. * Load in - Xtra Large
  780. ******************************************************************************/
  781. if ((_Selected == "LoadCargo") && (_SelectedTransporterTypeXL)) exitWith {
  782.  
  783. //// Get nearest objects
  784. _TransporterPos = _Transporter modelToWorld [0,0,0];
  785. _ObjectsInRange = nearestObjects [_Transporter, _ObjectsXL, 20];
  786.  
  787. //// If no objects, exit with
  788. if (count _ObjectsInRange < 1) exitWith {
  789.  
  790. //// BTK_Hint - Nothing to load in range
  791. hint parseText format ["
  792. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  793. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  794. <t align='left' color='#eaeaea' size='1.0'>Nothing to load in range!<br /><br />Please move the object closer to the transporter.</t>
  795. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  796. "];
  797. };
  798.  
  799. //// Else, select the object from list
  800. _Object = _ObjectsInRange select 0;
  801. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", true];
  802. _Transporter setVariable ["BTK_CargoDrop_TransporterLoaded", true];
  803.  
  804.  
  805. //// Get the object name
  806. _ObjectName = getText (configFile >> "CfgVehicles" >> (typeOf _Object) >> "displayName");
  807.  
  808. //// BTK_Hint - Loading in...
  809. hint parseText format ["
  810. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  811. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  812. <t align='left' color='#eaeaea' size='1.0'>Loading <t color='#fdd785'>%1</t> into <t color='#fdd785'>%2</t> ...</t>
  813. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  814. ",_ObjectName,_TransporterName];
  815.  
  816. //// remove the Action
  817. _Transporter removeAction _Action;
  818.  
  819. //// Animate ramp
  820. // sleep 1;
  821. // _Transporter animate ["ramp_top", 1];
  822. // _Transporter animate ["ramp_bottom", 1];
  823.  
  824. //// Attach object to transporter
  825. sleep 3;
  826.  
  827. //// Fix for cars/apc/trucks
  828. if (_Object isKindOf "Car" || _Object isKindOf "Truck" || _Object isKindOf "Wheeled_APC") then {
  829.  
  830. if (_Object isKindOf "Car") then {
  831. _Object attachTo [_Transporter,[0,1,0]];
  832. };
  833. if (_Object isKindOf "Truck") then {
  834. _Object attachTo [_Transporter,[0,1.4,0]];
  835. };
  836. if (_Object isKindOf "Wheeled_APC") then {
  837. _Object attachTo [_Transporter,[0,2,0]];
  838. };
  839. }
  840. else {
  841. _Object attachTo [_Transporter,[0,1,0]];
  842. };
  843. _object allowdamage false;
  844. //// Disable R3F
  845. _Object setVariable ["R3F_LOG_disabled", true];
  846.  
  847. //// Animate ramp again
  848. // sleep 1;
  849. // _Transporter animate ["ramp_top", 0];
  850. // _Transporter animate ["ramp_bottom", 0];
  851.  
  852. //// BTK_Hint - Loaded
  853. hint parseText format ["
  854. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  855. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  856. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> loaded.</t>
  857. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  858. ", _ObjectName,_TransporterName];
  859.  
  860. //// add unload/drop Action
  861. _UnloadAction = _Transporter addAction [("<t color=""#fadfbe"">" + ("Unload cargo") + "</t>"),"BTK\Cargo Drop\Engine.sqf",["UnloadCargo"], 5];
  862.  
  863. //// Wait until unload
  864. waitUntil {UnloadCargo || !(alive _Transporter) || !(alive _Object)};
  865.  
  866.  
  867. //// If destroyed
  868. if (!(alive _Transporter) || !(alive _Object)) exitWith {};
  869.  
  870.  
  871. //// If unload
  872. if (DoUnload) then {
  873.  
  874. //// Reset variables
  875. DoUnload = false;
  876. DoDrop = false;
  877. UnloadCargo = false;
  878. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", false];
  879.  
  880. //// BTK_Hint - Unloading...
  881. hint parseText format ["
  882. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  883. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  884. <t align='left' color='#eaeaea' size='1.0'>Unloading <t color='#fdd785'>%1</t> from <t color='#fdd785'>%2</t> ...</t>
  885. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  886. ",_ObjectName,_TransporterName];
  887.  
  888. //// Animate ramp
  889. // sleep 1;
  890. // _Transporter animate ["ramp_top", 1];
  891. // _Transporter animate ["ramp_bottom", 1];
  892.  
  893. //// Detach object
  894. sleep 3;
  895. _Object attachTo [_Transporter,[0,0,1]];
  896. sleep 2;
  897. deTach _Object;
  898. sleep 2;
  899. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),0];
  900.  
  901. //// Enable R3F
  902. _Object setVariable ["R3F_LOG_disabled", false];
  903.  
  904. //// Animate ramp again
  905. // sleep 1;
  906. // _Transporter animate ["ramp_top", 0];
  907. // _Transporter animate ["ramp_bottom", 0];
  908. _object allowdamage true;
  909. //// BTK_Hint - Unloaded
  910. hint parseText format ["
  911. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  912. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  913. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> unloaded.</t>
  914. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  915. ",_ObjectName,_TransporterName];
  916. };
  917.  
  918. //// If drop
  919. if (DoDrop) then {
  920.  
  921. //// BTK_Hint - Dropping...
  922. hint parseText format ["
  923. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  924. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  925. <t align='left' color='#eaeaea' size='1.0'>Dropping <t color='#fdd785'>%1</t> ...</t>
  926. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  927. ",_ObjectName,_TransporterName];
  928.  
  929. //// Reset variables
  930. DoUnload = false;
  931. DoDrop = false;
  932. UnloadCargo = false;
  933. _Object setVariable ["BTK_CargoDrop_ObjectLoaded", false];
  934.  
  935. //// Animate ramp
  936. // sleep 1;
  937. // _Transporter animate ["ramp_top", 1];
  938. // _Transporter animate ["ramp_bottom", 1];
  939.  
  940. //// Detach object (drop)
  941. sleep 2;
  942. _Object setVariable ["R3F_LOG_disabled", false];
  943. deTach _Object;
  944. _Object attachTo [_Transporter,[0,-21,0]];
  945. sleep 0.1;
  946. deTach _Object;
  947. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),(getPos _Object select 2)-6];
  948.  
  949. //// Create parachute and smoke
  950. sleep 2;
  951. _Parachute = "ParachuteBigWest" createVehicle position _Object;
  952. _Parachute setPos (getPos _Object);
  953. _BlueSmoke = "SmokeShellBlue" createVehicle position _Object;
  954. _BlueSmoke setPos (getPos _Object);
  955. _Object attachTo [_Parachute,[0,0,-1.5]];
  956.  
  957. //// Animate ramp again
  958. // sleep 1;
  959. // _Transporter animate ["ramp_top", 0];
  960. // _Transporter animate ["ramp_bottom", 0];
  961.  
  962. //// BTK_Hint - Dropped
  963. hint parseText format ["
  964. <t align='left' color='#e5b348' size='1.2'><t shadow='1'shadowColor='#000000'>Cargo Drop</t></t>
  965. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  966. <t align='left' color='#eaeaea' size='1.0'><t color='#fdd785'>%1</t> dropped.</t>
  967. <img color='#ffffff' image='BTK\Cargo Drop\Images\img_line_ca.paa' align='left' size='0.79' />
  968. ",_ObjectName,_TransporterName];
  969.  
  970. //// Wait until ground reached
  971. waitUntil {(getPos _Object select 2) < 2};
  972. deTach _Object;
  973. sleep 3;
  974. _Object setPos [(getPos _Object select 0),(getPos _Object select 1),0.001];
  975.  
  976. //// Enable R3F
  977. _Object setVariable ["R3F_LOG_disabled", false];
  978.  
  979. //// Delete parachute and smoke
  980. sleep 15;
  981. deleteVehicle _BlueSmoke;
  982. deleteVehicle _Parachute;
  983. };
  984. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement