IgiLoad.sqf 136 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890
  1. //////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // IgiLoad v0.9.10_RC_e_(Arma3_1.32) //
  3. // Version info: This is not official version of IgiLoad it is only WIP (RC) //
  4. // Author: Igi_PL //
  5. // Web: http://www.igipl.net/ //
  6. // Version date: 2014.10.16 //
  7. // //
  8. // USE: //
  9. // 1. In mission "init.sqf" add line: "0 = execVM "IgiLoad\IgiLoadInit.sqf";". //
  10. // 2. In vehicles "INITIALIZATION" field type: "0 = [this] execVM "IgiLoad\IgiLoad.sqf";" //
  11. // 3. Unload from script or trigger: //
  12. // a) Unloading cargo from script. Force unload: "0 = [Car, true, "L"] spawn IL_Do_Unload;" //
  13. // b) Unloading cargo from script. Force unload: "0 = [Car, true] spawn IL_Do_Unload;" //
  14. // c) Unloading cargo from script. Force unload: "0 = [Car] spawn IL_Do_Unload;" //
  15. // 4. Loading cargo from script. Force load: "0 = [Car, [typeOf Box], "B", true, Box] spawn IL_Do_Load;" //
  16. // //
  17. // Ways from points 1 and 2 can not be used simultaneously!!! //
  18. //////////////////////////////////////////////////////////////////////////////////////////////////////////////
  19. //if true then show debug globalChat (TODO add more hints)
  20. IL_DevMod = false;
  21. //waitUntil { !(isNull player) };
  22. waitUntil { time > 0 };
  23. IL_Script_Inst = time;
  24. if (IL_DevMod) then
  25. {
  26. Player globalChat Format["IgiLoad ""%1"" IN.", IL_Script_Inst];
  27. };
  28. //if (isDedicated) exitwith {};
  29. //if (isServer) exitwith {};
  30. // VARIABLES
  31. _obj_main = _this select 0;
  32. _obj_main_type = (typeOf _obj_main);
  33. if (isnil "IL_Variables") then
  34. {
  35. IL_Variables = true;
  36. //Check new vehicles time
  37. IL_Check_Veh_Min = 30;
  38. IL_Check_Veh_Max = 60;
  39. //Dealing with cargo damage
  40. //-1 - do nothing
  41. //0 - set to 0
  42. //1 - keep such as before loading/unloading
  43. IL_CDamage = 0;
  44. //AddAction menu position
  45. IL_Action_LU_Priority = 30; //Load and (para)unload
  46. IL_Action_O_Priority = 0; //Open and close
  47. IL_Action_S_Priority = 0; //Setup
  48. //Maximum capacity for vehicles
  49. IL_Num_Slots_OFFROAD = -2;
  50. IL_Num_Slots_VAN = -3;
  51. IL_Num_Slots_MOHAWK = -7;
  52. IL_num_Slots_CHINOOK = -8;
  53. IL_Num_Slots_KAMAZ = -4;
  54. IL_Num_Slots_TEMPEST = -5;
  55. IL_Num_Slots_HEMTT = -6;
  56. IL_Num_Slots_MH9 = -1;
  57. IL_Num_Slots_C130J = -12;
  58. IL_Num_Slots_C17 = -22;
  59. //Player addScore after loading and unloading
  60. IL_Load_Score = 20;
  61. //Para unload score = 2 * IL_Unload_Score
  62. IL_Unload_Score = 10;
  63. //The minimum altitude for the drop with parachute
  64. IL_Para_Drop_ATL = 50;
  65. IL_Para_Jump_ATL = 30;
  66. //The minimum altitude for parachute opening
  67. IL_Para_Drop_Open_ATL = 150;
  68. IL_Para_Jump_Open_ATL = 150;
  69. //Parachute get velocity from player or cargo
  70. IL_Para_Drop_Velocity = true;
  71. IL_Para_Jump_Velocity = true;
  72. //Set smoke and light for parachute drop.
  73. IL_Para_Smoke = true;
  74. IL_Para_Light = true;
  75. //Additional smoke after landing
  76. IL_Para_Smoke_Add = true;
  77. //Additional light after landing
  78. IL_Para_Light_Add = true;
  79. //Smoke and light color
  80. IL_Para_Smoke_Default = "SmokeshellGreen";
  81. IL_Para_Light_Default = "Chemlight_green";
  82. IL_Para_Smoke_Veh = "SmokeshellBlue";
  83. IL_Para_Light_Veh = "Chemlight_blue";
  84. //This allows for loading or unloading, if a player is in the area of loading or copilot
  85. IL_Can_Inside = true;
  86. IL_Can_CoPilot = true;
  87. IL_Can_Outside = true;
  88. //
  89. //IL_SDistU = 20;//No longer needed
  90. IL_SDistL = 2.5;
  91. IL_SDistL_Heli_offset = 1;
  92. //Load and unload (not para) max speed in km/h
  93. IL_LU_Speed = 10;
  94. //Load and unload (not para) max height in m
  95. IL_LU_Alt = 3;
  96. //Enable or disable usable cargo ramp in CH-49
  97. IL_Ramp = true;
  98. //Enable change of vehicle mass
  99. IL_Mass = true;
  100. // Supported vehicles
  101. IL_Supported_Vehicles_OFFROAD = ["C_Offroad_01_F", "B_G_Offroad_01_F", "B_mas_mar_Offroad_01_F"];
  102. IL_Supported_Vehicles_VAN = ["C_Van_01_box_F", "B_G_Van_01_transport_F", "C_Van_01_transport_F"];
  103. IL_Supported_Vehicles_HEMTT = ["B_Truck_01_covered_F", "B_Truck_01_transport_F", "B_Truck_01_box_F", "Marinir_Truck_01_box_FG", "Marinir_Truck_01_transport_FG", "Marinir_Truck_01_covered_FG", "B_mas_mar_Truck_01_covered_F", "B_mas_mar_Truck_01_transport_F"];
  104. IL_Supported_Vehicles_KAMAZ = ["I_Truck_02_transport_F", "O_Truck_02_transport_F", "I_Truck_02_covered_F", "O_Truck_02_covered_F", "caf_HLVW_open_AR", "caf_HLVW_open", "caf_HLVW_covered_ar", "caf_HLVW_covered"];
  105. IL_Supported_Vehicles_TEMPEST = ["O_Truck_03_transport_F", "O_Truck_03_covered_F"];
  106. IL_Supported_Vehicles_MOHAWK = ["I_Heli_Transport_02_F", "CH49_Mohawk_FG", "Marinir_CH49_Mohawk_FG"];
  107. IL_Supported_Vehicles_CHINOOK = ["CH_147F", "CH_47F", "kyo_MH47E_HC", "kyo_MH47E_Ramp", "kyo_MH47E_base"];
  108. IL_Supported_Vehicles_MH9 = ["B_Heli_Light_01_F", "B_mas_mar_Heli_Light_01_F"];
  109. IL_Supported_Vehicles_C130J = ["C130J_Cargo", "C130J"];
  110. IL_Supported_Vehicles_C17 = ["globemaster_c17_altus", "globemaster_c17_701", "globemaster_c17_703", "globemaster_c17_704", "globemaster_c17_705", "globemaster_c17_dover", "globemaster_c17_edwards", "globemaster_c17_Elmendorf", "globemaster_c17", "globemaster_c17_hickam", "globemaster_c17_IAF", "globemaster_c17_March", "globemaster_c17_mcchord", "globemaster_c17_McGuire", "globemaster_c17_Mississipi", "globemaster_c17_NATO", "globemaster_c17_natoPAPA", "globemaster_c17_Qatar", "globemaster_c17_RAAF", "globemaster_c17_ZZ172_RAF", "globemaster_c17_RCAF", "globemaster_c17_Stewart", "globemaster_c17_therock", "globemaster_c17_travis", "globemaster_c17_UAE", "globemaster_c17_wright_patt"];
  111. IL_Supported_Vehicles_All = IL_Supported_Vehicles_C130J + IL_Supported_Vehicles_C17 + IL_Supported_Vehicles_MH9 + IL_Supported_Vehicles_MOHAWK + IL_Supported_Vehicles_KAMAZ + IL_Supported_Vehicles_TEMPEST + IL_Supported_Vehicles_HEMTT + IL_Supported_Vehicles_VAN + IL_Supported_Vehicles_OFFROAD + IL_Supported_Vehicles_CHINOOK;
  112. // Vehicles with the ability to dropping the load on the parachute
  113. IL_Para_Drop_Vehicles = IL_Supported_Vehicles_MH9 + IL_Supported_Vehicles_MOHAWK + IL_Supported_Vehicles_C130J + IL_Supported_Vehicles_C17 + IL_Supported_Vehicles_CHINOOK;
  114. //Supported cargo
  115. IL_Supported_HEMTT = ["B_Truck_01_covered_F", "B_Truck_01_transport_F", "B_Truck_01_box_F", "Marinir_Truck_01_box_FG", "Marinir_Truck_01_transport_FG", "Marinir_Truck_01_covered_FG", "B_mas_mar_Truck_01_covered_F", "B_mas_mar_Truck_01_transport_F", "B_Truck_01_mover_F", "B_Truck_01_ammo_F", "B_Truck_01_fuel_F", "B_Truck_01_medical_F", "B_Truck_01_Repair_F"];
  116. IL_Supported_KAMAZ = ["I_Truck_02_transport_F", "O_Truck_02_transport_F", "I_Truck_02_covered_F", "O_Truck_02_covered_F", "caf_HLVW_open_AR", "caf_HLVW_open", "caf_HLVW_covered_ar", "caf_HLVW_covered"];
  117. IL_Supported_TEMPEST = ["O_Truck_03_transport_F", "O_Truck_03_covered_F"];
  118. IL_Supported_Strider = ["I_MRAP_03_F", "I_MRAP_03_gmg_F", "I_MRAP_03_hmg_F", "CAF_TAPV_ar", "caf_tapv_gl_ar", "caf_tapv_50_ar", "CAF_TAPV_tw", "caf_tapv_gl_tw", "caf_tapv_50_tw", "Night_B_MRAP_03_F", "Night_B_MRAP_03_gmg_F", "Night_B_MRAP_03_hmg_F"];
  119. IL_Supported_Hunter = ["B_MRAP_01_F", "B_MRAP_01_gmg_F", "B_MRAP_01_hmg_F", "Marinir_B_MRAP_01_FG" , "Marinir_MRAP_01_gmg_FG", "Marinir_MRAP_01_hmg_FG", "B_mas_mar_MRAP_01_med_F", "B_mas_mar_MRAP_01_F", "B_mas_mar_MRAP_01_gmg_F", "B_mas_mar_MRAP_01_hmg_F"];
  120. IL_Supported_Ifrit = ["O_MRAP_02_F", "O_MRAP_02_gmg_F", "O_MRAP_02_hmg_F"];
  121. IL_Supported_UGV = ["B_UGV_01_rcws_F", "B_UGV_01_F", "O_UGV_01_rcws_F", "O_UGV_01_F", "I_UGV_01_rcws_F", "I_UGV_01_F"];
  122. IL_Supported_VAN = ["C_Van_01_box_F", "B_G_Van_01_transport_F", "C_Van_01_transport_F"];
  123. IL_Supported_OFFROAD = ["C_Offroad_01_F", "B_G_Offroad_01_F", "B_G_Offroad_01_armed_F", "JTF2_Offroad_armed_01", "B_mas_mar_Offroad_01_F", "B_mas_mar_Offroad_01_armed_F"];
  124. IL_Supported_SUV = ["C_SUV_01_F"];
  125. IL_Supported_Hatchback = ["C_Hatchback_01_F", "C_Hatchback_01_sport_F"];
  126. IL_Supported_Hummvee = ["rc_hmmwv", "HMMWV2", "HMMWV_M1035", "M1114_AGS_ACR", "HMMWV_M1151_M2", "HMMWV2_M2", "HMMWV2_MK19", "HMMWV2_TOW", "HMMWV", "HMMWV_M2", "HMMWV_MK19", "HMMWV_TOW"];
  127. IL_Supported_Quadbike = ["I_Quadbike_01_F", "C_Quadbike_01_F", "O_Quadbike_01_F", "B_G_Quadbike_01_F", "B_Quadbike_01_F", "CAF_Quadbike_OD", "CAF_Quadbike_AR", "Marinir_Quadbike_01_FG", "B_mas_mar_Quadbike_01_F"];
  128. IL_Supported_Supply_Crate = ["B_supplyCrate_F", "IG_supplyCrate_F", "O_supplyCrate_F", "I_supplyCrate_F", "C_supplyCrate_F"];
  129. IL_Supported_Veh_Ammo = ["Box_NATO_AmmoVeh_F", "Box_East_AmmoVeh_F", "Box_IND_AmmoVeh_F", "Land_CargoBox_V1_F", "ASC_B_box"];
  130. IL_Supported_Barrel = ["Land_BarrelEmpty_F", "Land_BarrelEmpty_grey_F", "Land_BarrelSand_F", "Land_BarrelSand_grey_F", "Land_BarrelTrash_F", "Land_BarrelTrash_grey_F", "Land_BarrelWater_F", "Land_BarrelWater_grey_F", "Land_MetalBarrel_F"];//, "Land_MetalBarrel_empty_F", "MetalBarrel_burning_F"];
  131. IL_Supported_Tank = ["Land_WaterBarrel_F", "Land_WaterTank_F"];
  132. IL_Supported_Rubberboat = ["I_Boat_Transport_01_F", "O_Boat_Transport_01_F", "B_G_Boat_Transport_01_F", "B_Boat_Transport_01_F", "C_Rubberboat", "O_Lifeboat", "B_Lifeboat", "Marinir_duck_base_F", "B_mas_mar_Boat_Transport_01_F"];
  133. IL_Supported_SDV = ["I_SDV_01_F", "O_SDV_01_F", "B_SDV_01_F", "B_mas_mar_SDV_01_F"];
  134. IL_Supported_Box_H1 = ["Box_NATO_Wps_F", "Box_East_Wps_F", "Box_IND_Wps_F", "Box_East_WpsLaunch_F", "Box_NATO_WpsLaunch_F", "Box_IND_WpsLaunch_F", "Box_IND_WpsSpecial_F", "Box_East_WpsSpecial_F", "Box_NATO_WpsSpecial_F", "Box_mas_all_rifle_Wps_F", "Box_mas_us_rifle_Wps_F", "Box_mas_ru_rifle_Wps_F", "Box_mas_mar_NATO_equip_F", "Box_mas_mar_NATO_Wps_F"];
  135. IL_Supported_Box_H2 = ["Box_NATO_AmmoOrd_F", "Box_East_AmmoOrd_F", "Box_IND_AmmoOrd_F", "Box_NATO_Grenades_F", "Box_East_Grenades_F", "Box_IND_Grenades_F", "Box_NATO_Ammo_F", "Box_East_Ammo_F", "Box_IND_Ammo_F", "Box_IND_Support_F", "Box_East_Support_F", "Box_NATO_Support_F"];
  136. IL_Supported_Cargo20 = ["Land_Cargo20_blue_F", "Land_Cargo20_brick_red_F", "Land_Cargo20_cyan_F", "Land_Cargo20_grey_F", "Land_Cargo20_light_blue_F", "Land_Cargo20_light_green_F", "Land_Cargo20_military_green_F", "Land_Cargo20_orange_F", "Land_Cargo20_red_F", "Land_Cargo20_sand_F", "Land_Cargo20_white_F", "Land_Cargo20_yellow_F"];
  137. //TODO
  138. //IL_Supported_Backpack = ["B_AssaultPack_blk", "B_AssaultPack_cbr", "B_AssaultPack_dgtl", "B_AssaultPack_khk", "B_AssaultPack_mcamo", "B_AssaultPack_ocamo", "B_AssaultPack_rgr", "B_AssaultPack_sgg", "B_AssaultPackG", "B_Bergen_blk", "B_Bergen_mcamo", "B_Bergen_rgr", "B_Bergen_sgg", "B_BergenC_blu", "B_BergenC_grn", "B_BergenC_red", "B_BergenG", "B_Carryall_cbr", "B_Carryall_khk", "B_Carryall_mcamo", "B_Carryall_ocamo", "B_Carryall_oli", "B_Carryall_oucamo", "B_FieldPack_blk", "B_FieldPack_cbr", "B_FieldPack_khk", "B_FieldPack_ocamo", "B_FieldPack_oli", "B_FieldPack_oucamo", "B_HuntingBackpack", "B_Kitbag_cbr", "B_Kitbag_mcamo", "B_Kitbag_sgg", "B_OutdoorPack_blk", "B_OutdoorPack_blu", "B_OutdoorPack_tan", "B_TacticalPack_blk", "B_TacticalPack_mcamo", "B_TacticalPack_ocamo", "B_TacticalPack_oli", "B_TacticalPack_rgr", "C_Bergen_blu", "C_Bergen_grn", "C_Bergen_red", "G_AssaultPack", "G_Bergen"];
  139. //IL_Supported_Backpack_Support = ["B_HMG_01_support_F", "B_HMG_01_support_high_F", "B_Mortar_01_support_F", "I_Mortar_01_support_F", "O_Mortar_01_support_F"];
  140. //IL_Supported_Backpack_Weapon = ["B_AA_01_weapon_F", "B_AT_01_weapon_F", "B_GMG_01_A_high_weapon_F", "B_GMG_01_A_weapon_F", "B_GMG_01_A_weapon_F", "B_GMG_01_high_weapon_F", "B_GMG_01_weapon_F", "B_HMG_01_A_high_weapon_F", "B_HMG_01_A_weapon_F", "B_HMG_01_high_weapon_F", "B_HMG_01_weapon_F", "B_Mortar_01_weapon_F"];
  141. //IL_Supported_Backpack_Uav = ["B_UAV_01_backpack_F", "I_UAV_01_backpack_F", "O_UAV_01_backpack_F"];
  142. //IL_Supported_Parachute = ["B_Parachute"];
  143. //IL_Supported_Backpack_All = IL_Supported_Backpack + IL_Supported_Backpack_Support + IL_Supported_Backpack_Weapon + IL_Supported_Backpack_Uav + IL_Supported_Parachute;
  144. IL_Supported_Cargo_MH9 = IL_Supported_Supply_Crate + IL_Supported_Barrel; // + IL_Supported_Box_H1 + IL_Supported_Box_H2;// + IL_Supported_Backpack_All;
  145. IL_Supported_Cargo_Veh_Offroad = IL_Supported_Quadbike;
  146. IL_Supported_Cargo_NonVeh_Offroad = (IL_Supported_Supply_Crate + IL_Supported_Veh_Ammo + IL_Supported_Barrel + IL_Supported_Tank + IL_Supported_Box_H1 + IL_Supported_Box_H2);// - ["Land_WaterTank_F"];
  147. IL_Supported_Cargo_Offroad = IL_Supported_Cargo_Veh_Offroad + IL_Supported_Cargo_NonVeh_Offroad;
  148. IL_Supported_Cargo_Veh_VAN = IL_Supported_Cargo_Veh_Offroad;
  149. IL_Supported_Cargo_NonVeh_VAN = IL_Supported_Cargo_NonVeh_Offroad;
  150. IL_Supported_Cargo_VAN = IL_Supported_Cargo_Veh_VAN + IL_Supported_Cargo_NonVeh_VAN;
  151. IL_Supported_Cargo_Veh_Kamaz = IL_Supported_Quadbike + IL_Supported_Rubberboat + IL_Supported_SDV + IL_Supported_Hatchback + IL_Supported_UGV + IL_Supported_VAN;
  152. IL_Supported_Cargo_NonVeh_Kamaz = IL_Supported_Supply_Crate + IL_Supported_Veh_Ammo + IL_Supported_Barrel + IL_Supported_Tank + IL_Supported_Box_H1 + IL_Supported_Box_H2 + IL_Supported_Cargo20;
  153. IL_Supported_Cargo_Kamaz = IL_Supported_Cargo_Veh_Kamaz + IL_Supported_Cargo_NonVeh_Kamaz;
  154. IL_Supported_Cargo_Veh_HEMTT = IL_Supported_Cargo_Veh_Kamaz + IL_Supported_OFFROAD + IL_Supported_SUV;
  155. IL_Supported_Cargo_NonVeh_HEMTT = IL_Supported_Cargo_NonVeh_Kamaz;
  156. IL_Supported_Cargo_HEMTT = IL_Supported_Cargo_Veh_HEMTT + IL_Supported_Cargo_NonVeh_HEMTT;
  157. IL_Supported_Cargo_Veh_TEMPEST = IL_Supported_Cargo_Veh_HEMTT;
  158. IL_Supported_Cargo_NonVeh_TEMPEST = IL_Supported_Cargo_NonVeh_HEMTT;
  159. IL_Supported_Cargo_TEMPEST = IL_Supported_Cargo_Veh_TEMPEST + IL_Supported_Cargo_NonVeh_TEMPEST;
  160. IL_Supported_Cargo_Veh_Mohawk = IL_Supported_Quadbike + IL_Supported_Rubberboat + IL_Supported_SDV + IL_Supported_Hatchback + IL_Supported_UGV;
  161. IL_Supported_Cargo_NonVeh_Mohawk = IL_Supported_Supply_Crate + IL_Supported_Veh_Ammo + IL_Supported_Barrel + IL_Supported_Tank;
  162. IL_Supported_Cargo_Mohawk = IL_Supported_Cargo_Veh_Mohawk + IL_Supported_Cargo_NonVeh_Mohawk;
  163. IL_Supported_Cargo_Veh_CHINOOK = IL_Supported_Cargo_Veh_Mohawk;
  164. IL_Supported_Cargo_NonVeh_CHINOOK = IL_Supported_Cargo_NonVeh_Mohawk;
  165. IL_Supported_Cargo_CHINOOK = IL_Supported_Cargo_Veh_CHINOOK + IL_Supported_Cargo_NonVeh_CHINOOK;
  166. IL_Supported_Cargo_Veh_C130J = IL_Supported_Cargo_Veh_HEMTT + IL_Supported_Strider + IL_Supported_Hunter + IL_Supported_Ifrit + IL_Supported_Hummvee + IL_Supported_HEMTT;
  167. IL_Supported_Cargo_NonVeh_C130J = IL_Supported_Cargo_NonVeh_Mohawk;// Damage the plane + IL_Supported_Cargo20;
  168. IL_Supported_Cargo_C130J = IL_Supported_Cargo_Veh_C130J + IL_Supported_Cargo_NonVeh_C130J;
  169. IL_Supported_Cargo_Veh_C17 = IL_Supported_Cargo_Veh_C130J;
  170. IL_Supported_Cargo_NonVeh_C17 = IL_Supported_Cargo_NonVeh_C130J;
  171. IL_Supported_Cargo_C17 = IL_Supported_Cargo_Veh_C17 + IL_Supported_Cargo_NonVeh_C17;
  172. };
  173. // END VARIABLES
  174. //Check if vehicle is supported or it is PLayer init
  175. // if !((_obj_main_type in (IL_Supported_Vehicles_All)) || (_obj_main == Player) || (isServer) || (isDedicated)) exitwith
  176. // {
  177. // if (IL_DevMod) then
  178. // {
  179. // Player globalChat Format["IgiLoad. Object: ""%1"" is not supported.", _obj_main];
  180. // };
  181. // };
  182. // PROCEDURES AND FUNCTIONS
  183. if (isnil "IL_Procedures") then
  184. {
  185. IL_Procedures = true;
  186. IL_Init_Veh =
  187. {
  188. if (IL_DevMod) then
  189. {
  190. Player globalChat Format["IgiLoad ""%1"" IL_Init_Veh.", IL_Script_Inst];
  191. };
  192. private["_obj", "_obj_type", "_force"];
  193. _obj = _this select 0;
  194. _force = if (count _this > 1) then {_this select 1} else {false};
  195. _obj_type = (typeOf _obj);
  196. if ((isNil {_obj getVariable "default_mass"}) || (_force)) then
  197. {
  198. if (isNil {_obj getVariable "default_mass"}) then
  199. {
  200. _obj setVariable["default_mass", getMass _obj, true];
  201. }
  202. else
  203. {
  204. _obj setMass (_obj getVariable "default_mass");
  205. };
  206. };
  207. if (_obj_type in IL_Supported_Vehicles_C130J) then
  208. {
  209. if ((isNil {_obj getVariable "box_num"}) || (_force)) then {_obj setVariable["box_num", 0, true];};
  210. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  211. if ((isNil {_obj getVariable "can_copilot"}) || (_force)) then {_obj setVariable["can_copilot", IL_Can_CoPilot, true];};
  212. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  213. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -4.57, true];};
  214. if ((isNil {_obj getVariable "usable_ramp"}) || (_force)) then {_obj setVariable["usable_ramp", IL_Ramp, true];};
  215. if (_obj_type == "C130J_Cargo") then
  216. {
  217. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_C130J, true];};
  218. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 8.5, true];};
  219. }
  220. else
  221. {
  222. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", (IL_Num_Slots_C130J / 2) - 1, true];};
  223. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 13.5, true];};
  224. };
  225. };
  226. if (_obj_type in IL_Supported_Vehicles_C17) then
  227. {
  228. if ((isNil {_obj getVariable "box_num"}) || (_force)) then {_obj setVariable["box_num", 0, true];};
  229. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_C17, true];};
  230. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  231. if ((isNil {_obj getVariable "can_copilot"}) || (_force)) then {_obj setVariable["can_copilot", IL_Can_CoPilot, true];};
  232. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  233. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -1.25, true];};
  234. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 16, true];};//4.5, true];};
  235. if ((isNil {_obj getVariable "usable_ramp"}) || (_force)) then {_obj setVariable["usable_ramp", IL_Ramp, true];};
  236. };
  237. if (_obj_type in IL_Supported_Vehicles_MOHAWK) then
  238. {
  239. if ((isNil {_obj getVariable "box_num"}) || (_force)) then {_obj setVariable["box_num", 0, true];};
  240. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_MOHAWK, true];};
  241. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  242. if ((isNil {_obj getVariable "can_copilot"}) || (_force)) then {_obj setVariable["can_copilot", IL_Can_CoPilot, true];};
  243. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  244. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -2.25, true];};
  245. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 4.5, true];};
  246. if ((isNil {_obj getVariable "usable_ramp"}) || (_force)) then {_obj setVariable["usable_ramp", IL_Ramp, true];};
  247. };
  248. if (_obj_type in IL_Supported_Vehicles_CHINOOK) then
  249. {
  250. if ((isNil {_obj getVariable "box_num"}) || (_force)) then {_obj setVariable["box_num", 0, true];};
  251. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  252. if ((isNil {_obj getVariable "can_copilot"}) || (_force)) then {_obj setVariable["can_copilot", IL_Can_CoPilot, true];};
  253. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  254. if (_obj_type == "CH_47F") then
  255. {
  256. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_CHINOOK - 2, true];};
  257. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -3.1, true];};
  258. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 4.5, true];};
  259. };
  260. if (_obj_type == "CH_147F") then
  261. {
  262. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_CHINOOK, true];};
  263. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -2.55, true];};
  264. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 5.25, true];};
  265. };
  266. if (_obj_type in ["kyo_MH47E_HC", "kyo_MH47E_Ramp", "kyo_MH47E_base"]) then
  267. {
  268. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_CHINOOK, true];};
  269. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -1.5, true];};
  270. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 6, true];};
  271. };
  272. if ((isNil {_obj getVariable "usable_ramp"}) || (_force)) then {_obj setVariable["usable_ramp", IL_Ramp, true];};
  273. };
  274. if (_obj_type in IL_Supported_Vehicles_MH9) then
  275. {
  276. if ((isNil {_obj getVariable "box_l"}) || (_force)) then {_obj setVariable["box_l", _obj, true];};
  277. if ((isNil {_obj getVariable "box_r"}) || (_force)) then {_obj setVariable["box_r", _obj, true];};
  278. if ((isNil {_obj getVariable "box_num_l"}) || (_force)) then {_obj setVariable["box_num_l", 0, true];};
  279. if ((isNil {_obj getVariable "box_num_r"}) || (_force)) then {_obj setVariable["box_num_r", 0, true];};
  280. if ((isNil {_obj getVariable "slots_num_l"}) || (_force)) then {_obj setVariable["slots_num_l", IL_Num_Slots_MH9, true];};
  281. if ((isNil {_obj getVariable "slots_num_r"}) || (_force)) then {_obj setVariable["slots_num_r", IL_Num_Slots_MH9, true];};
  282. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  283. if ((isNil {_obj getVariable "can_copilot"}) || (_force)) then {_obj setVariable["can_copilot", IL_Can_CoPilot, true];};
  284. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  285. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -0.48, true];};
  286. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 1, true];};
  287. if ((isNil {_obj getVariable "usable_ramp"}) || (_force)) then {_obj setVariable["usable_ramp", IL_Ramp, true];};
  288. };
  289. if (_obj_type in IL_Supported_Vehicles_OFFROAD) then
  290. {
  291. if ((isNil {_obj getVariable "box_num"}) || (_force)) then {_obj setVariable["box_num", 0, true];};
  292. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_OFFROAD, true];};
  293. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  294. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  295. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -0.65, true];};
  296. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 1.5, true];};
  297. };
  298. if (_obj_type in IL_Supported_Vehicles_VAN) then
  299. {
  300. if ((isNil {_obj getVariable "box_num"}) || (_force)) then {_obj setVariable["box_num", 0, true];};
  301. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_VAN, true];};
  302. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  303. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  304. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -0.6, true];};
  305. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 1, true];};
  306. };
  307. if (_obj_type in IL_Supported_Vehicles_KAMAZ) then
  308. {
  309. if ((isNil {_obj getVariable "box_num"}) || (_force)) then {_obj setVariable["box_num", 0, true];};
  310. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_KAMAZ, true];};
  311. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  312. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  313. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -0.8, true];};
  314. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", -0.5, true];};
  315. };
  316. if (_obj_type in IL_Supported_Vehicles_TEMPEST) then
  317. {
  318. if ((isNil {_obj getVariable "box_num"}) || (_force)) then {_obj setVariable["box_num", 0, true];};
  319. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_TEMPEST, true];};
  320. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  321. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  322. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -0.4, true];};
  323. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 0.5, true];};
  324. };
  325. if (_obj_type in IL_Supported_Vehicles_HEMTT) then
  326. {
  327. if ((isNil {_obj getVariable "box_num"}) || (_force)) then {_obj setVariable["box_num", 0, true];};
  328. if ((isNil {_obj getVariable "slots_num"}) || (_force)) then {_obj setVariable["slots_num", IL_Num_Slots_HEMTT, true];};
  329. if ((isNil {_obj getVariable "can_load"}) || (_force)) then {_obj setVariable["can_load", true, true];};
  330. if ((isNil {_obj getVariable "can_outside"}) || (_force)) then {_obj setVariable["can_outside", IL_Can_Outside, true];};
  331. if (_obj_type in ["B_Truck_01_box_F", "Marinir_Truck_01_box_FG"]) then
  332. {
  333. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -0.4, true];};
  334. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 0.8, true];};
  335. }
  336. else
  337. {
  338. if ((isNil {_obj getVariable "zload"}) || (_force)) then {_obj setVariable["zload", -0.5, true];};
  339. if ((isNil {_obj getVariable "load_offset"}) || (_force)) then {_obj setVariable["load_offset", 0, true];};
  340. };
  341. };
  342. };
  343. // END IL_Init_Veh
  344. IL_Init_Box =
  345. {
  346. if (IL_DevMod) then
  347. {
  348. Player globalChat Format["IgiLoad ""%1"" IL_Init_Box.", IL_Script_Inst];
  349. };
  350. private["_obj", "_obj_type", "_bbr", "_p0", "_p1"];
  351. _obj = _this select 0;
  352. _obj setVariable["attachedPos", 0, true];
  353. _obj setVariable["attachedTruck", _obj, true];
  354. _obj setVariable["doors", "N", true];
  355. _obj setVariable["slots", 1, true];
  356. _obj setVariable["cargo_offset", 0, true];
  357. _bbr = boundingBoxReal _obj;
  358. _p0 = _bbr select 0;
  359. _p1 = _bbr select 1;
  360. _obj setVariable["zload_cargo", abs (_p0 select 2), true];
  361. _obj_type = (typeOf _obj);
  362. if (_obj_type in IL_Supported_Cargo20) then
  363. {
  364. _obj setVariable["slots", 6, true];
  365. _obj setVariable["cargo_offset", 2.6, true];//HEMETT Box ~2.09281
  366. //LOCAL
  367. //_obj setMass 2400;
  368. [_obj, 2400] call IL_SetNewMass;
  369. };
  370. if (_obj_type in IL_Supported_HEMTT) then
  371. {
  372. _obj setVariable["slots", 10, true];
  373. _obj setVariable["cargo_offset", 4.2, true];
  374. };
  375. if (_obj_type in IL_Supported_Hummvee) then
  376. {
  377. if (_obj_type in ["M1114_AGS_ACR", "HMMWV_M1151_M2"]) then
  378. {
  379. _obj setVariable["slots", 6, true];
  380. _obj setVariable["cargo_offset", 2.2, true];
  381. }
  382. else
  383. {
  384. _obj setVariable["slots", 5, true];
  385. if (_obj_type in ["HMMWV_M1035"]) then
  386. {
  387. _obj setVariable["cargo_offset", 1.9, true];
  388. }
  389. else
  390. {
  391. if (_obj_type in ["rc_hmmwv"]) then
  392. {
  393. _obj setVariable["cargo_offset", 2, true];
  394. }
  395. else
  396. {
  397. _obj setVariable["cargo_offset", 1.9, true];
  398. };
  399. };
  400. };
  401. };
  402. if (_obj_type in IL_Supported_Strider) then
  403. {
  404. _obj setVariable["slots", 6, true];
  405. _obj setVariable["cargo_offset", 2.2, true];
  406. };
  407. if (_obj_type in IL_Supported_Hunter) then
  408. {
  409. _obj setVariable["slots", 7, true];
  410. _obj setVariable["cargo_offset", 1.5, true];
  411. };
  412. if (_obj_type in IL_Supported_Ifrit) then
  413. {
  414. _obj setVariable["slots", 7, true];
  415. _obj setVariable["cargo_offset", 1.3, true];
  416. };
  417. if (_obj_type in IL_Supported_VAN) then
  418. {
  419. _obj setVariable["slots", 6, true];
  420. _obj setVariable["cargo_offset", 1.8, true];
  421. };
  422. if (_obj_type in IL_Supported_UGV) then
  423. {
  424. _obj setVariable["slots", 5, true];
  425. _obj setVariable["cargo_offset", 2.1, true];
  426. };
  427. if (_obj_type in IL_Supported_Hatchback) then
  428. {
  429. _obj setVariable["slots", 5, true];
  430. _obj setVariable["cargo_offset", 1.9, true];
  431. };
  432. if (_obj_type in IL_Supported_SUV) then
  433. {
  434. _obj setVariable["slots", 6, true];
  435. _obj setVariable["cargo_offset", 2, true];
  436. };
  437. if (_obj_type in IL_Supported_OFFROAD) then
  438. {
  439. _obj setVariable["slots", 6, true];
  440. _obj setVariable["cargo_offset", 2.4, true];
  441. };
  442. if (_obj_type in IL_Supported_Rubberboat) then
  443. {
  444. _obj setVariable["slots", 5, true];
  445. _obj setVariable["cargo_offset", 2, true];
  446. };
  447. if (_obj_type in IL_Supported_SDV) then
  448. {
  449. _obj setVariable["slots", 6, true];
  450. _obj setVariable["cargo_offset", 1.6, true];
  451. };
  452. if (_obj_type in IL_Supported_Quadbike) then
  453. {
  454. _obj setVariable["slots", 2, true];
  455. _obj setVariable["cargo_offset", 0.5, true];
  456. };
  457. if (_obj_type in IL_Supported_Veh_Ammo) then
  458. {
  459. _obj setVariable["slots", 2, true];
  460. _obj setVariable["cargo_offset", 0.4, true];
  461. };
  462. if (_obj_type in IL_Supported_Tank) then
  463. {
  464. if (_obj_type == "Land_WaterTank_F") then
  465. {
  466. _obj setVariable["slots", 3, true];
  467. _obj setVariable["cargo_offset", 1, true];
  468. }
  469. else
  470. {
  471. _obj setVariable["slots", 2, true];
  472. _obj setVariable["cargo_offset", 0.4, true];
  473. };
  474. _turn = true;
  475. };
  476. };
  477. // END IL_Init_Box
  478. IL_Server_AddScore =
  479. {
  480. if (IL_DevMod) then
  481. {
  482. Player globalChat Format["IgiLoad ""%1"" IL_Server_AddScore.", IL_Script_Inst];
  483. };
  484. if (isServer) then
  485. {
  486. ((_this select 1) select 0) addScore ((_this select 1) select 1);
  487. };
  488. };
  489. // END IL_Server_AddScore
  490. "IL_SetScore" addPublicVariableEventHandler IL_Server_AddScore;
  491. // END publicVariable "IL_SetScore";
  492. IL_Score =
  493. {
  494. private ["_obj", "_score"];
  495. _obj = _this select 0;
  496. _score = _this select 1;
  497. if (_score != 0) then
  498. {
  499. IL_SetScore = [_obj, _score];
  500. if (isServer) then
  501. {
  502. ["Cos", IL_SetScore] spawn IL_Server_AddScore;
  503. }
  504. else
  505. {
  506. publicVariableServer "IL_SetScore";
  507. };
  508. };
  509. };
  510. // END IL_Score
  511. IL_Server_SetDir =
  512. {
  513. if (IL_DevMod) then
  514. {
  515. Player globalChat Format["IgiLoad ""%1"" IL_Server_SetDir.", IL_Script_Inst];
  516. };
  517. private ["_obj", "_dir"];
  518. _obj = _this select 1 select 0;
  519. _dir = _this select 1 select 1;
  520. if (_dir < 0) then
  521. {
  522. _dir = _dir + 360;
  523. };
  524. if (_dir > 360) then
  525. {
  526. _dir = _dir - 360;
  527. };
  528. _obj setDir _dir;
  529. _obj setPos (getPos _obj);
  530. };
  531. // END IL_Server_Turn_Obj
  532. "IL_SetDir" addPublicVariableEventHandler IL_Server_SetDir;
  533. // END publicVariable "IL_SetDir";
  534. IL_Rotate =
  535. {
  536. private ["_obj", "_to", "_change"];
  537. _obj = _this select 0;
  538. _to = _this select 1;
  539. _change = _this select 2;
  540. _change = (getDir _obj + _change) - getDir _to;
  541. IL_SetDir = [_obj, _change];
  542. if (local _obj) then
  543. {
  544. ["Cos", IL_SetDir] spawn IL_Server_SetDir;
  545. }
  546. else
  547. {
  548. if (isDedicated) then
  549. {
  550. (owner _obj) publicVariableClient "IL_SetDir";
  551. }
  552. else
  553. {
  554. publicVariableServer "IL_SetDir";
  555. };
  556. };
  557. };
  558. // END IL_Rotate
  559. IL_Server_SetMass =
  560. {
  561. if (IL_DevMod) then
  562. {
  563. Player globalChat Format["IgiLoad ""%1"" IL_Server_SetMass.", IL_Script_Inst];
  564. };
  565. private ["_obj", "_mass"];
  566. _obj = _this select 1 select 0;
  567. _mass = _this select 1 select 1;
  568. if ((getMass _obj) != _mass) then
  569. {
  570. _obj setMass _mass;
  571. };
  572. };
  573. // END IL_Server_SetMass
  574. "IL_SetMass" addPublicVariableEventHandler IL_Server_SetMass;
  575. // END publicVariable "IL_SetMass";
  576. IL_GetCargoMass =
  577. {
  578. private ["_v", "_cargo_mass"];
  579. _v = _this select 0;
  580. _cargo_mass = 0;
  581. if (count(attachedObjects _v) > 0) then
  582. {
  583. {
  584. _cargo_mass = _cargo_mass + getMass _x;
  585. } forEach attachedObjects _v;
  586. };
  587. _cargo_mass;
  588. };
  589. // END IL_GetCargoMass
  590. IL_GetDefaultMass =
  591. {
  592. private ["_v"];
  593. _v = _this select 0;
  594. _v getVariable "default_mass";
  595. };
  596. // END IL_GetDefaultMass
  597. IL_SetNewMass =
  598. {
  599. if (IL_DevMod) then
  600. {
  601. Player globalChat Format ["IgiLoad ""%1"" in IL_SetMass", IL_Script_Inst];
  602. };
  603. if !(IL_Mass) ExitWith {};
  604. private ["_v", "_v_def_mass", "_cargo_mass"];
  605. _v = _this select 0;
  606. _v_def_mass = if (count _this > 1) then {_this select 1} else {0};
  607. _cargo_mass = if (count _this > 2) then {_this select 2} else {0};
  608. if (_v_def_mass == 0) then
  609. {
  610. _v_def_mass = [_v] call IL_GetDefaultMass;
  611. };
  612. if (_cargo_mass == 0) then
  613. {
  614. _cargo_mass = [_v] call IL_GetCargoMass;
  615. };
  616. if ((getMass _v) != (_v_def_mass + _cargo_mass)) then
  617. {
  618. IL_SetMass = [_v, (_v_def_mass + _cargo_mass)];
  619. if (local _v) then
  620. {
  621. ["Cos", IL_SetMass] spawn IL_Server_SetMass;
  622. }
  623. else
  624. {
  625. if (isDedicated) then
  626. {
  627. (owner _v) publicVariableClient "IL_SetMass";
  628. }
  629. else
  630. {
  631. publicVariableServer "IL_SetMass";
  632. };
  633. };
  634. };
  635. // _v setMass (_v_def_mass + _cargo_mass);
  636. };
  637. // END IL_SetNewMass
  638. IL_Vehicle_Chat =
  639. {
  640. private["_v", "_msg", "_mass_info", "_text", "_cargo_mass", "_v_def_mass"];
  641. _v = _this select 0;
  642. _msg = _this select 1;
  643. _mass_info = if (count _this > 2) then {_this select 2} else {false};
  644. _v vehicleChat _msg;
  645. if (_mass_info && IL_Mass) then
  646. {
  647. _cargo_mass = 0;
  648. _v_def_mass = [_v] call IL_GetDefaultMass;
  649. _cargo_mass = [_v] call IL_GetCargoMass;
  650. _text = Format["<img image='%1' size='2' align='left'/>", getText(configFile >> "cfgVehicles" >> typeOf _v >> "picture")];
  651. _text = _text + Format ["<t color='#ff0000' size='1.2' shadow='1' shadowColor='#000000' align='center'>%1</t><br/>", getText(configFile >> "cfgVehicles" >> typeOf _v >> "displayName")];
  652. _text = _text + "<t color='#00aafd' size='1.2' shadow='1' shadowColor='#000000' align='left'>Default mass: </t>";
  653. _text = _text + Format ["<t color='#ffff00' size='1.2' shadow='1' shadowColor='#000000' align='left'>%1</t><br/>", _v_def_mass];
  654. _text = _text + "<t color='#00aafd' size='1.2' shadow='1' shadowColor='#000000' align='left'>Cargo mass: </t>";
  655. _text = _text + Format ["<t color='#ffff00' size='1.2' shadow='1' shadowColor='#000000' align='left'>%1</t><br/>", _cargo_mass];
  656. _text = _text + "<t color='#00aafd' size='1.2' shadow='1' shadowColor='#000000' align='left'>Current mass: </t>";
  657. _text = _text + Format ["<t color='#ffff00' size='1.2' shadow='1' shadowColor='#000000' align='left'>%1</t><br/>", _v_def_mass + _cargo_mass];
  658. };
  659. if (vehicle Player != _v) then
  660. {
  661. if (_mass_info && IL_Mass) then
  662. {
  663. _text = _text + _msg;
  664. hint parseText (_text);
  665. }
  666. else
  667. {
  668. Hint Format ["%1", _msg];
  669. };
  670. }
  671. else
  672. {
  673. if (_mass_info && IL_Mass) then
  674. {
  675. hint parseText (_text);
  676. };
  677. };
  678. };
  679. // END IL_Vehicle_Chat
  680. IL_Move_Attach=
  681. {
  682. private ["_veh", "_obj", "_from", "_to", "_pos", "_step", "_steps", "_from_x", "_from_y", "_from_z", "_to_x", "_to_y", "_to_z", "_x", "_y", "_z", "_i", "_x_step", "_y_step", "_z_step", "_turn"];
  683. _veh = _this select 0;
  684. _obj = _this select 1;
  685. _from = _this select 2;
  686. _to = _this select 3;
  687. _step = _this select 4;
  688. _turn = if (count _this > 5) then {_this select 5} else {false};
  689. _from_x = _from select 0;
  690. _from_y = _from select 1;
  691. _from_z = _from select 2;
  692. if (IL_DevMod) then
  693. {
  694. Player globalChat Format ["IgiLoad ""%1"". IL_Move_Attach _from_x =""%2"", _from_y =""%3"", _from_z =""%4""", IL_Script_Inst, _from_x, _from_y, _from_z];
  695. };
  696. _to_x = _to select 0;
  697. _to_y = _to select 1;
  698. _to_z = _to select 2;
  699. if (IL_DevMod) then
  700. {
  701. Player globalChat Format ["IgiLoad ""%1"". IL_Move_Attach _to_x =""%2"", _to_y =""%3"", _to_z =""%4""", IL_Script_Inst, _to_x, _to_y, _to_z];
  702. };
  703. _x = _to_x - _from_x;
  704. _y = _to_y - _from_y;
  705. _z = _to_z - _from_z;
  706. if (IL_DevMod) then
  707. {
  708. Player globalChat Format ["IgiLoad ""%1"". IL_Move_Attach _x =""%2"", _y =""%3"", _z =""%4""", IL_Script_Inst, _x, _y, _z];
  709. };
  710. if (((abs _x) > (abs _y)) && ((abs _x) > (abs _z))) then
  711. {
  712. _steps = round ((abs _x) / _step);
  713. if (IL_DevMod) then
  714. {
  715. Player globalChat Format ["IgiLoad ""%1"". IL_Move_Attach _x > _y and _z, _steps =""%2""", IL_Script_Inst, _steps];
  716. };
  717. }
  718. else
  719. {
  720. if ((abs _y) > (abs _z)) then
  721. {
  722. _steps = round ((abs _y) / _step);
  723. if (IL_DevMod) then
  724. {
  725. Player globalChat Format ["IgiLoad ""%1"". IL_Move_Attach _y > _z, _steps =""%2""", IL_Script_Inst, _steps];
  726. };
  727. }
  728. else
  729. {
  730. _steps = round ((abs _z) / _step);
  731. if (IL_DevMod) then
  732. {
  733. Player globalChat Format ["IgiLoad ""%1"". IL_Move_Attach _z > _y, _steps =""%2""", IL_Script_Inst, _steps];
  734. };
  735. };
  736. };
  737. _i = 0;
  738. _obj AttachTo [_veh, _from];
  739. while {_i < _steps} do
  740. {
  741. _i = _i + 1;
  742. _pos = [(((_x / _steps) * _i) + _from_x), (((_y / _steps) * _i) + _from_y), (((_z / _steps) * _i) + _from_z)];
  743. _obj AttachTo [_veh, _pos];
  744. if (_turn) then
  745. {
  746. [_obj, _veh, -90] call IL_Rotate;
  747. _turn = false;
  748. };
  749. if (IL_DevMod) then
  750. {
  751. Player globalChat Format ["IgiLoad ""%1"". IL_Move_Attach _pos =""%2""", IL_Script_Inst, _pos];
  752. };
  753. sleep 0.25;
  754. };
  755. _obj AttachTo [_veh, _to];
  756. // if (_turn) then
  757. // {
  758. // [_obj, _veh, 90] call IL_Rotate;
  759. // };
  760. };
  761. // END IL_Move_Attach
  762. IL_Create_And_Attach =
  763. {
  764. if (IL_DevMod) then
  765. {
  766. Player globalChat Format ["IgiLoad ""%1"" in IL_Create_And_Attach", IL_Script_Inst];
  767. };
  768. _type = _this select 0;
  769. _to = _this select 1;
  770. _x = if (count _this > 2) then {_this select 2} else {0};
  771. _y = if (count _this > 3) then {_this select 3} else {0};
  772. _z = if (count _this > 4) then {_this select 4} else {0};
  773. _m = createVehicle [_type, position _to, [], 0, "CAN_COLLIDE"];
  774. _m AttachTo [_to,[_x,_y,_z]];
  775. _m
  776. };
  777. // END IL_Create_And_Attach
  778. IL_Cargo_Para =
  779. {
  780. if (IL_DevMod) then
  781. {
  782. Player globalChat Format ["IgiLoad ""%1"" in IL_Cargo_Para", IL_Script_Inst];
  783. };
  784. //player addScore IL_Unload_Score;
  785. [Player, IL_Unload_Score] call IL_Score;
  786. private ["_smoke", "_light", "_damage", "_smoke_type", "_chemlight_type", "_cargo_pos", "_last_attach_pos", "_dist", "_velocity", "_tmp"];
  787. _cargo = _this select 0;
  788. _v = _this select 1;
  789. _last_attach_pos = _this select 2;
  790. if (((IL_Para_Smoke) || (IL_Para_Smoke_Add)) && (_cargo isKindOf "AllVehicles")) then
  791. {
  792. _smoke_type = IL_Para_Smoke_Veh;
  793. }
  794. else
  795. {
  796. _smoke_type = IL_Para_Smoke_Default;
  797. };
  798. if (((IL_Para_Light) || (IL_Para_Light_Add)) && (_cargo isKindOf "AllVehicles")) then
  799. {
  800. _chemlight_type = IL_Para_Light_Veh;
  801. }
  802. else
  803. {
  804. _chemlight_type = IL_Para_Light_Default;
  805. };
  806. _cargo_pos = [0,0,0];
  807. _damage = getDammage _cargo;
  808. detach _cargo;
  809. _dist = _v distance _cargo;
  810. _tmp = [_cargo] spawn
  811. {
  812. while {(getPosATL (_this select 0)) select 2 > IL_Para_Drop_Open_ATL} do
  813. {
  814. sleep 0.2;
  815. };
  816. };
  817. while {(_v distance _cargo) - _dist < 20} do
  818. {
  819. sleep 0.2;
  820. };
  821. if (IL_Para_Drop_Open_ATL > 0) then
  822. {
  823. while {(getPosATL _cargo) select 2 > (IL_Para_Drop_Open_ATL + ((velocity _cargo) select 2) * -0.5)} do
  824. {
  825. sleep 0.2;
  826. };
  827. };
  828. // _chute = createVehicle ["NonSteerable_Parachute_F", position _cargo, [], 0, "CAN_COLLIDE"];
  829. _chute = createVehicle ["B_Parachute_02_F", position _cargo, [], 0, "CAN_COLLIDE"];
  830. _chute attachTo [_cargo, _cargo_pos];
  831. _velocity = velocity _cargo;
  832. detach _chute;
  833. if (IL_Para_Drop_Velocity) then
  834. {
  835. _chute setVelocity _velocity;
  836. };
  837. _cargo attachTo [_chute, _cargo_pos];
  838. if (IL_Para_Smoke) then
  839. {
  840. _smoke = [_smoke_type, _cargo] call IL_Create_And_Attach;
  841. };
  842. if (IL_Para_Light) then
  843. {
  844. _light = [_chemlight_type, _cargo] call IL_Create_And_Attach;
  845. };
  846. while {(getPos _cargo) select 2 > 2} do
  847. {
  848. sleep 0.2;
  849. };
  850. detach _cargo;
  851. if (IL_Para_Smoke) then
  852. {
  853. _smoke attachTo [_cargo,[0,0,2]];
  854. detach _smoke;
  855. };
  856. if (IL_Para_Light) then
  857. {
  858. _light attachTo [_cargo,[0,0,2]];
  859. detach _light;
  860. };
  861. //Additional lights and smoke
  862. if (IL_Para_Smoke_Add) then
  863. {
  864. _smoke = [_smoke_type, _cargo] call IL_Create_And_Attach;
  865. _smoke attachTo [_cargo,[0,0,2]];
  866. detach _smoke;
  867. };
  868. if (IL_Para_Light_Add) then
  869. {
  870. _light = [_chemlight_type, _cargo] call IL_Create_And_Attach;
  871. _light attachTo [_cargo,[0,0,2]];
  872. detach _light;
  873. };
  874. _cargo setPosASL getPosASL _cargo;
  875. if (IL_CDamage == 0) then
  876. {
  877. _cargo setDamage 0;
  878. };
  879. if (IL_CDamage == 1) then
  880. {
  881. _cargo setDamage _damage;
  882. if (_damage != (getDammage _cargo)) then
  883. {
  884. sleep 1;
  885. _cargo setDamage _damage;
  886. };
  887. };
  888. };
  889. // END IL_Cargo_Para
  890. IL_Do_Load =
  891. {
  892. if (IL_DevMod) then
  893. {
  894. Player globalChat Format ["IgiLoad ""%1"" in IL_Do_Load", IL_Script_Inst];
  895. };
  896. private["_NoBoxHint", "_v", "_supported_cargo", "_zload", "_x_cargo_offset", "_cargo_offset", "_sdist", "_spoint", "_slot_num", "_counter", "_done", "_obj_lst", "_damage", "_obj_type", "_doors", "_box_num", "_dummy", "_nic", "_turn", "_force", "_cargo"];
  897. _NoBoxHint = "The box is in the vicinity. Perhaps it is outside of the loading area.";
  898. _v = _this select 0;
  899. _supported_cargo = _this select 1;
  900. _doors = if (count _this > 2) then {_this select 2} else {"B"};
  901. _force = if (count _this > 3) then {_this select 3} else {false};
  902. _cargo = if (count _this > 4) then {_this select 4} else {ObjNull};
  903. _v setVariable["can_load", false, true];
  904. _zload = _v getVariable "zload";
  905. _obj_type = (typeOf _v);
  906. _sdist = 0;
  907. _counter = 0;
  908. _done = false;
  909. _turn = false;
  910. if ((_obj_type in IL_Supported_Vehicles_VAN) && (_doors == "B")) then
  911. {
  912. if (IL_DevMod) then
  913. {
  914. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  915. };
  916. _sdist = IL_SDistL;
  917. _spoint = _v modelToWorld [0,-4.5,-1.6];
  918. _box_num = _v getVariable "box_num";
  919. _slot_num = _v getVariable "slots_num";
  920. };
  921. if ((_obj_type in IL_Supported_Vehicles_OFFROAD) && (_doors == "B")) then
  922. {
  923. if (IL_DevMod) then
  924. {
  925. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  926. };
  927. _sdist = IL_SDistL;
  928. _spoint = _v modelToWorld [0,-4.5,-1.6];
  929. _box_num = _v getVariable "box_num";
  930. _slot_num = _v getVariable "slots_num";
  931. };
  932. if ((_obj_type in IL_Supported_Vehicles_KAMAZ) && (_doors == "B")) then
  933. {
  934. if (IL_DevMod) then
  935. {
  936. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  937. };
  938. _sdist = IL_SDistL;
  939. _spoint = _v modelToWorld [0,-6 - (_v getVariable "load_offset"),0];
  940. _box_num = _v getVariable "box_num";
  941. _slot_num = _v getVariable "slots_num";
  942. };
  943. if ((_obj_type in IL_Supported_Vehicles_HEMTT) && (_doors == "B")) then
  944. {
  945. if (IL_DevMod) then
  946. {
  947. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  948. };
  949. _sdist = IL_SDistL;
  950. _spoint = _v modelToWorld [0,-7 - (_v getVariable "load_offset"),0];
  951. _box_num = _v getVariable "box_num";
  952. _slot_num = _v getVariable "slots_num";
  953. };
  954. if ((_obj_type in IL_Supported_Vehicles_TEMPEST) && (_doors == "B")) then
  955. {
  956. if (IL_DevMod) then
  957. {
  958. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  959. };
  960. _sdist = IL_SDistL;
  961. _spoint = _v modelToWorld [0,-6.5 - (_v getVariable "load_offset"),0];
  962. _box_num = _v getVariable "box_num";
  963. _slot_num = _v getVariable "slots_num";
  964. };
  965. if ((_obj_type in IL_Supported_Vehicles_C130J) && (_doors == "B")) then
  966. {
  967. if (IL_DevMod) then
  968. {
  969. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  970. };
  971. _sdist = IL_SDistL + IL_SDistL_Heli_offset;
  972. _spoint = _v modelToWorld [0,-9,-5.4];
  973. _box_num = _v getVariable "box_num";
  974. _slot_num = _v getVariable "slots_num";
  975. };
  976. if ((_obj_type in IL_Supported_Vehicles_C17) && (_doors == "B")) then
  977. {
  978. if (IL_DevMod) then
  979. {
  980. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  981. };
  982. _sdist = IL_SDistL + IL_SDistL_Heli_offset;
  983. _spoint = _v modelToWorld [0,-16.5,-3];//Ramp end [0,-13.5,-3.2]
  984. _box_num = _v getVariable "box_num";
  985. _slot_num = _v getVariable "slots_num";
  986. };
  987. if ((_obj_type in IL_Supported_Vehicles_CHINOOK) && (_doors == "B")) then
  988. {
  989. if (IL_DevMod) then
  990. {
  991. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  992. };
  993. _sdist = IL_SDistL + IL_SDistL_Heli_offset;
  994. _spoint = _v modelToWorld [0,-9,-3];
  995. _box_num = _v getVariable "box_num";
  996. _slot_num = _v getVariable "slots_num";
  997. };
  998. if ((_obj_type in IL_Supported_Vehicles_MOHAWK) && (_doors == "B")) then
  999. {
  1000. if (IL_DevMod) then
  1001. {
  1002. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  1003. };
  1004. _sdist = IL_SDistL + IL_SDistL_Heli_offset;
  1005. _spoint = _v modelToWorld [0,-6,-3];
  1006. _box_num = _v getVariable "box_num";
  1007. _slot_num = _v getVariable "slots_num";
  1008. };
  1009. if ((_obj_type in IL_Supported_Vehicles_MH9) && (_doors == "L")) then
  1010. {
  1011. if (IL_DevMod) then
  1012. {
  1013. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  1014. };
  1015. _sdist = IL_SDistL + IL_SDistL_Heli_offset;
  1016. _spoint = _v modelToWorld [0-3,1.3,-1.3];
  1017. _box_num = _v getVariable "box_num_l";
  1018. _slot_num = _v getVariable "slots_num_l";
  1019. };
  1020. if ((_obj_type in IL_Supported_Vehicles_MH9) && (_doors == "R")) then
  1021. {
  1022. if (IL_DevMod) then
  1023. {
  1024. Player globalChat Format ["IgiLoad ""%1"". Do_load vehicle type: ""%2"" and doors: ""%3""", IL_Script_Inst, _obj_type, _doors];
  1025. };
  1026. _sdist = IL_SDistL + IL_SDistL_Heli_offset;
  1027. _spoint = _v modelToWorld [0+3,1.3,-1.3];
  1028. _box_num = _v getVariable "box_num_r";
  1029. _slot_num = _v getVariable "slots_num_r";
  1030. };
  1031. if !(_force) then
  1032. {
  1033. _obj_lst = nearestObjects[ _spoint, _supported_cargo, _sdist];
  1034. }
  1035. else
  1036. {
  1037. _obj_lst = [_cargo];
  1038. };
  1039. if (count (_obj_lst) > 0) then
  1040. {
  1041. {
  1042. if (IL_DevMod) then
  1043. {
  1044. Player globalChat Format ["IgiLoad ""%1"". Cargo: ""%2"" found.", IL_Script_Inst, _x];
  1045. };
  1046. if (isNil {_x getVariable "attachedPos"}) then
  1047. {
  1048. if (IL_DevMod) then
  1049. {
  1050. Player globalChat Format ["IgiLoad ""%1"". Init box: ""%2"".", IL_Script_Inst, _x];
  1051. };
  1052. [_x] call IL_Init_Box;
  1053. };
  1054. if ((typeOf _x) in (IL_Supported_Cargo20 + ["Land_WaterTank_F"])) then
  1055. {
  1056. _turn = true;
  1057. };
  1058. //It allows you to load oversize loads, but they must be on the list of supported cargo!!!
  1059. if ((abs(_slot_num - _box_num) < (_x getVariable "slots")) && (_box_num != 0)) then
  1060. {
  1061. [_v, "This cargo is to big. "] call IL_Vehicle_Chat;
  1062. }
  1063. else
  1064. {
  1065. if (IL_DevMod) then
  1066. {
  1067. Player globalChat Format ["IgiLoad ""%1"". _box_num: ""%2"" _slot_num: ""%3""", IL_Script_Inst, _box_num, _slot_num];
  1068. };
  1069. if (_obj_type in IL_Supported_Vehicles_MH9) then
  1070. {
  1071. _turn = !_turn;
  1072. };
  1073. if ((_box_num > _slot_num) && !_done) then
  1074. {
  1075. [_v, Format ["Loading ""%1"" on ""%2"" started", getText(configFile >> "cfgVehicles" >> typeOf _x >> "displayName"), getText(configFile >> "cfgVehicles" >> typeOf _v >> "displayName")]] call IL_Vehicle_Chat;
  1076. _done = true;
  1077. _counter = (_box_num);
  1078. _zload = (_v getVariable "zload") + (_x getVariable "zload_cargo");
  1079. _cargo_offset = (_v getVariable "load_offset") + (_x getVariable "cargo_offset");
  1080. if ((typeOf _x) in IL_Supported_UGV) then
  1081. {
  1082. _x_cargo_offset = -0.4;
  1083. }
  1084. else
  1085. {
  1086. _x_cargo_offset = 0;
  1087. };
  1088. _damage = getDammage _x;
  1089. if ((typeOf _x) in IL_Supported_SDV) then
  1090. {
  1091. _x animate ["periscope", 3];
  1092. _x animate ["Antenna", 3];
  1093. _x animate ["HideScope", 3];
  1094. _x animate["display_on_R", 1];
  1095. //animationPhase
  1096. [_v, "Waiting for periscope."] call IL_Vehicle_Chat;
  1097. while {_x animationPhase "periscope" < 3} do
  1098. {
  1099. sleep 1;
  1100. };
  1101. };
  1102. if ((_obj_type in IL_Supported_Vehicles_VAN) && (_doors == "B")) then
  1103. {
  1104. [_v, _x, [_x_cargo_offset,-4.5,_zload], [_x_cargo_offset,_counter + 0.25 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1105. };
  1106. if ((_obj_type in IL_Supported_Vehicles_OFFROAD) && (_doors == "B")) then
  1107. {
  1108. [_v, _x, [_x_cargo_offset,-4.5,_zload], [_x_cargo_offset,_counter + 0.25 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1109. };
  1110. if ((_obj_type in IL_Supported_Vehicles_KAMAZ) && (_doors == "B")) then
  1111. {
  1112. [_v, _x, [_x_cargo_offset,-6 - _cargo_offset,_zload], [_x_cargo_offset,_counter + 0.25 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1113. };
  1114. if ((_obj_type in IL_Supported_Vehicles_HEMTT) && (_doors == "B")) then
  1115. {
  1116. [_v, _x, [_x_cargo_offset,-7 - _cargo_offset,_zload], [_x_cargo_offset,_counter + 0.25 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1117. };
  1118. if ((_obj_type in IL_Supported_Vehicles_TEMPEST) && (_doors == "B")) then
  1119. {
  1120. [_v, _x, [_x_cargo_offset,-6.5 - _cargo_offset,_zload], [_x_cargo_offset,_counter - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1121. };
  1122. if ((_obj_type in IL_Supported_Vehicles_C130J) && (_doors == "B")) then
  1123. {
  1124. [_v, _x, [_x_cargo_offset,-9,-0.93 + _zload], [_x_cargo_offset,-8,-0.93 + _zload], 1, _turn] call IL_Move_Attach;
  1125. [_v, _x, [_x_cargo_offset,-7,-0.93 + _zload], [_x_cargo_offset,-3.5,_zload], 1, _turn] call IL_Move_Attach;
  1126. [_v, _x, [_x_cargo_offset,-2.5,_zload], [_x_cargo_offset,_counter + 17 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1127. };
  1128. if ((_obj_type in IL_Supported_Vehicles_C17) && (_doors == "B")) then
  1129. {
  1130. [_v, _x, [_x_cargo_offset,-16.5,-1.75 + _zload], [_x_cargo_offset,-14,-1.75 + _zload], 1, _turn] call IL_Move_Attach;
  1131. [_v, _x, [_x_cargo_offset,-13,-1.75 + _zload], [_x_cargo_offset,-6.5,_zload], 1, _turn] call IL_Move_Attach;
  1132. [_v, _x, [_x_cargo_offset,-5.5,_zload], [_x_cargo_offset,_counter + 32 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1133. };
  1134. if ((_obj_type in IL_Supported_Vehicles_CHINOOK) && (_doors == "B")) then
  1135. {
  1136. [_v, _x, [_x_cargo_offset,-9,-0.75 + _zload], [_x_cargo_offset,-7,-0.75 + _zload], 1, _turn] call IL_Move_Attach;
  1137. [_v, _x, [_x_cargo_offset,-7,-0.75 + _zload], [_x_cargo_offset,-4,_zload], 1, _turn] call IL_Move_Attach;
  1138. [_v, _x, [_x_cargo_offset,-4,_zload], [_x_cargo_offset,_counter + 9 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1139. };
  1140. if ((_obj_type in IL_Supported_Vehicles_MOHAWK) && (_doors == "B")) then
  1141. {
  1142. [_v, _x, [_x_cargo_offset,-6,-0.75 + _zload], [_x_cargo_offset,-4.5,-0.75 + _zload], 1, _turn] call IL_Move_Attach;
  1143. [_v, _x, [_x_cargo_offset,-4.5,-0.75 + _zload], [_x_cargo_offset,-1.5,_zload], 1, _turn] call IL_Move_Attach;
  1144. [_v, _x, [_x_cargo_offset,-1.5,_zload], [_x_cargo_offset,_counter + 9 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1145. };
  1146. if ((_obj_type in IL_Supported_Vehicles_MH9) && (_doors == "L")) then
  1147. {
  1148. [_v, _x, [_x_cargo_offset-3,1.3,-1.3 + _zload], [_x_cargo_offset-1,-0.2,_zload], 1, _turn] call IL_Move_Attach;
  1149. };
  1150. if ((_obj_type in IL_Supported_Vehicles_MH9) && (_doors == "R")) then
  1151. {
  1152. [_v, _x, [_x_cargo_offset+3,1.3,-1.3 + _zload], [_x_cargo_offset+1,-0.2,_zload], 1, _turn] call IL_Move_Attach;
  1153. };
  1154. _counter = _counter - (_x getVariable "slots");
  1155. if (_doors == "B") then
  1156. {
  1157. _v setVariable["box_num", _counter, true];
  1158. };
  1159. if ((_obj_type in IL_Supported_Vehicles_MH9) && (_doors == "L")) then
  1160. {
  1161. _v setVariable["box_num_l", _counter, true];
  1162. _v setVariable["box_l", _x, true];
  1163. };
  1164. if ((_obj_type in IL_Supported_Vehicles_MH9) && (_doors == "R")) then
  1165. {
  1166. _v setVariable["box_num_r", _counter, true];
  1167. _v setVariable["box_r", _x, true];
  1168. };
  1169. [_v] call IL_SetNewMass;
  1170. if (_x isKindOf "AllVehicles") then
  1171. {
  1172. _x forceSpeed 0;
  1173. };
  1174. _x setVariable["attachedPos", _counter, true];
  1175. _x setVariable["attachedTruck", _v, true];
  1176. _x setVariable["doors", _doors, true];
  1177. if (IL_CDamage == 0) then
  1178. {
  1179. _x setDamage 0;
  1180. };
  1181. if (IL_CDamage == 1) then
  1182. {
  1183. _x setDamage _damage;
  1184. if (_damage != (getDammage _x)) then
  1185. {
  1186. sleep 1;
  1187. _x setDamage _damage;
  1188. };
  1189. };
  1190. if (_counter > _slot_num) then
  1191. {
  1192. [_v, Format ["""%1"" is loaded onto ""%2"". Free slots: ""%3"".", getText(configFile >> "cfgVehicles" >> typeOf _x >> "displayName"), getText(configFile >> "cfgVehicles" >> typeOf _v >> "displayName"), abs(_slot_num - _counter)], true] call IL_Vehicle_Chat;
  1193. }
  1194. else
  1195. {
  1196. [_v, Format ["""%1"" is loaded onto ""%2"" There is no more space.", getText(configFile >> "cfgVehicles" >> typeOf _x >> "displayName"), getText(configFile >> "cfgVehicles" >> typeOf _v >> "displayName")], true] call IL_Vehicle_Chat;
  1197. };
  1198. //player addScore IL_Load_Score;
  1199. [Player, IL_Load_Score] call IL_Score;
  1200. }
  1201. else
  1202. {
  1203. if ((_box_num > _slot_num) && !_done) then
  1204. {
  1205. [_v, _NoBoxHint] call IL_Vehicle_Chat;
  1206. };
  1207. };
  1208. };
  1209. if (_done) exitWith {};
  1210. } forEach (_obj_lst);
  1211. }
  1212. else
  1213. {
  1214. [_v, _NoBoxHint] call IL_Vehicle_Chat;
  1215. };
  1216. _v setVariable["can_load", true, true];
  1217. };
  1218. // END IL_Do_Load
  1219. IL_Do_Unload =
  1220. {
  1221. if (IL_DevMod) then
  1222. {
  1223. Player globalChat Format["IgiLoad ""%1"" IL_Do_Unload.", IL_Script_Inst];
  1224. };
  1225. private ["_v", "_para", "_supported_cargo", "_doors", "_counter", "_done", "_obj_lst", "_zload", "_x_cargo_offset", "_cargo_offset", "_obj_type", "_damage", "_nic", "_free_slots", "_turn", "_skip", "_last_attach_pos"];
  1226. _v = _this select 0;
  1227. _para = if (count _this > 1) then {_this select 1} else {false};
  1228. //_para = _this select 1;
  1229. // _supported_cargo = _this select 2;
  1230. // _doors = if (count _this > 3) then {_this select 3} else {"B"};
  1231. _doors = if (count _this > 2) then {_this select 2} else {"B"};
  1232. _v setVariable["can_load", false, true];
  1233. _counter = 0;
  1234. _done = false;
  1235. _turn = false;
  1236. _skip = true;
  1237. _obj_lst = [];
  1238. _obj_type = (typeOf _v);
  1239. if (_obj_type in IL_Supported_Vehicles_MH9) then
  1240. {
  1241. if (_doors == "L") then
  1242. {
  1243. _obj_lst = [_v getVariable "box_l"];
  1244. }
  1245. else
  1246. {
  1247. _obj_lst = [_v getVariable "box_r"];
  1248. };
  1249. }
  1250. else
  1251. {
  1252. // _obj_lst = nearestObjects[_v, _supported_cargo, IL_SDistU];
  1253. _obj_lst = attachedObjects _v;
  1254. };
  1255. if (count (_obj_lst) > 0) then
  1256. {
  1257. {
  1258. _obj_type = (typeOf _v);
  1259. if (_x getVariable "doors" == _doors) then
  1260. {
  1261. if (_doors == "B") then
  1262. {
  1263. _counter = (_v getVariable "box_num");
  1264. };
  1265. if (_doors == "L") then
  1266. {
  1267. _counter = (_v getVariable "box_num_l");
  1268. };
  1269. if (_doors == "R") then
  1270. {
  1271. _counter = (_v getVariable "box_num_r");
  1272. };
  1273. if (((_x getVariable "attachedTruck") == _v) && ((_x getVariable "attachedPos") == (_counter)) && (_counter < 0) && !_done) then
  1274. {
  1275. [_v, Format ["Unloading ""%1"" from ""%2"" started", getText(configFile >> "cfgVehicles" >> typeOf _x >> "displayName"), getText(configFile >> "cfgVehicles" >> typeOf _v >> "displayName")]] call IL_Vehicle_Chat;
  1276. _done = true;
  1277. _skip = false;
  1278. _zload = (_v getVariable "zload") + (_x getVariable "zload_cargo");
  1279. _cargo_offset = (_v getVariable "load_offset") + (_x getVariable "cargo_offset");
  1280. _damage = getDammage _x;
  1281. // if ((typeOf _x) == "Land_WaterTank_F") then
  1282. // {
  1283. // _turn = true;
  1284. // };
  1285. if ((typeOf _x) in IL_Supported_UGV) then
  1286. {
  1287. _x_cargo_offset = -0.4;
  1288. }
  1289. else
  1290. {
  1291. _x_cargo_offset = 0;
  1292. };
  1293. _obj_type = (typeOf _v);
  1294. if ((_obj_type in IL_Supported_Vehicles_VAN) && (_doors == "B")) then
  1295. {
  1296. [_v, _x, [_x_cargo_offset,_counter + 0.25 - _cargo_offset,_zload], [_x_cargo_offset,-4.5,_zload], 1, _turn] call IL_Move_Attach;
  1297. };
  1298. if ((_obj_type in IL_Supported_Vehicles_OFFROAD) && (_doors == "B")) then
  1299. {
  1300. [_v, _x, [_x_cargo_offset,_counter + 0.25 - _cargo_offset,_zload], [_x_cargo_offset,-4.5,_zload], 1, _turn] call IL_Move_Attach;
  1301. };
  1302. if ((_obj_type in IL_Supported_Vehicles_KAMAZ) && (_doors == "B")) then
  1303. {
  1304. [_v, _x, [_x_cargo_offset,_counter + 0.25 - _cargo_offset,_zload], [_x_cargo_offset,-6 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1305. };
  1306. if ((_obj_type in IL_Supported_Vehicles_HEMTT) && (_doors == "B")) then
  1307. {
  1308. [_v, _x, [_x_cargo_offset,_counter + 0.25 - _cargo_offset,_zload], [_x_cargo_offset,-7 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1309. };
  1310. if ((_obj_type in IL_Supported_Vehicles_TEMPEST) && (_doors == "B")) then
  1311. {
  1312. [_v, _x, [_x_cargo_offset,_counter - _cargo_offset,_zload], [_x_cargo_offset,-6.5 - _cargo_offset,_zload], 1, _turn] call IL_Move_Attach;
  1313. };
  1314. if ((_obj_type in IL_Supported_Vehicles_C130J) && (_doors == "B")) then
  1315. {
  1316. if !(_para) then
  1317. {
  1318. [_v, _x, [_x_cargo_offset,_counter + 17 - _cargo_offset,_zload], [_x_cargo_offset,-2.5,_zload], 1, _turn] call IL_Move_Attach;
  1319. };
  1320. [_v, _x, [_x_cargo_offset,-3.5,_zload], [_x_cargo_offset,-7,-0.93 + _zload], 1, _turn] call IL_Move_Attach;
  1321. [_v, _x, [_x_cargo_offset,-8,-0.93 + _zload], [_x_cargo_offset,-9,-0.93 + _zload], 1, _turn] call IL_Move_Attach;
  1322. if ((_para) && (_obj_type in IL_Para_Drop_Vehicles)) then
  1323. {
  1324. [_v, _x, [_x_cargo_offset,-10,-0.93 + _zload], [_x_cargo_offset,-12,-0.93 + _zload], 1, _turn] call IL_Move_Attach;
  1325. _last_attach_pos = [_x_cargo_offset,-12,_zload];
  1326. };
  1327. };
  1328. if ((_obj_type in IL_Supported_Vehicles_C17) && (_doors == "B")) then
  1329. {
  1330. if !(_para) then
  1331. {
  1332. [_v, _x, [_x_cargo_offset,_counter + 32 - _cargo_offset,_zload], [_x_cargo_offset,-5.5,_zload], 1, _turn] call IL_Move_Attach;
  1333. };
  1334. [_v, _x, [_x_cargo_offset,-6.5,_zload], [_x_cargo_offset,-13,-1.75 + _zload], 1, _turn] call IL_Move_Attach;
  1335. [_v, _x, [_x_cargo_offset,-14,-1.75 + _zload], [_x_cargo_offset,-16.5,-1.75 + _zload], 1, _turn] call IL_Move_Attach;
  1336. if ((_para) && (_obj_type in IL_Para_Drop_Vehicles)) then
  1337. {
  1338. [_v, _x, [_x_cargo_offset,-16.5,-1.75 + _zload], [_x_cargo_offset,-19.5,-1.75 + _zload], 1, _turn] call IL_Move_Attach;
  1339. _last_attach_pos = [_x_cargo_offset,-19.5,-1.75 + _zload];
  1340. };
  1341. };
  1342. if ((_obj_type in IL_Supported_Vehicles_CHINOOK) && (_doors == "B")) then
  1343. {
  1344. if !(_para) then
  1345. {
  1346. [_v, _x, [_x_cargo_offset,_counter + 9 - _cargo_offset,_zload], [_x_cargo_offset,-4,_zload], 1, _turn] call IL_Move_Attach;
  1347. };
  1348. [_v, _x, [_x_cargo_offset,-4,_zload], [_x_cargo_offset,-7,-0.75 + _zload], 1, _turn] call IL_Move_Attach;
  1349. [_v, _x, [_x_cargo_offset,-7,-0.75 + _zload], [_x_cargo_offset,-9,-0.75 + _zload], 1, _turn] call IL_Move_Attach;
  1350. if ((_para) && (_obj_type in IL_Para_Drop_Vehicles)) then
  1351. {
  1352. _last_attach_pos = [_x_cargo_offset,-10,-0.75 + _zload];
  1353. };
  1354. };
  1355. if ((_obj_type in IL_Supported_Vehicles_MOHAWK) && (_doors == "B")) then
  1356. {
  1357. if !(_para) then
  1358. {
  1359. [_v, _x, [_x_cargo_offset,_counter + 9 - _cargo_offset,_zload], [_x_cargo_offset,-1.5,_zload], 1, _turn] call IL_Move_Attach;
  1360. };
  1361. [_v, _x, [_x_cargo_offset,-1.5,_zload], [_x_cargo_offset,-4.5,-0.75 + _zload], 1, _turn] call IL_Move_Attach;
  1362. [_v, _x, [_x_cargo_offset,-4.5,-0.75 + _zload], [_x_cargo_offset,-6,-0.75 + _zload], 1, _turn] call IL_Move_Attach;
  1363. if ((_para) && (_obj_type in IL_Para_Drop_Vehicles)) then
  1364. {
  1365. _last_attach_pos = [_x_cargo_offset,-6,-0.75 + _zload];
  1366. };
  1367. };
  1368. if ((_obj_type in IL_Supported_Vehicles_MH9) && (_doors == "L")) then
  1369. {
  1370. [_v, _x, [_x_cargo_offset-1,-0.2,_zload], [_x_cargo_offset-3,1.3,-0.75 + _zload], 1] call IL_Move_Attach;
  1371. if ((_para) && (_obj_type in IL_Para_Drop_Vehicles)) then
  1372. {
  1373. _last_attach_pos = [_x_cargo_offset-3,1.3,-0.75 + _zload];
  1374. };
  1375. };
  1376. if ((_obj_type in IL_Supported_Vehicles_MH9) && (_doors == "R")) then
  1377. {
  1378. [_v, _x, [_x_cargo_offset+1,-0.2,_zload], [_x_cargo_offset+3,1.3,-0.75 + _zload], 1] call IL_Move_Attach;
  1379. if ((_para) && (_obj_type in IL_Para_Drop_Vehicles)) then
  1380. {
  1381. _last_attach_pos = [_x_cargo_offset+3,1.3,-0.75 + _zload];
  1382. };
  1383. };
  1384. if ((_para) && (_obj_type in IL_Para_Drop_Vehicles)) then
  1385. {
  1386. [_x, _v, _last_attach_pos] spawn IL_Cargo_Para;
  1387. }
  1388. else
  1389. {
  1390. sleep 0.2;
  1391. detach _x;
  1392. _x setVelocity [0, 0, -0.2];
  1393. };
  1394. if (_x isKindOf "AllVehicles") then
  1395. {
  1396. _x forceSpeed -1;
  1397. };
  1398. _counter = _counter + (_x getVariable "slots");
  1399. if (_doors == "B") then
  1400. {
  1401. _v setVariable["box_num", _counter, true];
  1402. _free_slots = abs((_v getVariable "slots_num") - (_v getVariable "box_num"));
  1403. };
  1404. if (_doors == "L") then
  1405. {
  1406. _v setVariable["box_num_l", _counter, true];
  1407. _v setVariable["box_l", _v, true];
  1408. _free_slots = abs((_v getVariable "slots_num_l") - (_v getVariable "box_num_l"));
  1409. };
  1410. if (_doors == "R") then
  1411. {
  1412. _v setVariable["box_num_r", _counter, true];
  1413. _v setVariable["box_r", _v, true];
  1414. _free_slots = abs((_v getVariable "slots_num_r") - (_v getVariable "box_num_r"));
  1415. };
  1416. [_v] call IL_SetNewMass;
  1417. _x setVariable["attachedPos", 0, true];
  1418. _x setVariable["attachedTruck", _x, true];
  1419. _x setVariable["doors", "N", true];
  1420. if (IL_CDamage == 0) then
  1421. {
  1422. _x setDamage 0;
  1423. };
  1424. if (IL_CDamage == 1) then
  1425. {
  1426. _x setDamage _damage;
  1427. if (_damage != (getDammage _x)) then
  1428. {
  1429. sleep 1;
  1430. _x setDamage _damage;
  1431. };
  1432. };
  1433. [_v, Format ["""%1"" was unloaded from the ""%2"". Free slots: ""%3"".", getText(configFile >> "cfgVehicles" >> typeOf _x >> "displayName"), getText(configFile >> "cfgVehicles" >> typeOf _v >> "displayName"), _free_slots], true] call IL_Vehicle_Chat;
  1434. //player addScore IL_Unload_Score;
  1435. [Player, IL_Unload_Score] call IL_Score;
  1436. sleep 1;
  1437. };
  1438. };
  1439. if (_done) exitWith {};
  1440. } forEach (_obj_lst);
  1441. if (_skip) then
  1442. {
  1443. [_v, "Can not find cargo. Try again."] call IL_Vehicle_Chat;
  1444. if (_counter < 0) then
  1445. {
  1446. _counter = _counter + 1;
  1447. };
  1448. if (_doors == "B") then
  1449. {
  1450. _v setVariable["box_num", _counter, true];
  1451. _free_slots = abs((_v getVariable "slots_num") - (_v getVariable "box_num"));
  1452. };
  1453. if (_doors == "L") then
  1454. {
  1455. _v setVariable["box_num_l", _counter, true];
  1456. _v setVariable["box_l", _v, true];
  1457. _free_slots = abs((_v getVariable "slots_num_l") - (_v getVariable "box_num_l"));
  1458. };
  1459. if (_doors == "R") then
  1460. {
  1461. _v setVariable["box_num_r", _counter, true];
  1462. _v setVariable["box_r", _v, true];
  1463. _free_slots = abs((_v getVariable "slots_num_r") - (_v getVariable "box_num_r"));
  1464. };
  1465. };
  1466. }
  1467. else
  1468. {
  1469. [_v, "BOX 404 error. Box not found O.o. Vehicle data reset..."] call IL_Vehicle_Chat;
  1470. [_v, true] call IL_Init_Veh;
  1471. [_v, "Vehicle data reset done."] call IL_Vehicle_Chat;
  1472. };
  1473. [_v] call IL_SetNewMass;
  1474. _v setVariable["can_load", true, true];
  1475. };
  1476. // END IL_Do_Unload
  1477. IL_GetOut =
  1478. {
  1479. if (IL_DevMod) then
  1480. {
  1481. Player globalChat Format["IgiLoad ""%1"" IL_GetOut.", IL_Script_Inst];
  1482. };
  1483. private ["_v", "_player", "_para", "_chute", "_backpack", "_pos", "_x_offset", "_dist", "_dist_out", "_dist_out_para", "_velocity"];
  1484. _v = _this select 0;
  1485. _player = _this select 1;
  1486. _para = if (count _this > 2) then {_this select 2} else {false};
  1487. if ((typeOf _v) in IL_Supported_Vehicles_MH9) then
  1488. {
  1489. _dist_out = 5;
  1490. _dist_out_para = 5;
  1491. };
  1492. if ((typeOf _v) in IL_Supported_Vehicles_MOHAWK) then
  1493. {
  1494. _dist_out = 5;
  1495. _dist_out_para = 11;
  1496. };
  1497. if ((typeOf _v) in IL_Supported_Vehicles_CHINOOK) then
  1498. {
  1499. _dist_out = 7;
  1500. _dist_out_para = 11;
  1501. };
  1502. if ((typeOf _v) in IL_Supported_Vehicles_C130J) then
  1503. {
  1504. _dist_out = 7;
  1505. _dist_out_para = 15;
  1506. };
  1507. if ((typeOf _v) in IL_Supported_Vehicles_C17) then
  1508. {
  1509. _dist_out = 15;
  1510. _dist_out_para = 20;
  1511. };
  1512. _pos = (_v worldToModel (getPosATL _player));
  1513. _x_offset = _pos select 0;
  1514. if (_x_offset < 0) then
  1515. {
  1516. if ((typeOf _v) in IL_Supported_Vehicles_MH9) then
  1517. {
  1518. _x_offset = 90;
  1519. }
  1520. else
  1521. {
  1522. _x_offset = 8;
  1523. };
  1524. }
  1525. else
  1526. {
  1527. if ((typeOf _v) in IL_Supported_Vehicles_MH9) then
  1528. {
  1529. _x_offset = -90;
  1530. }
  1531. else
  1532. {
  1533. _x_offset = -8;
  1534. };
  1535. };
  1536. _player allowDamage false;
  1537. sleep 0.2;
  1538. unassignVehicle _player;
  1539. _player action ["EJECT",vehicle _player];
  1540. sleep 0.5;
  1541. if !(_para) then
  1542. {
  1543. _player setDir ((getDir _v) + 180);
  1544. _pos = ([_v, _dist_out, ((getDir _v) + 180 + _x_offset)] call BIS_fnc_relPos);
  1545. _pos = [_pos select 0, _pos select 1, ((getPosATL _v) select 2)];
  1546. _player setPosATL _pos;
  1547. }
  1548. else
  1549. {
  1550. // _backpack = unitBackpack _player;
  1551. // if !((_backpack isKindOf "B_Parachute") || (isNull _backpack)) then
  1552. // {
  1553. // _backpack AttachTo [_player, [0,0.15,0.15], "Pelvis"];
  1554. // [_backpack, _player, 180] call IL_Rotate;
  1555. // };
  1556. _pos = ([_v, _dist_out_para, ((getDir _v) + 180 + _x_offset)] call BIS_fnc_relPos);
  1557. _pos = [_pos select 0, _pos select 1, ((getPosATL _v) select 2)];
  1558. _player setPosATL _pos;
  1559. _dist = _v distance _player;
  1560. while {(_v distance _player) - _dist < 20} do
  1561. {
  1562. sleep 0.2;
  1563. };
  1564. if (IL_Para_Jump_Open_ATL > 0) then
  1565. {
  1566. while {(getPosATL _player) select 2 > IL_Para_Jump_Open_ATL} do
  1567. {
  1568. sleep 0.2;
  1569. };
  1570. };
  1571. if !(unitBackpack _player isKindOf "B_Parachute") then
  1572. {
  1573. _chute = createVehicle ["Steerable_Parachute_F", position _player, [], 0, "CAN_COLLIDE"];
  1574. // _chute setPos getPos _player;
  1575. _chute AttachTo [_player, [0,0,0]];
  1576. detach _chute;
  1577. _velocity = velocity _player;
  1578. _player moveInDriver _chute;
  1579. if (IL_Para_Jump_Velocity) then
  1580. {
  1581. _chute setVelocity _velocity;
  1582. };
  1583. };
  1584. };
  1585. _player allowDamage true;
  1586. // if !((_backpack isKindOf "B_Parachute") || (isNull _backpack)) then
  1587. // {
  1588. // while {(getPosATL _backpack) select 2 < 5} do
  1589. // {
  1590. // sleep 0.2;
  1591. // };
  1592. // _backpack AttachTo [_player, [0,0.15,-1.5], "Pelvis"];
  1593. // while {(getPosATL _backpack) select 2 < 1} do
  1594. // {
  1595. // sleep 0.2;
  1596. // };
  1597. // detach _backpack;
  1598. // };
  1599. if (IL_DevMod) then
  1600. {
  1601. Player globalChat Format["IgiLoad ""%1"" IL_GetOut.", IL_Script_Inst];
  1602. };
  1603. if (IL_DevMod) then
  1604. {
  1605. Player globalChat Format["IgiLoad ""%1"" IL_GetOut. Player ATL: ""%2""", IL_Script_Inst, _pos];
  1606. };
  1607. };
  1608. // END IL_GetOut
  1609. };
  1610. // END PROCEDURES AND FUNCTIONS
  1611. // MAIN CODE
  1612. _vsupported = false;
  1613. if (_obj_main_type in IL_Supported_Vehicles_MOHAWK) then
  1614. {
  1615. if (IL_DevMod) then
  1616. {
  1617. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_MOHAWK.", IL_Script_Inst];
  1618. };
  1619. _vsupported = true;
  1620. [_obj_main] call IL_Init_Veh;
  1621. _obj_main addAction [
  1622. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on CH-49</t>",
  1623. {
  1624. [_this select 0, IL_Supported_Cargo_NonVeh_Mohawk] call IL_Do_Load;
  1625. },[],IL_Action_LU_Priority,true,true,"",
  1626. "(count(nearestObjects[ _target modelToWorld [0,-6,-3], IL_Supported_Cargo_NonVeh_Mohawk, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-6,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'CargoRamp_Open' == 1)"
  1627. ];
  1628. _obj_main addAction [
  1629. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on CH-49</t>",
  1630. {
  1631. [_this select 0, IL_Supported_Cargo_Veh_Mohawk] call IL_Do_Load;
  1632. },[],IL_Action_LU_Priority,true,true,"",
  1633. "(count(nearestObjects[ _target modelToWorld [0,-6,-3], IL_Supported_Cargo_Veh_Mohawk, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-6,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'CargoRamp_Open' == 1)"
  1634. ];
  1635. _obj_main addAction [
  1636. "<t color=""#007f0e"">Get in CH-49</t>",
  1637. {
  1638. (_this select 1) moveInCargo (_this select 0);
  1639. },[],IL_Action_LU_Priority,false,true,"",
  1640. "(_this in (nearestObjects[ _target modelToWorld [0,-6,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && ((_target emptyPositions 'cargo') > 0) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'CargoRamp_Open' > 0.43) && (_target getVariable 'usable_ramp')"
  1641. ];
  1642. _obj_main addAction [
  1643. "<t color=""#ff0000"">Get out CH-49</t>",
  1644. {
  1645. [_this select 0, _this select 1, false] call IL_GetOut;
  1646. },[],IL_Action_LU_Priority,false,true,"",
  1647. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'CargoRamp_Open' > 0.43) && (_target getVariable 'usable_ramp')"
  1648. ];
  1649. _obj_main addAction [
  1650. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Eject</t>",
  1651. {
  1652. [_this select 0, _this select 1, true] call IL_GetOut;
  1653. },[],IL_Action_LU_Priority,false,true,"",
  1654. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (((getPosATL _target) select 2) >= IL_Para_Jump_ATL) && (_target animationPhase 'CargoRamp_Open' > 0.43) && (_target getVariable 'usable_ramp')"
  1655. ];
  1656. _obj_main addAction [
  1657. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from CH-49</t>",
  1658. {
  1659. [_this select 0] call IL_Do_Unload;
  1660. },[],IL_Action_LU_Priority,false,true,"",
  1661. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-6,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'CargoRamp_Open' == 1)"
  1662. ];
  1663. _obj_main addAction [
  1664. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Unload cargo with parachute</t>",
  1665. {
  1666. [_this select 0, true] call IL_Do_Unload;
  1667. },[],IL_Action_LU_Priority,false,true,"",
  1668. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'CargoRamp_Open' == 1)"
  1669. ];
  1670. _obj_main addAction [
  1671. "<img image='IgiLoad\images\unload_all_para.paa' /><t color=""#a50b00""> Unload ALL cargo with parachute</t>",
  1672. {
  1673. while {((_this select 0) getVariable "box_num") != 0} do
  1674. {
  1675. [_this select 0, true] call IL_Do_Unload;
  1676. };
  1677. },[],IL_Action_LU_Priority,false,true,"",
  1678. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'CargoRamp_Open' == 1)"
  1679. ];
  1680. _obj_main addAction [
  1681. "<t color=""#0000ff"">Open cargo ramp in CH-49</t>",
  1682. {
  1683. _this select 0 animatedoor ['CargoRamp_Open', 1];
  1684. },[],IL_Action_O_Priority,false,true,"",
  1685. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-6,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'CargoRamp_Open' == 0) && (_target getVariable 'can_load')"
  1686. ];
  1687. _obj_main addAction [
  1688. "<t color=""#0000ff"">Close cargo ramp in CH-49</t>",
  1689. {
  1690. _this select 0 animatedoor ['CargoRamp_Open', 0];
  1691. },[],IL_Action_O_Priority,false,true,"",
  1692. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-6,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'CargoRamp_Open' == 1) && (_target getVariable 'can_load')"
  1693. ];
  1694. _obj_main addAction [
  1695. "<t color=""#0000ff"">Enable loading for Co-Pilot</t>",
  1696. {
  1697. (_this select 0) setVariable["can_copilot", true, true];;
  1698. },[],IL_Action_S_Priority,false,true,"",
  1699. "((driver _target == _this) && !(_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  1700. ];
  1701. _obj_main addAction [
  1702. "<t color=""#0000ff"">Disable loading for Co-Pilot</t>",
  1703. {
  1704. (_this select 0) setVariable["can_copilot", false, true];;
  1705. },[],IL_Action_S_Priority,false,true,"",
  1706. "((driver _target == _this) && (_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  1707. ];
  1708. _obj_main addAction [
  1709. "<t color=""#0000ff"">Enable loading from outside</t>",
  1710. {
  1711. (_this select 0) setVariable["can_outside", true, true];;
  1712. },[],IL_Action_S_Priority,false,true,"",
  1713. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  1714. ];
  1715. _obj_main addAction [
  1716. "<t color=""#0000ff"">Disable loading from outside</t>",
  1717. {
  1718. (_this select 0) setVariable["can_outside", false, true];;
  1719. },[],IL_Action_S_Priority,false,true,"",
  1720. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  1721. ];
  1722. _obj_main addAction [
  1723. "<t color=""#0000ff"">Enable usable ramp</t>",
  1724. {
  1725. (_this select 0) setVariable["usable_ramp", true, true];;
  1726. },[],IL_Action_S_Priority,false,true,"",
  1727. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'usable_ramp') && IL_Ramp)"
  1728. ];
  1729. _obj_main addAction [
  1730. "<t color=""#0000ff"">Disable usable ramp</t>",
  1731. {
  1732. (_this select 0) setVariable["usable_ramp", false, true];;
  1733. },[],IL_Action_S_Priority,false,true,"",
  1734. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'usable_ramp') && IL_Ramp)"
  1735. ];
  1736. };
  1737. if (_obj_main_type in IL_Supported_Vehicles_CHINOOK) then
  1738. {
  1739. if (IL_DevMod) then
  1740. {
  1741. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_CHINOOK.", IL_Script_Inst];
  1742. };
  1743. _vsupported = true;
  1744. [_obj_main] call IL_Init_Veh;
  1745. if (typeOf _obj_main == "CH_147F") then
  1746. {
  1747. _obj_main addAction [
  1748. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on Chinook</t>",
  1749. {
  1750. [_this select 0, IL_Supported_Cargo_NonVeh_CHINOOK] call IL_Do_Load;
  1751. },[],IL_Action_LU_Priority,true,true,"",
  1752. "(count(nearestObjects[ _target modelToWorld [0,-9,-3], IL_Supported_Cargo_NonVeh_CHINOOK, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ani_ramp' == 1)"
  1753. ];
  1754. _obj_main addAction [
  1755. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on Chinook</t>",
  1756. {
  1757. [_this select 0, IL_Supported_Cargo_Veh_CHINOOK] call IL_Do_Load;
  1758. },[],IL_Action_LU_Priority,true,true,"",
  1759. "(count(nearestObjects[ _target modelToWorld [0,-9,-3], IL_Supported_Cargo_Veh_CHINOOK, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ani_ramp' == 1)"
  1760. ];
  1761. _obj_main addAction [
  1762. "<t color=""#007f0e"">Get in Chinook Ride in back</t>",
  1763. {
  1764. (_this select 1) moveInCargo (_this select 0);
  1765. },[],IL_Action_LU_Priority,false,true,"",
  1766. "(_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && ((_target emptyPositions 'cargo') > 0) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ani_ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  1767. ];
  1768. _obj_main addAction [
  1769. "<t color=""#007f0e"">Get in Chinook</t>",
  1770. {
  1771. (_this select 1) setDir (getDir (_this select 0));
  1772. _pos = ([(_this select 0), 4.5, (getDir (_this select 0))] call BIS_fnc_relPos);
  1773. _pos = [_pos select 0, _pos select 1, ((getPosATL (_this select 0)) select 2) + 1];
  1774. (_this select 1) setPosATL _pos;
  1775. },[],IL_Action_LU_Priority,false,true,"",
  1776. "(_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && ((_target emptyPositions 'cargo') > 0) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ani_ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  1777. ];
  1778. _obj_main addAction [
  1779. "<t color=""#ff0000"">Get out Chinook</t>",
  1780. {
  1781. [_this select 0, _this select 1, false] call IL_GetOut;
  1782. },[],IL_Action_LU_Priority,false,true,"",
  1783. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ani_ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  1784. ];
  1785. _obj_main addAction [
  1786. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Eject</t>",
  1787. {
  1788. [_this select 0, _this select 1, true] call IL_GetOut;
  1789. },[],IL_Action_LU_Priority,false,true,"",
  1790. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (((getPosATL _target) select 2) >= IL_Para_Jump_ATL) && (_target animationPhase 'ani_ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  1791. ];
  1792. _obj_main addAction [
  1793. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from Chinook</t>",
  1794. {
  1795. [_this select 0] call IL_Do_Unload;
  1796. },[],IL_Action_LU_Priority,false,true,"",
  1797. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ani_ramp' == 1)"
  1798. ];
  1799. _obj_main addAction [
  1800. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Unload cargo with parachute</t>",
  1801. {
  1802. [_this select 0, true] call IL_Do_Unload;
  1803. },[],IL_Action_LU_Priority,false,true,"",
  1804. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'ani_ramp' == 1)"
  1805. ];
  1806. _obj_main addAction [
  1807. "<img image='IgiLoad\images\unload_all_para.paa' /><t color=""#a50b00""> Unload ALL cargo with parachute</t>",
  1808. {
  1809. while {((_this select 0) getVariable "box_num") != 0} do
  1810. {
  1811. [_this select 0, true] call IL_Do_Unload;
  1812. };
  1813. },[],IL_Action_LU_Priority,false,true,"",
  1814. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'ani_ramp' == 1)"
  1815. ];
  1816. _obj_main addAction [
  1817. "<t color=""#0000ff"">Open cargo ramp in Chinook</t>",
  1818. {
  1819. _this select 0 animatedoor ['ani_ramp', 1];
  1820. _this select 0 animatedoor ['ani_ramp2', 1];
  1821. },[],IL_Action_O_Priority,false,true,"",
  1822. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'ani_ramp' == 0) && (_target getVariable 'can_load')"
  1823. ];
  1824. _obj_main addAction [
  1825. "<t color=""#0000ff"">Close cargo ramp in Chinook</t>",
  1826. {
  1827. _this select 0 animatedoor ['ani_ramp', 0];
  1828. _this select 0 animatedoor ['ani_ramp2', 0];
  1829. },[],IL_Action_O_Priority,false,true,"",
  1830. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'ani_ramp' == 1) && (_target getVariable 'can_load')"
  1831. ];
  1832. };
  1833. if (typeOf _obj_main == "CH_47F") then
  1834. {
  1835. _obj_main addAction [
  1836. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on Chinook</t>",
  1837. {
  1838. [_this select 0, IL_Supported_Cargo_NonVeh_CHINOOK] call IL_Do_Load;
  1839. },[],IL_Action_LU_Priority,true,true,"",
  1840. "(count(nearestObjects[ _target modelToWorld [0,-9,-3], IL_Supported_Cargo_NonVeh_CHINOOK, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ramp' == 1)"
  1841. ];
  1842. _obj_main addAction [
  1843. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on Chinook</t>",
  1844. {
  1845. [_this select 0, IL_Supported_Cargo_Veh_CHINOOK] call IL_Do_Load;
  1846. },[],IL_Action_LU_Priority,true,true,"",
  1847. "(count(nearestObjects[ _target modelToWorld [0,-9,-3], IL_Supported_Cargo_Veh_CHINOOK, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ramp' == 1)"
  1848. ];
  1849. _obj_main addAction [
  1850. "<t color=""#007f0e"">Get in Chinook Ride in back</t>",
  1851. {
  1852. (_this select 1) moveInCargo (_this select 0);
  1853. },[],IL_Action_LU_Priority,false,true,"",
  1854. "(_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && ((_target emptyPositions 'cargo') > 0) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  1855. ];
  1856. _obj_main addAction [
  1857. "<t color=""#007f0e"">Get in Chinook</t>",
  1858. {
  1859. (_this select 1) setDir (getDir (_this select 0));
  1860. _pos = ([(_this select 0), 4.5, (getDir (_this select 0))] call BIS_fnc_relPos);
  1861. _pos = [_pos select 0, _pos select 1, ((getPosATL (_this select 0)) select 2) + 1];
  1862. (_this select 1) setPosATL _pos;
  1863. },[],IL_Action_LU_Priority,false,true,"",
  1864. "(_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && ((_target emptyPositions 'cargo') > 0) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  1865. ];
  1866. _obj_main addAction [
  1867. "<t color=""#ff0000"">Get out Chinook</t>",
  1868. {
  1869. [_this select 0, _this select 1, false] call IL_GetOut;
  1870. },[],IL_Action_LU_Priority,false,true,"",
  1871. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  1872. ];
  1873. _obj_main addAction [
  1874. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Eject</t>",
  1875. {
  1876. [_this select 0, _this select 1, true] call IL_GetOut;
  1877. },[],IL_Action_LU_Priority,false,true,"",
  1878. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (((getPosATL _target) select 2) >= IL_Para_Jump_ATL) && (_target animationPhase 'Ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  1879. ];
  1880. _obj_main addAction [
  1881. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from Chinook</t>",
  1882. {
  1883. [_this select 0] call IL_Do_Unload;
  1884. },[],IL_Action_LU_Priority,false,true,"",
  1885. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ramp' == 1)"
  1886. ];
  1887. _obj_main addAction [
  1888. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Unload cargo with parachute</t>",
  1889. {
  1890. [_this select 0, true] call IL_Do_Unload;
  1891. },[],IL_Action_LU_Priority,false,true,"",
  1892. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'Ramp' == 1)"
  1893. ];
  1894. _obj_main addAction [
  1895. "<img image='IgiLoad\images\unload_all_para.paa' /><t color=""#a50b00""> Unload ALL cargo with parachute</t>",
  1896. {
  1897. while {((_this select 0) getVariable "box_num") != 0} do
  1898. {
  1899. [_this select 0, true] call IL_Do_Unload;
  1900. };
  1901. },[],IL_Action_LU_Priority,false,true,"",
  1902. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'Ramp' == 1)"
  1903. ];
  1904. _obj_main addAction [
  1905. "<t color=""#0000ff"">Open cargo ramp in Chinook</t>",
  1906. {
  1907. _this select 0 animate ['Ramp', 1];
  1908. },[],IL_Action_O_Priority,false,true,"",
  1909. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'Ramp' == 0) && (_target getVariable 'can_load')"
  1910. ];
  1911. _obj_main addAction [
  1912. "<t color=""#0000ff"">Close cargo ramp in Chinook</t>",
  1913. {
  1914. _this select 0 animate ['Ramp', 0];
  1915. },[],IL_Action_O_Priority,false,true,"",
  1916. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'Ramp' == 1) && (_target getVariable 'can_load')"
  1917. ];
  1918. };
  1919. if (typeOf _obj_main in ["kyo_MH47E_HC", "kyo_MH47E_Ramp", "kyo_MH47E_base"]) then
  1920. {
  1921. _obj_main addAction [
  1922. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on Chinook</t>",
  1923. {
  1924. [_this select 0, IL_Supported_Cargo_NonVeh_CHINOOK] call IL_Do_Load;
  1925. },[],IL_Action_LU_Priority,true,true,"",
  1926. "(count(nearestObjects[ _target modelToWorld [0,-9,-3], IL_Supported_Cargo_NonVeh_CHINOOK, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ani_Ramp' < 0.43)"
  1927. ];
  1928. _obj_main addAction [
  1929. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on Chinook</t>",
  1930. {
  1931. [_this select 0, IL_Supported_Cargo_Veh_CHINOOK] call IL_Do_Load;
  1932. },[],IL_Action_LU_Priority,true,true,"",
  1933. "(count(nearestObjects[ _target modelToWorld [0,-9,-3], IL_Supported_Cargo_Veh_CHINOOK, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ani_Ramp' < 0.43)"
  1934. ];
  1935. _obj_main addAction [
  1936. "<t color=""#007f0e"">Get in Chinook Ride in back</t>",
  1937. {
  1938. (_this select 1) moveInCargo (_this select 0);
  1939. },[],IL_Action_LU_Priority,false,true,"",
  1940. "(_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && ((_target emptyPositions 'cargo') > 0) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ani_Ramp' < 0.43) && (_target getVariable 'usable_ramp')"
  1941. ];
  1942. _obj_main addAction [
  1943. "<t color=""#007f0e"">Get in Chinook</t>",
  1944. {
  1945. (_this select 1) setDir (getDir (_this select 0));
  1946. _pos = ([(_this select 0), 4.5, (getDir (_this select 0))] call BIS_fnc_relPos);
  1947. _pos = [_pos select 0, _pos select 1, ((getPosATL (_this select 0)) select 2) + 1];
  1948. (_this select 1) setPosATL _pos;
  1949. },[],IL_Action_LU_Priority,false,true,"",
  1950. "(_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && ((_target emptyPositions 'cargo') > 0) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ani_Ramp' < 0.43) && (_target getVariable 'usable_ramp')"
  1951. ];
  1952. _obj_main addAction [
  1953. "<t color=""#ff0000"">Get out Chinook</t>",
  1954. {
  1955. [_this select 0, _this select 1, false] call IL_GetOut;
  1956. },[],IL_Action_LU_Priority,false,true,"",
  1957. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ani_Ramp' < 0.43) && (_target getVariable 'usable_ramp')"
  1958. ];
  1959. _obj_main addAction [
  1960. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Eject</t>",
  1961. {
  1962. [_this select 0, _this select 1, true] call IL_GetOut;
  1963. },[],IL_Action_LU_Priority,false,true,"",
  1964. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (((getPosATL _target) select 2) >= IL_Para_Jump_ATL) && (_target animationPhase 'Ani_Ramp' < 0.43) && (_target getVariable 'usable_ramp')"
  1965. ];
  1966. _obj_main addAction [
  1967. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from Chinook</t>",
  1968. {
  1969. [_this select 0] call IL_Do_Unload;
  1970. },[],IL_Action_LU_Priority,false,true,"",
  1971. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'Ani_Ramp' < 0.43)"
  1972. ];
  1973. _obj_main addAction [
  1974. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Unload cargo with parachute</t>",
  1975. {
  1976. [_this select 0, true] call IL_Do_Unload;
  1977. },[],IL_Action_LU_Priority,false,true,"",
  1978. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'Ani_Ramp' < 0.43)"
  1979. ];
  1980. _obj_main addAction [
  1981. "<img image='IgiLoad\images\unload_all_para.paa' /><t color=""#a50b00""> Unload ALL cargo with parachute</t>",
  1982. {
  1983. while {((_this select 0) getVariable "box_num") != 0} do
  1984. {
  1985. [_this select 0, true] call IL_Do_Unload;
  1986. };
  1987. },[],IL_Action_LU_Priority,false,true,"",
  1988. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'Ani_Ramp' < 0.43)"
  1989. ];
  1990. _obj_main addAction [
  1991. "<t color=""#0000ff"">Open cargo ramp in Chinook</t>",
  1992. {
  1993. _this select 0 animate ['Ani_Ramp', 0];
  1994. },[],IL_Action_O_Priority,false,true,"",
  1995. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'Ani_Ramp' == 1) && (_target getVariable 'can_load')"
  1996. ];
  1997. _obj_main addAction [
  1998. "<t color=""#0000ff"">Close cargo ramp in Chinook</t>",
  1999. {
  2000. _this select 0 animate ['Ani_Ramp', 1];
  2001. },[],IL_Action_O_Priority,false,true,"",
  2002. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'Ani_Ramp' == 0) && (_target getVariable 'can_load')"
  2003. ];
  2004. };
  2005. _obj_main addAction [
  2006. "<t color=""#0000ff"">Enable loading for Co-Pilot</t>",
  2007. {
  2008. (_this select 0) setVariable["can_copilot", true, true];;
  2009. },[],IL_Action_S_Priority,false,true,"",
  2010. "((driver _target == _this) && !(_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  2011. ];
  2012. _obj_main addAction [
  2013. "<t color=""#0000ff"">Disable loading for Co-Pilot</t>",
  2014. {
  2015. (_this select 0) setVariable["can_copilot", false, true];;
  2016. },[],IL_Action_S_Priority,false,true,"",
  2017. "((driver _target == _this) && (_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  2018. ];
  2019. _obj_main addAction [
  2020. "<t color=""#0000ff"">Enable loading from outside</t>",
  2021. {
  2022. (_this select 0) setVariable["can_outside", true, true];;
  2023. },[],IL_Action_S_Priority,false,true,"",
  2024. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  2025. ];
  2026. _obj_main addAction [
  2027. "<t color=""#0000ff"">Disable loading from outside</t>",
  2028. {
  2029. (_this select 0) setVariable["can_outside", false, true];;
  2030. },[],IL_Action_S_Priority,false,true,"",
  2031. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  2032. ];
  2033. _obj_main addAction [
  2034. "<t color=""#0000ff"">Enable usable ramp</t>",
  2035. {
  2036. (_this select 0) setVariable["usable_ramp", true, true];;
  2037. },[],IL_Action_S_Priority,false,true,"",
  2038. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'usable_ramp') && IL_Ramp)"
  2039. ];
  2040. _obj_main addAction [
  2041. "<t color=""#0000ff"">Disable usable ramp</t>",
  2042. {
  2043. (_this select 0) setVariable["usable_ramp", false, true];;
  2044. },[],IL_Action_S_Priority,false,true,"",
  2045. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'usable_ramp') && IL_Ramp)"
  2046. ];
  2047. };
  2048. if (_obj_main_type in IL_Supported_Vehicles_C130J) then
  2049. {
  2050. if (IL_DevMod) then
  2051. {
  2052. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_C130J.", IL_Script_Inst];
  2053. };
  2054. _vsupported = true;
  2055. [_obj_main] call IL_Init_Veh;
  2056. if (_obj_main_type == "C130J") then
  2057. {
  2058. _obj_main addAction [
  2059. "<t color=""#ff0000"">Get out on the side of ramp</t>",
  2060. {
  2061. [_this select 0, _this select 1, false] call IL_GetOut;
  2062. },[],IL_Action_LU_Priority,false,true,"",
  2063. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ramp_bottom' > 0.43) && (_target getVariable 'usable_ramp')"
  2064. ];
  2065. _obj_main addAction [
  2066. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Eject</t>",
  2067. {
  2068. [_this select 0, _this select 1, true] call IL_GetOut;
  2069. },[],IL_Action_LU_Priority,false,true,"",
  2070. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'ramp_bottom' > 0.9) && (_target getVariable 'usable_ramp')"
  2071. ];
  2072. // "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (((getPosATL _target) select 2) >= IL_Para_Jump_ATL) && (_target animationPhase 'ramp_bottom' < 0.1) && (_target getVariable 'usable_ramp')"
  2073. };
  2074. _obj_main addAction [
  2075. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on C-130J</t>",
  2076. {
  2077. [_this select 0, IL_Supported_Cargo_NonVeh_C130J] call IL_Do_Load;
  2078. },[],IL_Action_LU_Priority,true,true,"",
  2079. "(count(nearestObjects[ _target modelToWorld [0,-9,-5.4], IL_Supported_Cargo_NonVeh_C130J, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-5.4], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ramp_bottom' == 1) && (_target animationPhase 'ramp_top' == 1)"
  2080. ];
  2081. _obj_main addAction [
  2082. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on C-130J</t>",
  2083. {
  2084. [_this select 0, IL_Supported_Cargo_Veh_C130J] call IL_Do_Load;
  2085. },[],IL_Action_LU_Priority,true,true,"",
  2086. "(count(nearestObjects[ _target modelToWorld [0,-9,-5.4], IL_Supported_Cargo_Veh_C130J, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-5.4], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ramp_bottom' == 1) && (_target animationPhase 'ramp_top' == 1)"
  2087. ];
  2088. _obj_main addAction [
  2089. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from C-130J</t>",
  2090. {
  2091. [_this select 0] call IL_Do_Unload;
  2092. },[],IL_Action_LU_Priority,false,true,"",
  2093. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-5.4], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'ramp_bottom' == 1) && (_target animationPhase 'ramp_top' == 1)"
  2094. ];
  2095. _obj_main addAction [
  2096. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Unload cargo with parachute</t>",
  2097. {
  2098. [_this select 0, true] call IL_Do_Unload;
  2099. },[],IL_Action_LU_Priority,false,true,"",
  2100. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'ramp_bottom' == 1) && (_target animationPhase 'ramp_top' == 1)"
  2101. ];
  2102. _obj_main addAction [
  2103. "<img image='IgiLoad\images\unload_all_para.paa' /><t color=""#a50b00""> Unload ALL cargo with parachute</t>",
  2104. {
  2105. while {((_this select 0) getVariable "box_num") != 0} do
  2106. {
  2107. [_this select 0, true] call IL_Do_Unload;
  2108. };
  2109. },[],IL_Action_LU_Priority,false,true,"",
  2110. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'ramp_bottom' == 1) && (_target animationPhase 'ramp_top' == 1)"
  2111. ];
  2112. // _obj_main addAction [
  2113. // "<t color=""#0000ff"">Open lower part of ramp in C-130J</t>",
  2114. // {
  2115. // _this select 0 animate ['ramp_bottom', 1];
  2116. // },[],IL_Action_O_Priority,false,true,"",
  2117. // "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-5.4], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'ramp_bottom' == 0) && (_target getVariable 'can_load')"
  2118. // ];
  2119. // _obj_main addAction [
  2120. // "<t color=""#0000ff"">Close lower part of ramp in C-130J</t>",
  2121. // {
  2122. // _this select 0 animate ['ramp_bottom', 0];
  2123. // },[],IL_Action_O_Priority,false,true,"",
  2124. // "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-9,-5.4], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'ramp_bottom' == 1) && (_target getVariable 'can_load')"
  2125. // ];
  2126. _obj_main addAction [
  2127. "<t color=""#0000ff"">Enable loading for Co-Pilot</t>",
  2128. {
  2129. (_this select 0) setVariable["can_copilot", true, true];;
  2130. },[],IL_Action_S_Priority,false,true,"",
  2131. "((driver _target == _this) && !(_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  2132. ];
  2133. _obj_main addAction [
  2134. "<t color=""#0000ff"">Disable loading for Co-Pilot</t>",
  2135. {
  2136. (_this select 0) setVariable["can_copilot", false, true];;
  2137. },[],IL_Action_S_Priority,false,true,"",
  2138. "((driver _target == _this) && (_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  2139. ];
  2140. _obj_main addAction [
  2141. "<t color=""#0000ff"">Enable loading from outside</t>",
  2142. {
  2143. (_this select 0) setVariable["can_outside", true, true];;
  2144. },[],IL_Action_S_Priority,false,true,"",
  2145. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  2146. ];
  2147. _obj_main addAction [
  2148. "<t color=""#0000ff"">Disable loading from outside</t>",
  2149. {
  2150. (_this select 0) setVariable["can_outside", false, true];;
  2151. },[],IL_Action_S_Priority,false,true,"",
  2152. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  2153. ];
  2154. _obj_main addAction [
  2155. "<t color=""#0000ff"">Enable usable ramp</t>",
  2156. {
  2157. (_this select 0) setVariable["usable_ramp", true, true];;
  2158. },[],IL_Action_S_Priority,false,true,"",
  2159. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'usable_ramp') && IL_Ramp)"
  2160. ];
  2161. _obj_main addAction [
  2162. "<t color=""#0000ff"">Disable usable ramp</t>",
  2163. {
  2164. (_this select 0) setVariable["usable_ramp", false, true];;
  2165. },[],IL_Action_S_Priority,false,true,"",
  2166. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'usable_ramp') && IL_Ramp)"
  2167. ];
  2168. };
  2169. if (_obj_main_type in IL_Supported_Vehicles_C17) then
  2170. {
  2171. if (IL_DevMod) then
  2172. {
  2173. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_C17.", IL_Script_Inst];
  2174. };
  2175. _vsupported = true;
  2176. [_obj_main] call IL_Init_Veh;
  2177. _obj_main addAction [
  2178. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on C17</t>",
  2179. {
  2180. [_this select 0, IL_Supported_Cargo_C17] call IL_Do_Load;
  2181. },[],IL_Action_LU_Priority,true,true,"",
  2182. "(count(nearestObjects[ _target modelToWorld [0,-16.5,-3.2], IL_Supported_Cargo_NonVeh_C17, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-16.5 + IL_SDistL + IL_SDistL_Heli_offset,-2], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'back_ramp' == 1)"
  2183. ];
  2184. _obj_main addAction [
  2185. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on C17</t>",
  2186. {
  2187. [_this select 0, IL_Supported_Cargo_C17] call IL_Do_Load;
  2188. },[],IL_Action_LU_Priority,true,true,"",
  2189. "(count(nearestObjects[ _target modelToWorld [0,-16.5,-3.2], IL_Supported_Cargo_Veh_C17, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-16.5 + IL_SDistL + IL_SDistL_Heli_offset,-2], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'back_ramp' == 1)"
  2190. ];
  2191. _obj_main addAction [
  2192. "<t color=""#007f0e"">Get in C17</t>",
  2193. {
  2194. (_this select 1) moveInCargo (_this select 0);
  2195. },[],IL_Action_LU_Priority,false,true,"",
  2196. "(_this in (nearestObjects[ _target modelToWorld [0,-16.5 + IL_SDistL + IL_SDistL_Heli_offset,-2], [], IL_SDistL + IL_SDistL_Heli_offset])) && ((_target emptyPositions 'cargo') > 0) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'back_ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  2197. ];
  2198. _obj_main addAction [
  2199. "<t color=""#ff0000"">Get out C17</t>",
  2200. {
  2201. [_this select 0, _this select 1, false] call IL_GetOut;
  2202. },[],IL_Action_LU_Priority,false,true,"",
  2203. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'back_ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  2204. ];
  2205. _obj_main addAction [
  2206. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Eject</t>",
  2207. {
  2208. [_this select 0, _this select 1, true] call IL_GetOut;
  2209. },[],IL_Action_LU_Priority,false,true,"",
  2210. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'back_ramp' > 0.43) && (_target getVariable 'usable_ramp')"
  2211. ];
  2212. _obj_main addAction [
  2213. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from C17</t>",
  2214. {
  2215. [_this select 0] call IL_Do_Unload;
  2216. },[],IL_Action_LU_Priority,false,true,"",
  2217. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-16.5 + IL_SDistL + IL_SDistL_Heli_offset,-2], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt) && (_target animationPhase 'back_ramp' == 1)"
  2218. ];
  2219. _obj_main addAction [
  2220. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Unload cargo with parachute</t>",
  2221. {
  2222. [_this select 0, true] call IL_Do_Unload;
  2223. },[],IL_Action_LU_Priority,false,true,"",
  2224. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'back_ramp' == 1)"
  2225. ];
  2226. _obj_main addAction [
  2227. "<img image='IgiLoad\images\unload_all_para.paa' /><t color=""#a50b00""> Unload ALL cargo with parachute</t>",
  2228. {
  2229. while {((_this select 0) getVariable "box_num") != 0} do
  2230. {
  2231. [_this select 0, true] call IL_Do_Unload;
  2232. };
  2233. },[],IL_Action_LU_Priority,false,true,"",
  2234. "(_target getVariable 'box_num' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL) && (_target animationPhase 'back_ramp' == 1)"
  2235. ];
  2236. _obj_main addAction [
  2237. "<t color=""#0000ff"">Open cargo doors in C17</t>",
  2238. {
  2239. _this select 0 animate ['back_ramp', 1];
  2240. _this select 0 animate ['back_ramp_door_main', 1];
  2241. _this select 0 animate ['back_ramp_st', 1];
  2242. },[],IL_Action_O_Priority,false,true,"",
  2243. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-16.5 + IL_SDistL + IL_SDistL_Heli_offset,-2], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'back_ramp' == 0) && (_target getVariable 'can_load')"
  2244. ];
  2245. _obj_main addAction [
  2246. "<t color=""#0000ff"">Close cargo doors in C17</t>",
  2247. {
  2248. _this select 0 animate ['back_ramp_st', 0];
  2249. _this select 0 animate ['back_ramp', 0];
  2250. _this select 0 animate ['back_ramp_door_main', 0];
  2251. },[],IL_Action_O_Priority,false,true,"",
  2252. "((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || ((_this in (nearestObjects[ _target modelToWorld [0,-16.5 + IL_SDistL + IL_SDistL_Heli_offset,-2], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside'))) && (_target animationPhase 'back_ramp' == 1) && (_target getVariable 'can_load')"
  2253. ];
  2254. _obj_main addAction [
  2255. "<t color=""#0000ff"">Enable loading for Co-Pilot</t>",
  2256. {
  2257. (_this select 0) setVariable["can_copilot", true, true];;
  2258. },[],IL_Action_S_Priority,false,true,"",
  2259. "((driver _target == _this) && !(_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  2260. ];
  2261. _obj_main addAction [
  2262. "<t color=""#0000ff"">Disable loading for Co-Pilot</t>",
  2263. {
  2264. (_this select 0) setVariable["can_copilot", false, true];;
  2265. },[],IL_Action_S_Priority,false,true,"",
  2266. "((driver _target == _this) && (_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  2267. ];
  2268. _obj_main addAction [
  2269. "<t color=""#0000ff"">Enable loading from outside</t>",
  2270. {
  2271. (_this select 0) setVariable["can_outside", true, true];;
  2272. },[],IL_Action_S_Priority,false,true,"",
  2273. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  2274. ];
  2275. _obj_main addAction [
  2276. "<t color=""#0000ff"">Disable loading from outside</t>",
  2277. {
  2278. (_this select 0) setVariable["can_outside", false, true];;
  2279. },[],IL_Action_S_Priority,false,true,"",
  2280. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  2281. ];
  2282. _obj_main addAction [
  2283. "<t color=""#0000ff"">Enable usable ramp</t>",
  2284. {
  2285. (_this select 0) setVariable["usable_ramp", true, true];;
  2286. },[],IL_Action_S_Priority,false,true,"",
  2287. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'usable_ramp') && IL_Ramp)"
  2288. ];
  2289. _obj_main addAction [
  2290. "<t color=""#0000ff"">Disable usable ramp</t>",
  2291. {
  2292. (_this select 0) setVariable["usable_ramp", false, true];;
  2293. },[],IL_Action_S_Priority,false,true,"",
  2294. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'usable_ramp') && IL_Ramp)"
  2295. ];
  2296. };
  2297. if (_obj_main_type in IL_Supported_Vehicles_MH9) then
  2298. {
  2299. if (IL_DevMod) then
  2300. {
  2301. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_MH9.", IL_Script_Inst];
  2302. };
  2303. _vsupported = true;
  2304. [_obj_main] call IL_Init_Veh;
  2305. _obj_main addAction [
  2306. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on left MH-9</t>",
  2307. {
  2308. [_this select 0, IL_Supported_Cargo_MH9, "L"] call IL_Do_Load;
  2309. },[],IL_Action_LU_Priority,true,true,"",
  2310. "(count (nearestObjects[ _target modelToWorld [0-3,1,-1.3], IL_Supported_Cargo_MH9, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || (((_this in (nearestObjects[ _target modelToWorld [0-3,1,-1.3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num_l' > _target getVariable 'slots_num_l') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt)"
  2311. ];
  2312. _obj_main addAction [
  2313. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on right MH-9</t>",
  2314. {
  2315. [_this select 0, IL_Supported_Cargo_MH9, "R"] call IL_Do_Load;
  2316. },[],IL_Action_LU_Priority,true,true,"",
  2317. "(count (nearestObjects[ _target modelToWorld [0+3,1,-1.3], IL_Supported_Cargo_MH9, IL_SDistL + IL_SDistL_Heli_offset]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || (((_this in (nearestObjects[ _target modelToWorld [0+3,1,-1.3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num_r' > _target getVariable 'slots_num_r') && (_target getVariable 'can_load') && (((getPos _target) select 2) <= IL_LU_Alt)"
  2318. ];
  2319. _obj_main addAction [
  2320. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from left MH-9</t>",
  2321. {
  2322. [_this select 0, false, "L"] call IL_Do_Unload;
  2323. },[],IL_Action_LU_Priority,false,true,"",
  2324. "(_target getVariable 'box_num_l' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || (((_this in (nearestObjects[ _target modelToWorld [0-3,1,-1.3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt)"
  2325. ];
  2326. _obj_main addAction [
  2327. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from right MH-9</t>",
  2328. {
  2329. [_this select 0, false, "R"] call IL_Do_Unload;
  2330. },[],IL_Action_LU_Priority,false,true,"",
  2331. "(_target getVariable 'box_num_r' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (IL_Can_Inside && ('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot')) || (((_this in (nearestObjects[ _target modelToWorld [0+3,1,-1.3], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed) && (((getPos _target) select 2) <= IL_LU_Alt)"
  2332. ];
  2333. ///////////////////////////
  2334. _obj_main addAction [
  2335. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Unload cargo with parachute left MH-9</t>",
  2336. {
  2337. [_this select 0, true, "L"] call IL_Do_Unload;
  2338. },[],IL_Action_LU_Priority,false,true,"",
  2339. "(_target getVariable 'box_num_l' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL)"
  2340. ];
  2341. _obj_main addAction [
  2342. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Unload cargo with parachute right MH-9</t>",
  2343. {
  2344. [_this select 0, true, "R"] call IL_Do_Unload;
  2345. },[],IL_Action_LU_Priority,false,true,"",
  2346. "(_target getVariable 'box_num_r' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL)"
  2347. ];
  2348. _obj_main addAction [
  2349. "<img image='IgiLoad\images\unload_all_para.paa' /><t color=""#a50b00""> Unload ALL cargo with parachute</t>",
  2350. {
  2351. [_this select 0, true, "L"] call IL_Do_Unload;
  2352. [_this select 0, true, "R"] call IL_Do_Unload;
  2353. },[],IL_Action_LU_Priority,false,true,"",
  2354. "(_target getVariable 'box_num_r' < 0) && (_target getVariable 'box_num_l' < 0) && ((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_load') && (((getPosATL _target) select 2) >= IL_Para_Drop_ATL)"
  2355. ];
  2356. _obj_main addAction [
  2357. "<img image='IgiLoad\images\unload_para.paa' /><t color=""#b200ff""> Eject</t>",
  2358. {
  2359. [_this select 0, _this select 1, true] call IL_GetOut;
  2360. },[],IL_Action_LU_Priority,false,true,"",
  2361. "('cargo' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (((getPosATL _target) select 2) >= IL_Para_Jump_ATL) && (_target getVariable 'usable_ramp')"
  2362. ];
  2363. //////////////////////////////////////////////////
  2364. _obj_main addAction [
  2365. "<t color=""#0000ff"">Enable loading for Co-Pilot</t>",
  2366. {
  2367. (_this select 0) setVariable["can_copilot", true, true];;
  2368. },[],IL_Action_S_Priority,false,true,"",
  2369. "((driver _target == _this) && !(_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  2370. ];
  2371. _obj_main addAction [
  2372. "<t color=""#0000ff"">Disable loading for Co-Pilot</t>",
  2373. {
  2374. (_this select 0) setVariable["can_copilot", false, true];;
  2375. },[],IL_Action_S_Priority,false,true,"",
  2376. "((driver _target == _this) && (_target getVariable 'can_copilot') && IL_Can_CoPilot)"
  2377. ];
  2378. _obj_main addAction [
  2379. "<t color=""#0000ff"">Enable loading from outside</t>",
  2380. {
  2381. (_this select 0) setVariable["can_outside", true, true];;
  2382. },[],IL_Action_S_Priority,false,true,"",
  2383. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  2384. ];
  2385. _obj_main addAction [
  2386. "<t color=""#0000ff"">Disable loading from outside</t>",
  2387. {
  2388. (_this select 0) setVariable["can_outside", false, true];;
  2389. },[],IL_Action_S_Priority,false,true,"",
  2390. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  2391. ];
  2392. //////////////////////
  2393. _obj_main addAction [
  2394. "<t color=""#0000ff"">Enable usable ramp</t>",
  2395. {
  2396. (_this select 0) setVariable["usable_ramp", true, true];;
  2397. },[],IL_Action_S_Priority,false,true,"",
  2398. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && !(_target getVariable 'usable_ramp') && IL_Ramp)"
  2399. ];
  2400. _obj_main addAction [
  2401. "<t color=""#0000ff"">Disable usable ramp</t>",
  2402. {
  2403. (_this select 0) setVariable["usable_ramp", false, true];;
  2404. },[],IL_Action_S_Priority,false,true,"",
  2405. "(((driver _target == _this) || (('Turret' in (assignedVehicleRole _this)) && (vehicle _this == _target) && (_target getVariable 'can_copilot'))) && (_target getVariable 'usable_ramp') && IL_Ramp)"
  2406. ];
  2407. /////////////////////////
  2408. };
  2409. if (_obj_main_type in IL_Supported_Vehicles_OFFROAD) then
  2410. {
  2411. if (IL_DevMod) then
  2412. {
  2413. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_OFFROAD.", IL_Script_Inst];
  2414. };
  2415. _vsupported = true;
  2416. [_obj_main] call IL_Init_Veh;
  2417. _obj_main addAction [
  2418. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on Offroad</t>",
  2419. {
  2420. [_this select 0, IL_Supported_Cargo_NonVeh_OFFROAD] call IL_Do_Load;
  2421. },[],IL_Action_LU_Priority,true,true,"",
  2422. "(count(nearestObjects[ _target modelToWorld [0,-4.5,0], IL_Supported_Cargo_NonVeh_OFFROAD, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || ((((_this in (nearestObjects[ _target modelToWorld [0,-4.5,0], [], IL_SDistL + IL_SDistL_Heli_offset]))) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2423. ];
  2424. _obj_main addAction [
  2425. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on Offroad</t>",
  2426. {
  2427. [_this select 0, IL_Supported_Cargo_Veh_OFFROAD] call IL_Do_Load;
  2428. },[],IL_Action_LU_Priority,true,true,"",
  2429. "(count(nearestObjects[ _target modelToWorld [0,-4.5,0], IL_Supported_Cargo_Veh_OFFROAD, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || ((((_this in (nearestObjects[ _target modelToWorld [0,-4.5,0], [], IL_SDistL + IL_SDistL_Heli_offset]))) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2430. ];
  2431. _obj_main addAction [
  2432. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from Offroad</t>",
  2433. {
  2434. [_this select 0] call IL_Do_Unload;
  2435. },[],IL_Action_LU_Priority,false,true,"",
  2436. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (((_this in (nearestObjects[ _target modelToWorld [0,-4.5,0], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed)"
  2437. ];
  2438. _obj_main addAction [
  2439. "<t color=""#0000ff"">Enable loading from outside</t>",
  2440. {
  2441. (_this select 0) setVariable["can_outside", true, true];;
  2442. },[],IL_Action_S_Priority,false,true,"",
  2443. "((driver _target == _this) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  2444. ];
  2445. _obj_main addAction [
  2446. "<t color=""#0000ff"">Disable loading from outside</t>",
  2447. {
  2448. (_this select 0) setVariable["can_outside", false, true];;
  2449. },[],IL_Action_S_Priority,false,true,"",
  2450. "((driver _target == _this) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  2451. ];
  2452. };
  2453. if (_obj_main_type in IL_Supported_Vehicles_VAN) then
  2454. {
  2455. if (IL_DevMod) then
  2456. {
  2457. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_VAN.", IL_Script_Inst];
  2458. };
  2459. _vsupported = true;
  2460. [_obj_main] call IL_Init_Veh;
  2461. _obj_main addAction [
  2462. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on VAN</t>",
  2463. {
  2464. [_this select 0, IL_Supported_Cargo_NonVeh_VAN] call IL_Do_Load;
  2465. },[],IL_Action_LU_Priority,true,true,"",
  2466. "(count(nearestObjects[ _target modelToWorld [0,-4.5,0], IL_Supported_Cargo_NonVeh_VAN, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || ((((_this in (nearestObjects[ _target modelToWorld [0,-4.5,0], [], IL_SDistL + IL_SDistL_Heli_offset]))) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2467. ];
  2468. _obj_main addAction [
  2469. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on VAN</t>",
  2470. {
  2471. [_this select 0, IL_Supported_Cargo_Veh_VAN] call IL_Do_Load;
  2472. },[],IL_Action_LU_Priority,true,true,"",
  2473. "(count(nearestObjects[ _target modelToWorld [0,-4.5,0], IL_Supported_Cargo_Veh_VAN, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || ((((_this in (nearestObjects[ _target modelToWorld [0,-4.5,0], [], IL_SDistL + IL_SDistL_Heli_offset]))) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2474. ];
  2475. _obj_main addAction [
  2476. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from VAN</t>",
  2477. {
  2478. [_this select 0] call IL_Do_Unload;
  2479. },[],IL_Action_LU_Priority,false,true,"",
  2480. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (((_this in (nearestObjects[ _target modelToWorld [0,-4.5,0], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed)"
  2481. ];
  2482. _obj_main addAction [
  2483. "<t color=""#0000ff"">Enable loading from outside</t>",
  2484. {
  2485. (_this select 0) setVariable["can_outside", true, true];;
  2486. },[],IL_Action_S_Priority,false,true,"",
  2487. "((driver _target == _this) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  2488. ];
  2489. _obj_main addAction [
  2490. "<t color=""#0000ff"">Disable loading from outside</t>",
  2491. {
  2492. (_this select 0) setVariable["can_outside", false, true];;
  2493. },[],IL_Action_S_Priority,false,true,"",
  2494. "((driver _target == _this) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  2495. ];
  2496. };
  2497. if (_obj_main_type in IL_Supported_Vehicles_KAMAZ) then
  2498. {
  2499. if (IL_DevMod) then
  2500. {
  2501. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_KAMAZ.", IL_Script_Inst];
  2502. };
  2503. _vsupported = true;
  2504. [_obj_main] call IL_Init_Veh;
  2505. _obj_main addAction [
  2506. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on ZAMAK</t>",
  2507. {
  2508. [_this select 0, IL_Supported_Cargo_NonVeh_Kamaz] call IL_Do_Load;
  2509. },[],IL_Action_LU_Priority,true,true,"",
  2510. "(count(nearestObjects[ _target modelToWorld [0,-6 - (_target getVariable 'load_offset'),0], IL_Supported_Cargo_NonVeh_Kamaz, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || ((((_this in (nearestObjects[ _target modelToWorld [0,-6 - (_target getVariable 'load_offset'),0], [], IL_SDistL + IL_SDistL_Heli_offset]))) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2511. ];
  2512. _obj_main addAction [
  2513. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on ZAMAK</t>",
  2514. {
  2515. [_this select 0, IL_Supported_Cargo_Veh_Kamaz] call IL_Do_Load;
  2516. },[],IL_Action_LU_Priority,true,true,"",
  2517. "(count(nearestObjects[ _target modelToWorld [0,-6 - (_target getVariable 'load_offset'),0], IL_Supported_Cargo_Veh_Kamaz, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || ((((_this in (nearestObjects[ _target modelToWorld [0,-6 - (_target getVariable 'load_offset'),0], [], IL_SDistL + IL_SDistL_Heli_offset]))) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2518. ];
  2519. _obj_main addAction [
  2520. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from ZAMAK</t>",
  2521. {
  2522. [_this select 0] call IL_Do_Unload;
  2523. },[],IL_Action_LU_Priority,false,true,"",
  2524. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (((_this in (nearestObjects[ _target modelToWorld [0,-6 - (_target getVariable 'load_offset'),0], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed)"
  2525. ];
  2526. _obj_main addAction [
  2527. "<t color=""#0000ff"">Enable loading from outside</t>",
  2528. {
  2529. (_this select 0) setVariable["can_outside", true, true];;
  2530. },[],IL_Action_S_Priority,false,true,"",
  2531. "((driver _target == _this) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  2532. ];
  2533. _obj_main addAction [
  2534. "<t color=""#0000ff"">Disable loading from outside</t>",
  2535. {
  2536. (_this select 0) setVariable["can_outside", false, true];;
  2537. },[],IL_Action_S_Priority,false,true,"",
  2538. "((driver _target == _this) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  2539. ];
  2540. };
  2541. if (_obj_main_type in IL_Supported_Vehicles_TEMPEST) then
  2542. {
  2543. if (IL_DevMod) then
  2544. {
  2545. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_TEMPEST.", IL_Script_Inst];
  2546. };
  2547. _vsupported = true;
  2548. [_obj_main] call IL_Init_Veh;
  2549. _obj_main addAction [
  2550. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on TEMPEST</t>",
  2551. {
  2552. [_this select 0, IL_Supported_Cargo_NonVeh_TEMPEST] call IL_Do_Load;
  2553. },[],IL_Action_LU_Priority,true,true,"",
  2554. "(count(nearestObjects[ _target modelToWorld [0,-6.5 - (_target getVariable 'load_offset'),0], IL_Supported_Cargo_NonVeh_TEMPEST, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || ((((_this in (nearestObjects[ _target modelToWorld [0,-6.5 - (_target getVariable 'load_offset'),0], [], IL_SDistL + IL_SDistL_Heli_offset]))) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2555. ];
  2556. _obj_main addAction [
  2557. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on TEMPEST</t>",
  2558. {
  2559. [_this select 0, IL_Supported_Cargo_Veh_TEMPEST] call IL_Do_Load;
  2560. },[],IL_Action_LU_Priority,true,true,"",
  2561. "(count(nearestObjects[ _target modelToWorld [0,-6.5 - (_target getVariable 'load_offset'),0], IL_Supported_Cargo_Veh_TEMPEST, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || ((((_this in (nearestObjects[ _target modelToWorld [0,-6.5 - (_target getVariable 'load_offset'),0], [], IL_SDistL + IL_SDistL_Heli_offset]))) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2562. ];
  2563. _obj_main addAction [
  2564. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from TEMPEST</t>",
  2565. {
  2566. [_this select 0] call IL_Do_Unload;
  2567. },[],IL_Action_LU_Priority,false,true,"",
  2568. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (((_this in (nearestObjects[ _target modelToWorld [0,-6.5 - (_target getVariable 'load_offset'),0], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed)"
  2569. ];
  2570. _obj_main addAction [
  2571. "<t color=""#0000ff"">Enable loading from outside</t>",
  2572. {
  2573. (_this select 0) setVariable["can_outside", true, true];;
  2574. },[],IL_Action_S_Priority,false,true,"",
  2575. "((driver _target == _this) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  2576. ];
  2577. _obj_main addAction [
  2578. "<t color=""#0000ff"">Disable loading from outside</t>",
  2579. {
  2580. (_this select 0) setVariable["can_outside", false, true];;
  2581. },[],IL_Action_S_Priority,false,true,"",
  2582. "((driver _target == _this) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  2583. ];
  2584. };
  2585. if (_obj_main_type in IL_Supported_Vehicles_HEMTT) then
  2586. {
  2587. if (IL_DevMod) then
  2588. {
  2589. Player globalChat Format["IgiLoad ""%1"" Vehicle is in IL_Supported_Vehicles_HEMTT.", IL_Script_Inst];
  2590. };
  2591. _vsupported = true;
  2592. [_obj_main] call IL_Init_Veh;
  2593. _obj_main addAction [
  2594. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load cargo on HEMTT</t>",
  2595. {
  2596. [_this select 0, IL_Supported_Cargo_NonVeh_HEMTT] call IL_Do_Load;
  2597. },[],IL_Action_LU_Priority,true,true,"",
  2598. "(count(nearestObjects[ _target modelToWorld [0,-7 - (_target getVariable 'load_offset'),0], IL_Supported_Cargo_NonVeh_HEMTT, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (((_this in (nearestObjects[ _target modelToWorld [0,-7 - (_target getVariable 'load_offset'),0], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2599. ];
  2600. _obj_main addAction [
  2601. "<img image='IgiLoad\images\load.paa' /><t color=""#007f0e""> Load vehicle on HEMTT</t>",
  2602. {
  2603. [_this select 0, IL_Supported_Cargo_Veh_HEMTT] call IL_Do_Load;
  2604. },[],IL_Action_LU_Priority,true,true,"",
  2605. "(count(nearestObjects[ _target modelToWorld [0,-7 - (_target getVariable 'load_offset'),0], IL_Supported_Cargo_Veh_HEMTT, IL_SDistL]) > 0) && (abs(speed _target) <= IL_LU_Speed) && ((IL_Can_Inside && (driver _target == _this)) || (((_this in (nearestObjects[ _target modelToWorld [0,-7 - (_target getVariable 'load_offset'),0], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'box_num' > _target getVariable 'slots_num') && (_target getVariable 'can_load')"
  2606. ];
  2607. _obj_main addAction [
  2608. "<img image='IgiLoad\images\unload.paa' /><t color=""#ff0000""> Unload cargo from HEMTT</t>",
  2609. {
  2610. [_this select 0] call IL_Do_Unload;
  2611. },[],IL_Action_LU_Priority,false,true,"",
  2612. "(_target getVariable 'box_num' < 0) && ((IL_Can_Inside && (driver _target == _this)) || (((_this in (nearestObjects[ _target modelToWorld [0,-7 - (_target getVariable 'load_offset'),0], [], IL_SDistL + IL_SDistL_Heli_offset])) && (_target getVariable 'can_outside')))) && (_target getVariable 'can_load') && (abs(speed _target) <= IL_LU_Speed)"
  2613. ];
  2614. _obj_main addAction [
  2615. "<t color=""#0000ff"">Enable loading from outside</t>",
  2616. {
  2617. (_this select 0) setVariable["can_outside", true, true];;
  2618. },[],IL_Action_S_Priority,false,true,"",
  2619. "((driver _target == _this) && !(_target getVariable 'can_outside') && IL_Can_Outside)"
  2620. ];
  2621. _obj_main addAction [
  2622. "<t color=""#0000ff"">Disable loading from outside</t>",
  2623. {
  2624. (_this select 0) setVariable["can_outside", false, true];;
  2625. },[],IL_Action_S_Priority,false,true,"",
  2626. "((driver _target == _this) && (_target getVariable 'can_outside') && IL_Can_Outside)"
  2627. ];
  2628. };
  2629. if (!(_vsupported) && (IL_DevMod)) then
  2630. {
  2631. Player globalChat Format["Object type: ""%1"" is not supported.", _obj_main_type];
  2632. };
  2633. if (IL_DevMod) then
  2634. {
  2635. Player globalChat Format["IgiLoad ""%1"" END.", IL_Script_Inst];
  2636. };
  2637. // EOF