PHP Code:
// Spawn random group (with random units) and spawn drop heli to go to marker to paradrop and set group on upsmon patrol or otherwise and send heli back and delete it after drop is complete.
// execute with _null = ["anymarker","land_or_para","what_type_units",number_minimum_units] execVM "spawns\parareinf.sqf";
// example: _null = ["patrolmarker","land","usghillie",3] execVM "spawns\parareinf.sqf";
// name of script: parareinf.sqf placed in spawns folder in mission folder - this is ParaReinforce version 1.1.
_upsmonInUse = 1; // 1=yes, 0=no - if you use upsmon for paratroopers, script will do alternative way with marker to have heli wp work without extra marker.
_Arma2Version = 2; // what versions Arma used - 0=arma2 only - 1=OA only - 2=Arma2 and OA(CO)
_flybyRange = 2500; // set how far away from the paradrop marker flyby will be done at.
_flyInHeight = 150; // the height heli will fly in, if any hills present on map above 200 is recomended minimum best all round use in Takistan is 250 for big helis acording to tests, until heli AI flying is fixed by BIS.
_spawnmarker = "spawnhill"; // editor placed empty marker far off side in map in editor away from player and action - for the insert group, cannot be in water.
_chancerest = 0.50; // percent of wich rest units of same array is spawned.
_rangeWP = 200; // this is default random para or lz wp range from patrol area/marker center.
_debugMode = false; // set this to true if you want debug mode on, meaning hints will be displayed, can also use "debug" in initline to only debug selected parareinf.ssqf.
// select random start location for drophelo from editor placed empty markers. 0 is first marker, you can have only 1 or as many as you want.
_random = floor(random 5); // create a random number based on amount of heli spawn markers, so if you have 10 markers, number put here is 9, if you have only 1 marker number is 0.
_spawn = ["helispawn1", "helispawn2", "helispawn3", "helispawn4", "helispawn5"] select _random;
// DO NOT MODIFY BELOW THIS LINE ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_grppatrolmarker = _this select 0; // marker the paras should patrol, now same as heli wp and heli flyby wp.
_insertionType = _this select 1; // choose what type of insertion - para=paradrop - land=ground insertion(land and get out for paragroup).
_faction = _this select 2; // what type of units to be spawned, heli will match side.
_minSold = _this select 3; // number of units minimum, if not defined, random 4 is minimum, 50 % rest in faction.
_side = east; // variabel declared so it will work in lower scripts. side is modified down in script based on choosen in initline.
_group = 0; // variabel declared so it will work in lower scripts. group is modified down in script based on choosen in initline.
_helitypeUsed = ""; // variabel declared so it will work in lower scripts. heli is modified down in script based on choosen / or group size in initline.
_emergency = 0; // if 1 high rate of eject on paras, if 0 then normal.
_units = []; // empty array ready for random troops.
_snipergrp = false; // used to set appropriate wp if ghillie sniper units selected.
_OAgrp = false; // if OA units selected.
_A2grp = false; // if A2 units selected.
_BAFgrp = false; // if BAF units selected.
_chooseRandom = 0; // prepare so random faction selection works.
waituntil {!isnil "bis_fnc_init"}; //is function module active?, if not wait for function module to be activated.
if (isServer) then {
// activate debug mode ifdebug param used in execute line.
if ("debug" in _this) then {
if (_debugMode) then {
hint "debug mode is already set to true in parareinf.sqf, no need to use param in execute line";
sleep 10;
} else {
_debugMode = true;
hint "debug activating";
sleep 5;
if (_debugMode) then {hint "debugmode activated"};
};
};
// if marker not defined correctly or error in spelling name exit script and display hint to player.
if (isNil ("_grppatrolmarker")) exitwith {hint "marker isnil or marker not defined correctly or not existing, script will now END"};
// if minimum amount units is specified or not.
if (isNil ("_minSold")) then {
_minSold = ceil(random 4);
if (_debugMode) then {hint "no size manually set, auto minimum set at random 4"; sleep 1;}; // for debug.
} else {
if (_debugMode) then {hint "size was manually set, no change"; sleep 1;}; // for debug.
};
// decide wich type units were selected.
// if random faction selection OA + A2.
if (_faction == "random") then {
_chooseRandom = floor(random 3);
_faction = ["blue", "red", "guer"] select _chooseRandom;
};
if (_faction == "blue") then {
if (_Arma2Version == 0) then {
_chooseRandom = floor(random 5);
_faction = ["CDFtroops", "CDFghillie", "usmcspecial", "usmctroops", "usmcghillie"] select _chooseRandom;
};
if (_Arma2Version == 1) then {
_chooseRandom = floor(random 3);
_faction = ["usghillie", "usspecial", "ustroops"] select _chooseRandom;
};
if (_Arma2Version == 2) then {
_chooseRandom = floor(random 8);
_faction = ["usghillie", "usspecial", "ustroops", "CDFtroops", "CDFghillie", "usmcspecial", "usmctroops", "usmcghillie"] select _chooseRandom;
};
};
if (_faction == "red") then {
if (_Arma2Version == 0) then {
_chooseRandom = floor(random 6);
_faction = ["insurgents", "insurgentsplain", "ruspecial", "ruspetsnaz", "rutroops", "rughillie"] select _chooseRandom;
};
if (_Arma2Version == 1) then {
_chooseRandom = floor(random 4);
_faction = ["taghillie", "taspecial", "tatroops", "tamilitia"] select _chooseRandom;
};
if (_Arma2Version == 2) then {
_chooseRandom = floor(random 10);
_faction = ["taghillie", "taspecial", "tatroops", "tamilitia", "insurgents", "insurgentsplain", "ruspecial", "ruspetsnaz", "rutroops", "rughillie"] select _chooseRandom;
};
};
if (_faction == "guer") then {
if (_Arma2Version == 0) then {
_chooseRandom = floor(random 3);
_faction = ["guerillas", "guerillasplain", "guerillaghillie"] select _chooseRandom;
};
if (_Arma2Version == 1) then {
_faction = "guermilitia"
};
if (_Arma2Version == 2) then {
_chooseRandom = floor(random 4);
_faction = ["guerillas", "guerillasplain", "guerillaghillie", "guermilitia"] select _chooseRandom;
};
};
// specific OA or A2 version side random selection.
if (_faction == "OAblue") then {
_chooseRandom = floor(random 3);
_faction = ["usghillie", "usspecial", "ustroops"] select _chooseRandom;
};
if (_faction == "A2blue") then {
_chooseRandom = floor(random 5);
_faction = ["CDFtroops", "CDFghillie", "usmcspecial", "usmctroops", "usmcghillie"] select _chooseRandom;
};
if (_faction == "OAred") then {
_chooseRandom = floor(random 4);
_faction = ["taghillie", "taspecial", "tatroops", "tamilitia"] select _chooseRandom;
};
if (_faction == "A2red") then {
_chooseRandom = floor(random 6);
_faction = ["insurgents", "insurgentsplain", "ruspecial", "ruspetsnaz", "rutroops", "rughillie"] select _chooseRandom;
};
if (_faction == "OAguer") then {
_faction = "guermilitia"
};
if (_faction == "A2guer") then {
_chooseRandom = floor(random 3);
_faction = ["guerillas", "guerillasplain", "guerillaghillie"] select _chooseRandom;
};
if (_faction == "BAF") then {
_chooseRandom = floor(random 5);
_faction = ["bafmulticam", "bafdesghillie", "bafdesert", "bafwoodland", "bafwoodghillie"] select _chooseRandom;
};
// OA units
if (_faction == "tamilitia") then {
_side = east;
_group = 0;
_OAgrp = true;
};
if (_faction == "tatroops") then {
_side = east;
_group = 1;
_OAgrp = true;
};
if (_faction == "taspecial") then {
_side = east;
_group = 2;
_OAgrp = true;
};
if (_faction == "taghillie") then {
_snipergrp = true;
_side = east;
_group = 3;
_OAgrp = true;
};
if (_faction == "ustroops") then {
_side = west;
_group = 4;
_OAgrp = true;
};
if (_faction == "usspecial") then {
_side = west;
_group = 5;
_OAgrp = true;
};
if (_faction == "usghillie") then {
_snipergrp = true;
_side = west;
_group = 6;
_OAgrp = true;
};
if (_faction == "guermilitia") then {
_side = resistance;
_group = 7;
_OAgrp = true;
};
// Arma 2 units
if (_faction == "CDFtroops") then {
_side = west;
_group = 8;
_A2grp = true;
};
if (_faction == "CDFghillie") then {
_snipergrp = true;
_side = west;
_group = 9;
_A2grp = true;
};
if (_faction == "usmcspecial") then {
_side = west;
_group = 10;
_A2grp = true;
};
if (_faction == "usmctroops") then {
_side = west;
_group = 11;
_A2grp = true;
};
if (_faction == "usmcghillie") then {
_snipergrp = true;
_side = west;
_group = 12;
_A2grp = true;
};
if (_faction == "insurgents") then {
_side = east;
_group = 13;
_A2grp = true;
};
if (_faction == "insurgentsplain") then {
_side = east;
_group = 14;
_A2grp = true;
};
if (_faction == "ruspecial") then {
_side = east;
_group = 15;
_A2grp = true;
};
if (_faction == "ruspetsnaz") then {
_side = east;
_group = 16;
_A2grp = true;
};
if (_faction == "rutroops") then {
_side = east;
_group = 17;
_A2grp = true;
};
if (_faction == "rughillie") then {
_snipergrp = true;
_side = east;
_group = 18;
_A2grp = true;
};
if (_faction == "guerillas") then {
_side = resistance;
_group = 19;
_A2grp = true;
};
if (_faction == "guerillasplain") then {
_side = resistance;
_group = 20;
_A2grp = true;
};
if (_faction == "guerillaghillie") then {
_snipergrp = true;
_side = resistance;
_group = 21;
_A2grp = true;
};
// BAF units
if (_faction == "bafmulticam") then {
_side = west;
_group = 22;
_BAFgrp = true;
};
if (_faction == "bafdesghillie") then {
_snipergrp = true;
_side = west;
_group = 23;
_BAFgrp = true;
};
if (_faction == "bafdesert") then {
_side = west;
_group = 24;
_BAFgrp = true;
};
if (_faction == "bafwoodland") then {
_side = west;
_group = 25;
_BAFgrp = true;
};
if (_faction == "bafwoodghillie") then {
_snipergrp = true;
_side = west;
_group = 26;
_BAFgrp = true;
};
// use helispawn if east units selected for paragroup.
if (_side == east) then {
_spawnmarker = _spawn;
};
// create a group with random members from random selected case.
switch (_group) do {
case 0: {_units = ["TK_INS_Soldier_AA_EP1", "TK_INS_Soldier_AR_EP1", "TK_INS_Bonesetter_EP1", "TK_INS_Soldier_MG_EP1", "TK_INS_Soldier_2_EP1", "TK_INS_Soldier_EP1", "TK_INS_Soldier_4_EP1", "TK_INS_Soldier_3_EP1", "TK_INS_Soldier_AAT_EP1", "TK_INS_Soldier_AT_EP1", "TK_INS_Soldier_Sniper_EP1", "TK_INS_Soldier_TL_EP1", "TK_INS_Warlord_EP1"];};
case 1: {_units = ["TK_Soldier_AAT_EP1", "TK_Soldier_AA_EP1", "TK_Soldier_AMG_EP1", "TK_Soldier_AR_EP1", "TK_Soldier_AT_EP1", "TK_Soldier_B_EP1", "TK_Soldier_EP1", "TK_Soldier_Engineer_EP1", "TK_Soldier_GL_EP1", "TK_Soldier_HAT_EP1", "TK_Soldier_LAT_EP1", "TK_Soldier_MG_EP1", "TK_Soldier_Medic_EP1", "TK_Soldier_Officer_EP1", "TK_Soldier_SL_EP1"];};
case 2: {_units = ["TK_Special_Forces_TL_EP1", "TK_Soldier_TWS_EP1", "TK_Special_Forces_MG_EP1", "TK_Soldier_Night_1_EP1", "TK_Soldier_Night_2_EP1", "TK_Special_Forces_EP1"];};
case 3: {_units = ["TK_Soldier_Spotter_EP1", "TK_Soldier_Sniper_Night_EP1", "TK_Soldier_Sniper_EP1", "TK_Soldier_SniperH_EP1"];};
case 4: {_units = ["US_Soldier_MG_EP1", "US_Soldier_Marksman_EP1", "US_Soldier_TL_EP1", "US_Soldier_Medic_EP1", "US_Soldier_SL_EP1", "US_Soldier_AAR_EP1", "US_Soldier_AAT_EP1", "US_Soldier_AA_EP1", "US_Soldier_AHAT_EP1", "US_Soldier_AMG_EP1", "US_Soldier_AR_EP1", "US_Soldier_AT_EP1", "US_Soldier_B_EP1", "US_Soldier_EP1", "US_Soldier_Engineer_EP1", "US_Soldier_GL_EP1", "US_Soldier_HAT_EP1", "US_Soldier_LAT_EP1"];};
case 5: {_units = ["US_Delta_Force_TL_EP1", "US_Delta_Force_Air_Controller_EP1", "US_Delta_Force_Assault_EP1", "US_Delta_Force_EP1", "US_Delta_Force_M14_EP1", "US_Delta_Force_MG_EP1", "US_Delta_Force_Marksman_EP1", "US_Delta_Force_Medic_EP1", "US_Delta_Force_Night_EP1", "US_Delta_Force_SD_EP1", "US_Delta_Force_AR_EP1", "Graves", "Herrera", "Drake", "Pierce", "US_Soldier_Officer_EP1"];};
case 6: {_units = ["US_Soldier_Sniper_NV_EP1", "US_Soldier_Spotter_EP1", "US_Soldier_SniperH_EP1", "US_Soldier_Sniper_EP1"];};
case 7: {_units = ["TK_GUE_Bonesetter_EP1", "TK_GUE_Soldier_2_EP1", "TK_GUE_Soldier_3_EP1", "TK_GUE_Soldier_4_EP1", "TK_GUE_Soldier_5_EP1", "TK_GUE_Soldier_AAT_EP1", "TK_GUE_Soldier_AA_EP1", "TK_GUE_Soldier_AR_EP1", "TK_GUE_Soldier_AT_EP1", "TK_GUE_Soldier_EP1", "TK_GUE_Soldier_HAT_EP1", "TK_GUE_Soldier_MG_EP1", "TK_GUE_Soldier_Sniper_EP1", "TK_GUE_Soldier_TL_EP1", "TK_GUE_Warlord_EP1"];};
case 8: {_units = ["CDF_Commander", "CDF_Soldier", "CDF_Soldier_AR", "CDF_Soldier_Engineer", "CDF_Soldier_GL", "CDF_Soldier_MG", "CDF_Soldier_Marksman", "CDF_Soldier_Medic", "CDF_Soldier_RPG", "CDF_Soldier_Strela", "CDF_Soldier_TL", "CDF_Soldier_Militia", "CDF_Soldier_Officer"];};
case 9: {_units = ["CDF_Soldier_Sniper", "CDF_Soldier_Spotter"];};
case 10: {_units = ["FR_AC", "FR_AR", "FR_Assault_GL", "FR_Assault_R", "FR_Commander", "FR_GL", "FR_Marksman", "FR_R", "FR_Sapper", "FR_TL", "FR_Cooper", "FR_Miles", "FR_OHara", "FR_Rodriguez", "FR_Sykes"];};
case 11: {_units = ["USMC_Soldier", "USMC_Soldier2", "USMC_SoldierM_Marksman", "USMC_SoldierS", "USMC_SoldierS_Engineer", "USMC_Soldier_AR", "USMC_Soldier_AA", "USMC_Soldier_AT", "USMC_Soldier_GL", "USMC_Soldier_HAT", "USMC_Soldier_LAT", "USMC_Soldier_MG", "USMC_Soldier_Medic", "USMC_Soldier_SL", "USMC_Soldier_TL", "USMC_Soldier_Officer"];};
case 12: {_units = ["USMC_SoldierS_Sniper", "soldierunit", "USMC_SoldierS_SniperH"];};
case 13: {_units = ["Ins_Commander", "Ins_Soldier_1", "Ins_Soldier_2", "Ins_Soldier_AA", "Ins_Soldier_AR", "Ins_Soldier_AT", "Ins_Soldier_CO", "Ins_Soldier_GL", "Ins_Soldier_MG", "Ins_Soldier_Medic", "Ins_Soldier_Sab", "Ins_Soldier_Sapper", "Ins_Soldier_Sniper"];};
case 14: {_units = ["Ins_Bardak", "Ins_Lopotev", "Ins_Villager3", "Ins_Villager4", "Ins_Woodlander1", "Ins_Woodlander2", "Ins_Woodlander3", "Ins_Worker2"];};
case 15: {_units = ["MVD_Soldier", "MVD_Soldier_AT", "MVD_Soldier_GL", "MVD_Soldier_MG", "MVD_Soldier_Marksman", "MVD_Soldier_Sniper", "MVD_Soldier_TL"];};
case 16: {_units = ["RUS_Commander", "RUS_Soldier1", "RUS_Soldier2", "RUS_Soldier3", "RUS_Soldier_GL", "RUS_Soldier_Marksman", "RUS_Soldier_Sab", "RUS_Soldier_TL"];};
case 17: {_units = ["RU_Commander", "RU_Soldier", "RU_Soldier2", "RU_Soldier_AA", "RU_Soldier_AR", "RU_Soldier_AT", "RU_Soldier_GL", "RU_Soldier_HAT", "RU_Soldier_LAT", "RU_Soldier_MG", "RU_Soldier_Marksman", "RU_Soldier_Medic", "RU_Soldier_Officer", "RU_Soldier_SL", "RU_Soldier_TL"];};
case 18: {_units = ["RU_Soldier_Sniper", "RU_Soldier_Spotter", "RU_Soldier_SniperH"];};
case 19: {_units = ["GUE_Commander", "GUE_Soldier_1", "GUE_Soldier_2", "GUE_Soldier_3", "GUE_Soldier_AA", "GUE_Soldier_AR", "GUE_Soldier_AT", "GUE_Soldier_CO", "GUE_Soldier_GL", "GUE_Soldier_MG", "GUE_Soldier_Medic", "GUE_Soldier_Sab"];};
case 20: {_units = ["GUE_Villager3", "GUE_Villager4", "GUE_Woodlander1", "GUE_Woodlander2", "GUE_Woodlander3", "GUE_Worker2"];};
case 21: {_units = ["GUE_Soldier_Scout", "GUE_Soldier_Sniper"];};
case 22: {_units = ["BAF_Soldier_AA_MTP", "BAF_Soldier_AAA_MTP", "BAF_Soldier_AAT_MTP", "BAF_Soldier_AHAT_MTP", "BAF_Soldier_AAR_MTP", "BAF_Soldier_AMG_MTP", "BAF_Soldier_AT_MTP", "BAF_Soldier_HAT_MTP", "BAF_Soldier_AR_MTP", "BAF_Soldier_EN_MTP", "BAF_Soldier_GL_MTP", "BAF_Soldier_FAC_MTP", "BAF_Soldier_MG_MTP", "BAF_Soldier_scout_MTP", "BAF_Soldier_Marksman_MTP", "BAF_Soldier_Medic_MTP", "BAF_Soldier_Officer_MTP", "BAF_Soldier_MTP", "BAF_Soldier_TL_MTP", "BAF_ASoldier_MTP", "BAF_Soldier_N_MTP", "BAF_Soldier_SL_MTP"];};
case 23: {_units = ["BAF_Soldier_spotter_MTP", "BAF_Soldier_SniperH_MTP", "BAF_Soldier_Sniper_MTP", "BAF_Soldier_SniperN_MTP", "BAF_Soldier_spotterN_MTP"];};
case 24: {_units = ["BAF_Soldier_AA_DDPM", "BAF_Soldier_AAA_DDPM", "BAF_Soldier_TL_DDPM", "BAF_Soldier_AHAT_DDPM", "BAF_Soldier_AAT_DDPM", "BAF_Soldier_AAR_DDPM", "BAF_Soldier_AMG_DDPM", "BAF_Soldier_AT_DDPM", "BAF_Soldier_HAT_DDPM", "BAF_Soldier_AR_DDPM", "BAF_Soldier_EN_DDPM", "BAF_Soldier_GL_DDPM", "BAF_Soldier_FAC_DDPM", "BAF_Soldier_MG_DDPM", "BAF_Soldier_scout_DDPM", "BAF_Soldier_Marksman_DDPM", "BAF_Soldier_Medic_DDPM", "BAF_Soldier_Officer_DDPM", "BAF_Soldier_DDPM", "BAF_ASoldier_DDPM", "BAF_Soldier_N_DDPM", "BAF_Soldier_SL_DDPM"];};
case 25: {_units = ["BAF_Soldier_AA_W", "BAF_Soldier_AAA_W", "BAF_Soldier_AAT_W", "BAF_Soldier_AHAT_W", "BAF_Soldier_AAR_W", "BAF_Soldier_AMG_W", "BAF_Soldier_AT_W", "BAF_Soldier_HAT_W", "BAF_Soldier_AR_W", "BAF_Soldier_EN_W", "BAF_Soldier_GL_W", "BAF_Soldier_FAC_W", "BAF_Soldier_MG_W", "BAF_Soldier_scout_W", "BAF_Soldier_Marksman_W", "BAF_Soldier_Medic_W", "BAF_Soldier_Officer_W", "BAF_Soldier_W", "BAF_ASoldier_W", "BAF_Soldier_N_W", "BAF_Soldier_SL_W", "BAF_Soldier_TL_W"];};
case 26: {_units = ["BAF_Soldier_SniperH_W", "BAF_Soldier_spotter_W", "BAF_Soldier_Sniper_W", "BAF_Soldier_SniperN_W", "BAF_Soldier_spotterN_W"];};
};
_unitcountchk = count _units;
if (_minSold > _unitcountchk) then {
_minSold = _unitcountchk;
if (_debugMode) then {hint "minimum units selected is bigger than group, minimum set at 100%"; sleep 5;};
};
// spawn group - [1,0.45] 1=minimum 1 unit in group - 0.45=45% chance for all others in same case line to be in group.
_spawngroup = [getMarkerpos _spawnmarker, _side, _units, [],[],[0.5,0.8],[],[_minSold,_chancerest]] call BIS_fnc_spawnGroup;
// count group to determine size of heli used.
_howMAny = count units _spawngroup;
if (_insertionType != "plane") then {
if (_side == east) then {
if (_A2grp) then {
_helitypeUsed = "Mi17_Ins";
} else {
if (_howMAny < 4) then {
_helitypeUsed = "UH1H_TK_EP1";
} else {
_helitypeUsed = "Mi17_TK_EP1";
};
};
};
if (_side == west) then {
if (_A2grp) then {
if (_howMAny < 12) then {
_helitypeUsed = "MH60S";
} else {
_helitypeUsed = "MV22";
};
};
if (_OAgrp) then {
if (_howMAny < 12) then {
_helitypeUsed = "UH60M_EP1";
} else {
_helitypeUsed = "CH_47F_EP1";
};
};
if (_BAFgrp) then {
if (_howMAny < 8) then {
_helitypeUsed = "AW159_Lynx_BAF";
} else {
if (_howMAny < 16) then {
_helitypeUsed = "BAF_Merlin_HC3_D";
} else {
_helitypeUsed = "CH_47F_BAF";
};
};
};
};
if (_side == resistance) then {
if (_A2grp) then {
_helitypeUsed = "Mi17_Ins";
} else {
if (_howMAny < 4) then {
_helitypeUsed = "UH1H_TK_GUE_EP1";
} else {
_helitypeUsed = "Mi17_TK_EP1";
};
};
};
};
// if group is snipers set distance from center to bigger to provide longer range sniper support.
if (_snipergrp) then {
_flybyRange = 800;
_rangeWP = 0;
_flyInHeight = 100;
if (_side == west) then {
if (_A2grp) then {
_helitypeUsed = "UH1Y";
_flyInHeight = 75;
};
if (_OAgrp OR _BAFgrp) then {
_helitypeUsed = "MH6J_EP1";
_flyInHeight = 35;
};
};
if (_side == east) then {
if (_A2grp) then {
_helitypeUsed = "Mi17_Ins";
_flyInHeight = 200;
} else {
_helitypeUsed = "UH1H_TK_EP1";
_flyInHeight = 50;
};
};
if (_side == resistance) then {
if (_A2grp) then {
_helitypeUsed = "Mi17_Ins";
_flyInHeight = 200;
} else {
_helitypeUsed = "UH1H_TK_EP1";
_flyInHeight = 50;
};
};
if (_insertionType != "para") then {
_insertionType = "land";
};
} else {
// if blackhawk or huey do lower altitude with reg troops as well.
if (_helitypeUsed == "UH60M_EP1" OR _helitypeUsed == "UH1H_TK_EP1" OR _helitypeUsed == "UH1Y" OR _helitypeUsed == "AW159_Lynx_BAF") then {
_flyInHeight = 150;
};
};
// if insertion type is plane select airplane for paradrops.
if (_insertionType == "plane") then {
_insertionType == "para";
_flyInHeight = 500;
_flybyRange = floor(random 500);
_rangeWP = 0;
if (_side == east) then {
if (_A2grp) then {
_helitypeUsed = "C130J";
} else {
_helitypeUsed = "An2_TK_EP1";
};
};
if (_side == west) then {
if (_A2grp) then {
_helitypeUsed = "C130J";
} else {
_helitypeUsed = "C130J_US_EP1";
};
};
if (_side == resistance) then {
if (_A2grp) then {
_helitypeUsed = "C130J";
} else {
_helitypeUsed = "An2_2_TK_CIV_EP1";
};
};
};
// create drophelo with full crew at the flying altitude, setting heli to spawn at high altitude only causes nosedive to fiery death when alot of scripts are running, works fine if not. set _flyInHeight to 0 if issues arise in your mission.
_sv = [[getMarkerPos _spawn select 0, getMarkerPos _spawn select 1, _flyInHeight], random 360, _helitypeUsed, _side] call BIS_fnc_spawnVehicle;
// Name the vehicle and group.
_drophelo = _sv select 0; // vehicle spawned.
_drophelogrp = _sv select 2; // group of vehicle so waypoints work.
// Repair and refuel incase heli will slam into ground if alot of scripts are active, if player machine or server cannot keep up with heavy load.
_drophelo setDammage 0; // repair.
_drophelo setFuel 1; // refuel.
// set what height drophelo will fly in: this seems to fix the crash when spawned at altitude.
_drophelo flyInHeight _flyInHeight;
// move spawned inf grp in dropheli and let heli know they are cargo.
{_x assignAsCargo _drophelo; _x moveInCargo _drophelo} forEach Units _spawngroup;
// set random skill for all crew _drophelo.
{_x setSkill 0.1 + (random 0.9)} forEach Units _drophelogrp;
sleep 0.5; // thinking time.
_helopilot = driver _drophelo; // get pilot of drophelo.
_helopilot setSkill 1; // set high skill on pilot.
// depending on either paradrop or land insertion option, create empty h and get ready for land option.
_dropheliwp = getMarkerPos _spawn; // get position of patrolarea from initline.
_invisibleTarget = "HeliHEmpty" createVehicle _dropheliwp; // create a inv h on patrolarea position.
//hint "invicible h created for heli wp"; // for debug.
// for TESTING, player unit enter drop helo for a ridealong, player moveInCargo didnt work, so player testunit is named ridealong in editor.
if (_debugMode) then {ridealong moveInCargo _drophelo;}; // for debug.
//sleep 30; // pause to allow heli to touch ground and get repaired and refueled, set at 30 for extra buffer incase heavy scriptload. maybe not needed, depends if mission is heavy load on server or computer, if computer have enough power not needed.
// if engineoff and pilot alive, start problems then turn engine on.
if (!isEngineOn _drophelo AND alive _helopilot) then {
if (!canMove _drophelo) then {
// if damaged repair/refuel.
_drophelo setDammage 0; // repair.
_drophelo setFuel 1; // refuel.
sleep 1;
};
_helopilot action ["engineOn", vehicle _helopilot];
if (_debugMode) then {hint "engine is turned on"; sleep 1;}; // for debug.
} else {
if (_debugMode) then {hint "engine was on"; sleep 1;}; // for debug.
};
// go to random Position determined by value set in _flybyRange wich is range from center of paradrop marker, flyby..
_wp0 = _drophelogrp addWaypoint [getMarkerPos (_this select 0), _flybyRange];
_wp0 setWaypointType "MOVE";
_wp0 setWaypointSpeed "FULL";
_wp0 setWaypointBehaviour "AWARE"; // set to "CARELESS" if trouble with enemys distracting heli.
_wp0 setWaypointFormation "LINE";
_wp0 setWaypointStatements ["true", ""];
if (_snipergrp) then {
sleep 1;
_wp0 setWaypointBehaviour "STEALTH"; // set to "STEALTH" for silent insertion.
};
if (_insertionType == "plane") then {
_wp0 setWaypointBehaviour "CARELESS";
};
// go to random pos 200m from paradrop marker and run the paradrop script.
//_wp1Position = [getPos _invisibleTarget select 0, getPos _invisibleTarget select 1, _flyInHeight];
_wp1 = _drophelogrp addWaypoint [getMarkerPos (_this select 0), _rangeWP];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "NORMAL";
_wp1 setWaypointBehaviour "AWARE"; // set to "CARELESS" if trouble with enemys distracting heli.
_wp1 setWaypointStatements ["true", ""];
if (_snipergrp) then {
sleep 1;
_wp1 setWaypointBehaviour "STEALTH"; // set to "STEALTH" for silent insertion.
[_drophelogrp, 2] setWPPos getWPPos _wp0;
};
if (_insertionType == "plane") then {
_wp1 setWaypointBehaviour "CARELESS";
[_drophelogrp, 2] setWPPos getWPPos _wp0;
};
// activate first move for pilot since damage at spawn together with repair/refuel stops 1st wp to be executed somehow.
_helopilot doMove (getWPPos _wp0);
// check and decide what type insertion to do.
if (_insertionType == "random") then {
_paraOrNot = floor(random 2);
if (_paraOrNot == 0) then {
_insertionType = "para";
} else {
_insertionType = "land";
};
if (_debugMode) then {hint "no insertion type manually set, random selection activated"; sleep 1;}; // for debug.
sleep 0.1;
} else {
if (_debugMode) then {hint "insertion type was manually set, no change"; sleep 1;}; // for debug.
};
// if para dont check for clear landing zone, if land check for clear landing zone and move inv h there.
if (_insertionType == "para" OR _insertionType == "plane") then {
if (_debugMode) then {hint format["selected insertiontype is %1",_insertionType]; sleep 1;}; // for debug.
} else {
_wp1 setWaypointType "TR UNLOAD";
if (_debugMode) then {hint format["selected insertiontype is %1",_insertionType]; sleep 1;}; // for debug.
_findGoodSpot = true;
_maxdistWP = 100;
_LZpos = getWPPos _wp1;
while {_findGoodSpot} do {
_posTemp = [_LZpos, 0, _maxdistWP, 10, 0, .5, 0] call BIS_fnc_findSafePos;
_maxdistWP = _maxdistWP + 10;
sleep 2;
_string = format _posTemp;
sleep 1;
if (isNil ("_string")) then {
if (_debugMode) then {hint "no LZ found rechecking"};
} else {
_invisibleTarget setPos _posTemp;
if (_debugMode) then {hint "found LZ"};
[_drophelogrp, 2] setWPPos getPos _invisibleTarget;
_findGoodSpot = false;
};
};
};
if (_debugMode) then {hint "out of while loop"; sleep 1;}; // for debug.
// check if helo is within 1000 of 1st wp OR if it can move OR if pilot is not alive.
waitUntil {_drophelo distance (getWPPos _wp0) < 1000 OR !canMove _drophelo OR !alive _helopilot};
if (_debugMode) then {hint "1st wp almost done, assigning next wp"; sleep 1;}; // for debug.
// if plane drop method adjust wp approach.
if (_insertionType == "plane") then {
waitUntil {_drophelo distance (getWPPos _wp1) < (4000 + _flyInHeight) OR !canMove _drophelo OR !alive _helopilot};
_flyInHeight = 250;
_drophelo flyInHeight _flyInHeight;
_wp0 setWaypointSpeed "LIMITED";
_wp1 setWaypointSpeed "LIMITED";
waitUntil {_drophelo distance (getWPPos _wp1) < (1500 + _flyInHeight) OR !canMove _drophelo OR !alive _helopilot};
} else {
// check if helo is within range of 2nd wp OR if it can move OR if pilot is not alive.
waitUntil {_drophelo distance (getWPPos _wp1) < (150 + _flyInHeight) OR !canMove _drophelo OR !alive _helopilot};
};
if (_debugMode) then {hint "2nd wp almost done, dropping group, moving to last wp in a few secs"}; // for debug
// if heli is damaged or unable to operate, crew heli joinsilent paragroup and paragroup activate emergency eject.
if (!canMove _drophelo OR !alive _helopilot) then {
_emergency = 1;
{[_x] joinSilent _spawngroup} foreach Units _drophelogrp;
};
if (_insertionType == "para") then {
_drophelo flyInHeight _flyInHeight + 10; // increase flying height to avoid nosedive and slamming paradroppers into the ground.
sleep 1; // ZZZZZzzzz getting a little altitude.
};
// once _drophelo is ready and within set distance of 2nd waypoint, start script for choosen insertiontype.
if (_insertionType == "para" OR _insertionType == "plane" OR _emergency == 1) then {
// if para option selected run paradrop script on group.
if (_debugMode) then {hint "dropping paras"; sleep 1;}; // for debug.
nul=[_spawngroup,_grppatrolmarker,_emergency,_upsmonInUse,_insertionType,_snipergrp] execVM "spawns\groupEject.sqf";
} else {
// if land option selected get group to disembark at LZ.
if (_debugMode) then {hint "inserting group on LZ"; sleep 1;}; // for debug.
nul=[_spawngroup,_grppatrolmarker,_emergency,_upsmonInUse,_insertionType,_snipergrp] execVM "spawns\groupEject.sqf";
_drophelo land "GET OUT"; {if (_x in _drophelo) then {unassignvehicle _x; dogetout _x;}} foreach units _spawngroup;
};
// headback to start position and delete crew and heli when there if no emergency.
if (_emergency == 0) then {
_wp2 = _drophelogrp addWaypoint [getMarkerpos _spawn, 1];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointSpeed "FULL";
_wp2 setWaypointBehaviour "COMBAT"; // set to combat mode to evade enemys and return safe.
if (_snipergrp) then {
_wp2 setWaypointBehaviour "STEALTH"; // set to "STEALTH" for silent insertion.
};
_wp2 setWaypointStatements ["true", "deletevehicle (vehicle this); {deleteVehicle _x} forEach units group this;"];
if (_insertionType == "plane") then {
_wp2 setWaypointBehaviour "CARELESS";
};
if (_debugMode) then {hint "still alive, heading back to be deleted"; sleep 1;}; // for debug.
};
// wait until group is no longer in heli, then delete inv H - this to not cause to much chaos if several land helis come same spot same time and spot is small.
waituntil {{ !( _x in _drophelo)} foreach units _spawngroup};
// set flying height backup at normal if plane used
if (_insertionType == "plane") then {
_flyInHeight = 500;
_drophelo flyInHeight _flyInHeight;
};
// clean up invicible h by deleting it.
deleteVehicle _invisibleTarget;
// order pilot to move to last wp to be deleted.
_helopilot doMove (getWPPos _wp2);
// while distance to last wp(delete crew and heli wp).
_stillalive = true;
while {_stillalive} do {
if (!alive _helopilot AND {alive _x} count crew _drophelo == 0) then {
//hint "exiting while loop, all dead"; // for debug.
_stillalive = false; // set to false so while loop stops and script terminates.
};
if (!canMove _drophelo AND {alive _x} count crew _drophelo != 0) then {
//hint "heli disabled, crew alive, ejecting and commencing patrol on last paradrop area"; // for debug.
{[_x] joinSilent _spawngroup} foreach Units _drophelogrp;
_stillalive = false; // set to false so while loop stops and script terminates.
};
if (_drophelo distance (getWPPos _wp2) < 2000) then {
//hint "last wp almost reached deleting crew and heli and end wp, while loop exits"; // for debug.
_stillalive = false; // set to false so while loop stops and script terminates.
};
//hint "still while looping"; // for debug.
sleep 3;
};
if (_debugMode) then {hint "exiting script"; sleep 1;}; // for debug.
};
// END.