Jump to content

Recommended Posts

sorry guys, but i am too noob in scripting and need help here .... i created a reinforcementchopper to play in coop missions (multiplayer) alone. I created a init.sqf and put this: nul = [player,true,1,3,false,false,player,"random",1000,true,false,6,"default",[true,false,true,false],group player,nil,nil,true] execVM "LV\reinforcementChopper.sqf";  .... How can I get that reinforcement come only when i call.

Share this post


Link to post
Share on other sites

@jandrews on page 14 you will find 4 of the updated files if I remember there's like something like 8 files that need to be updated if using everything in the script. @vurelo there is an updated chopper.sqf I don't remember what page it's on. Look for it. When I get a chance I will post which files need to be updated. All the information is on this thread I know it is a pain in the ass to go through the entire thread but there is some really good information about using this script and the things that work and don't work. Trust me if you read the entire thread you'll still spend less time trying to get things to work in the editor if you don't have the right information god knows I did lol.

Share this post


Link to post
Share on other sites

i created a trigger activated by radio Alpha and it worked!! but alwas when i start a mission, the first reinforcement is called automaticly. 

 

@avibird 1 

thanks .. I found the update

  • Like 1

Share this post


Link to post
Share on other sites

i found my error ... now it's working good!!!

 

i did run it with tigger, someone knows explaim me how i do this works with script?

Share this post


Link to post
Share on other sites

These are the ones I UPDATED over time.

 

1.  FILL HOUSE SCRIPT v1.6 - by SPUn / lostvar 

2. function LV_fnc_fullLandVehicle v1.22 - by SPUn / lostvar

3. function LV_fnc_removeGroup v0.2 - by SPUn / lostvar, REMAKE by kemor

4. function LV_fnc_simpleCache v0.77 - by SPUn / lostvar

5. function LV_fnc_simpleCachev2 v0.2 - by Na_Palm

6. MILITARIZE AREA SCRIPT v2.12 - by SPUn / lostvar

7.NP_fnc_isPlayernear.sqf  Version: 1.0  Author: Na_Palm

8.REINFORCEMENT CHOPPER SCRIPT v2.2 - by SPUn / lostvar Position search parameters fix by -=XTRA=-

 

All the files.SQF are within this thread I don't have Page numbers sorry. You can find them I gave you guys the names and who fix them. Avibird
 

Share this post


Link to post
Share on other sites

Is there any way to choose the AI loadout from "ReinforcementChopper" or "HeliParadrop", like:

call {
if (medic) exitWith {
dummy = [_unit, units (group _unit)] execVM "MedicLoadouts.sqf";

if (Havy Gunner) exitWith {
dummy = [_unit, units (group _unit)] execVM "HavyGunnerLoadouts.sqf";
};

Share this post


Link to post
Share on other sites

These are where the unit types are grabbed from for each faction. With the vehicle types it will completely fill it as it grabs the transport slot type of the vehicle and fills the car/boat/heli etc.

LV/LV_functions/LV_fnc_fullLandVehicle
LV/LV_functions/LV_fnc_fullAirVehicle
LV/LV_functions/LV_fnc_fullWaterVehicle
LV/LV_functions/LV_fnc_menGroup

By loadouts you mean change unit types that spawn this is where it is done. Otherwise, you can use the function found in AISSP that allows you to run a script on all units it spawns and you could setup your own loadouts with extra kits like that if you wished. Let me know if you want an example of this.

  • Like 1

Share this post


Link to post
Share on other sites

These are where the unit types are grabbed from for each faction. With the vehicle types it will completely fill it as it grabs the transport slot type of the vehicle and fills the car/boat/heli etc.

LV/LV_functions/LV_fnc_fullLandVehicle
LV/LV_functions/LV_fnc_fullAirVehicle
LV/LV_functions/LV_fnc_fullWaterVehicle
LV/LV_functions/LV_fnc_menGroup

By loadouts you mean change unit types that spawn this is where it is done. Otherwise, you can use the function found in AISSP that allows you to run a script on all units it spawns and you could setup your own loadouts with extra kits like that if you wished. Let me know if you want an example of this.

please if you can give me an example I'd love to.

Share this post


Link to post
Share on other sites

For my example im going to use 3 Random Kits I made in the virtual arsenal and exported via the export or CTRL + C.

To make more just add more KIT_#'s and then add them inside the run.sqf.
I have then replaced all instances of "this" to "_unit" via notepad++, if you aren't already using it I highly suggest you do so. And then adding

_unit = _this select 0; // SELECT UNIT

USING WITH AISSP
Assuming you create calling lines with the function created by lost, the one found HERE.
 

In the "Custom Init" field place this.

null = [this] execVM "customloadouts\run.sqf";

Then create a folder in your root mission file called

"customLoadouts"
Inside there create the following scripts.

 

customLoadouts\run.sqf

//Run.sqf
_unit = _this select 0; // SELECT UNIT
 
_pathToScripts = "customLoadouts\"; //Folder name of kits
_scriptArray = ["KIT_01.sqf","KIT_02.sqf","KIT_03.sqf"]; //Names .sqf's where kits are stored
_randomScript = _scriptArray call BIS_fnc_selectRandom; // Randomization
[_unit] execVM format["%1%2",_pathToScripts,_randomScript]; //Combine the two above into something the script can run.

customLoadouts\KIT_01.sqf

_unit = _this select 0; // SELECT UNIT
 
comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
 
comment "Add containers";
_unit forceAddUniform "U_BG_Guerilla3_1";
for "_i" from 1 to 3 do {_unit addItemToUniform "30Rnd_556x45_Stanag";};
_unit addVest "V_Chestrig_khk";
for "_i" from 1 to 7 do {_unit addItemToVest "30Rnd_556x45_Stanag";};
for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
_unit addHeadgear "H_Bandanna_sgg";
 
comment "Add weapons";
_unit addWeapon "arifle_Mk20_plain_F";
_unit addPrimaryWeaponItem "optic_ACO_grn";
 
comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
 
comment "Set identity";
_unit setFace "PersianHead_A3_02";
_unit setSpeaker "Male01ENG";
 

customLoadouts\KIT_02.sqf

_unit = _this select 0; // SELECT UNIT
 
comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
 
comment "Add containers";
_unit forceAddUniform "U_BG_Guerilla2_1";
for "_i" from 1 to 2 do {_unit addItemToUniform "30Rnd_556x45_Stanag";};
_unit addVest "V_Rangemaster_belt";
for "_i" from 1 to 5 do {_unit addItemToVest "30Rnd_556x45_Stanag";};
_unit addHeadgear "H_Watchcap_camo";
 
comment "Add weapons";
_unit addWeapon "arifle_TRG20_F";
_unit addPrimaryWeaponItem "optic_ACO_grn";
 
comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
 
comment "Set identity";
_unit setFace "PersianHead_A3_02";
_unit setSpeaker "Male01ENG";
 

customLoadouts\KIT_03.sqf

_unit = _this select 0; // SELECT UNIT
 
comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
 
comment "Add containers";
_unit forceAddUniform "U_BG_Guerilla1_1";
for "_i" from 1 to 2 do {_unit addItemToUniform "30Rnd_9x21_Mag";};
_unit addVest "V_BandollierB_cbr";
for "_i" from 1 to 5 do {_unit addItemToVest "30Rnd_9x21_Mag";};
_unit addHeadgear "H_Booniehat_tan";
 
comment "Add weapons";
_unit addWeapon "SMG_02_F";
_unit addPrimaryWeaponItem "optic_ACO_grn";
 
comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
 
comment "Set identity";
_unit setFace "PersianHead_A3_02";
_unit setSpeaker "Male01ENG";
 

 

Now once your units spawn however you've used them, as long as the custom init field contains the above, it will run through and randomly pick one of 3 kits. You can add more easily, I believe I have documented what you need to know to do that well enough, please ask if you need more clarity.

Best of luck!

 

VISUAL REPRESENTATION OF RANDOMIZING WITH ONLY 3 KITS

a84e1e14ac.jpg

  • Like 2

Share this post


Link to post
Share on other sites

Thank you for your work! You saved me a lot of time, and also made it more fun since now I have a random factor (not placing units one by one).

Share this post


Link to post
Share on other sites

getting some errors

if(!isN>
15:42:56   Error Undefined variable in expression: _man1
15:42:56 Error in expression <(count _men)));
_man = _grp createUnit [_man1, _pos, [], 0, "NONE"];
};

if(!isN>
15:42:56   Error position: <_man1, _pos, [], 0, "NONE"];
};

if(!isN>
15:42:56   Error Undefined variable in expression: _man1
15:43:57 Error in expression <tNumber (configFile >> "CfgVehicles" >> _veh1 >> "transportSoldier");

_vehicle >
15:43:57   Error position: <_veh1 >> "transportSoldier");

_vehicle >
15:43:57   Error Undefined variable in expression: _veh1
15:44:35 Error in expression <tNumber (configFile >> "CfgVehicles" >> _veh1 >> "transportSoldier");

_radius =>
15:44:35   Error position: <_veh1 >> "transportSoldier");

_radius =>
15:44:35   Error Undefined variable in expression: _veh1
15:44:35 Error in expression <

sleep 0.5;

_vehicle = createVehicle [_veh1, _pos, [], 0, "NONE"];
_vehicle se>
15:44:35   Error position: <_veh1, _pos, [], 0, "NONE"];
_vehicle se>
15:44:35   Error Undefined variable in expression: _veh1
15:44:39 Error in expression <_spawnCrew;

_crew = crew _vehicle;

if(_vehSpots > 0)then{
_i = 1;
for "_i" fr>
15:44:39   Error position: <_vehSpots > 0)then{
_i = 1;
for "_i" fr>
15:44:39   Error Undefined variable in expression: _vehspots
15:45:30 Error in expression <(count _men)));
_man = _grp createUnit [_man1, _pos, [], 0, "NONE"];
};

I think its functions fullAirVehicle and menGroup and dont know how to fix or why the errors even happen.

 

Anyone ?

Share this post


Link to post
Share on other sites

@ jandrews1 I don't know how long you have used this script pack but there are a few outdated files

 

 

These are the ones I  you need to UPDATE. Maybe that could have IDK but give it a try.

 

 

1.  FILL HOUSE SCRIPT v1.6 - by SPUn / lostvar 

2. function LV_fnc_fullLandVehicle v1.22 - by SPUn / lostvar

3. function LV_fnc_removeGroup v0.2 - by SPUn / lostvar, REMAKE by kemor

4. function LV_fnc_simpleCache v0.77 - by SPUn / lostvar

5. function LV_fnc_simpleCachev2 v0.2 - by Na_Palm

6. MILITARIZE AREA SCRIPT v2.12 - by SPUn / lostvar

7.NP_fnc_isPlayernear.sqf  Version: 1.0  Author: Na_Palm

8.REINFORCEMENT CHOPPER SCRIPT v2.2 - by SPUn / lostvar Position search parameters fix by -=XTRA=-

Share this post


Link to post
Share on other sites

@ jandrews1 I don't know how long you have used this script pack but there are a few outdated files

 

 

These are the ones I  you need to UPDATE. Maybe that could have IDK but give it a try.

 

 

1.  FILL HOUSE SCRIPT v1.6 - by SPUn / lostvar 

2. function LV_fnc_fullLandVehicle v1.22 - by SPUn / lostvar

3. function LV_fnc_removeGroup v0.2 - by SPUn / lostvar, REMAKE by kemor

4. function LV_fnc_simpleCache v0.77 - by SPUn / lostvar

5. function LV_fnc_simpleCachev2 v0.2 - by Na_Palm

6. MILITARIZE AREA SCRIPT v2.12 - by SPUn / lostvar

7.NP_fnc_isPlayernear.sqf  Version: 1.0  Author: Na_Palm

8.REINFORCEMENT CHOPPER SCRIPT v2.2 - by SPUn / lostvar Position search parameters fix by -=XTRA=-

 

Hey!

Well unfortunately some links to updated files from way back are bad. Could anyone post a folder or something up and we could just grab the updated files? Thanks!.

I went through all pages and didnt even see some of these listed but only 2 that I could see had good links anyways.

Share this post


Link to post
Share on other sites

When I get home I will attempt to upload all the new files for you.

Share this post


Link to post
Share on other sites

When I get home I will attempt to upload all the new files for you.

 

please could you upload the files still ?  i also need them :(  

Share this post


Link to post
Share on other sites

please could you upload the files still ?  i also need them :(

 

along with the above, had 2 other questions...

1. Not quite sure how to use these scripts from a trigger. In the directions it says something about;

If script's calling line goes like: nul = [this,1,50..] execVM... then usually you can just put the same line into Triggers' ON ACT -field and replace this with target objects name.
Add for example Game Logic there where you want this script to be located and name it gamelog01, and then call the script from trigger: nul = [gamelog01,1,50..] execVM.... In militarize, fillHouse and reinforcementChopper the first argument is target location/object/marker.

could anyone expand on this? I just want helidrop, reinforcment and ambient combat starting from trigger. Do I change the command line _this to something?

 

2. am seeing units throw smoke at mission start when this files are starting. but when files are turned off no green smoke.

 

thanks

Share this post


Link to post
Share on other sites

1.  FILL HOUSE SCRIPT v1.6 - by SPUn / lostvar

/*
				***		ARMA3Alpha FILL HOUSE SCRIPT v1.6 - by SPUn / lostvar	***

						Fills house or buildings in defined range with soldiers

			Calling the script:

					default: nul = [this] execVM "LV\fillHouse.sqf";

					custom:  nul = [target, side, patrol, patrol type, spawn rate, radius, skills, group,
									custom init, ID] execVM "LV\fillHouse.sqf";

		Parameters:

	target 		= 	center point 	(Game Logics/Objects/Marker name, ex: GL01 or this or "marker1")
	side 		= 	1 or 2 or 3		(1 = blue team, 2 = red team, 3 = green team) 							DEFAULT: 2
	patrol 		= 	true or false 	(if true, units will patrol) 											DEFAULT: true
	patrol type = 	1 or 2 			(1=only inside building, 2=also outside of building) 					DEFAULT: 2
	spawn rate  = 	1-100 OR Array 	(on how many percentage of possible positions are soldiers spawned) 	DEFAULT: 50
				NOTE: Array - you can also use following syntax: [amount,random amount] for example:
				[10,12] will spawn at least 10 units + random 12 units
	radius 		= 	1 or larger number (1=nearest building. if larger number, then all buildings in radius) DEFAULT: 1
	skills 		= 	"default" 	(default AI skills) 														DEFAULT: "default"
				or	number	=	0-1.0 = this value will be set to all AI skills, ex: 0.8
				or	array	=	all AI skills invidiually in array, values 0-1.0, order:
		[aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, courage, commanding, general, endurance, reloadSpeed]
		ex: 	[0.75,0.5,0.6,0.85,0.9,1,1,0.75,1,1]
	group 		= 	group name or nil (if you want units in existing group, set it here. if nil, 			DEFAULT: nil
					new group is made) EXAMPLE: (group player)
	custom init = 	"init commands" (if you want something in init field of units, put it here) 			DEFAULT: nil
				NOTE: Keep it inside quotes, and if you need quotes in init commands, you MUST use ' or "" instead of ".
				EXAMPLE: "hint 'this is hint';"
	ID 			= 	number (if you want to delete units this script creates, you'll need ID number for them)DEFAULT: nil

EXAMPLE: 	nul = [this, 2, true, 2, 50, 1, 0.75, nil, nil, 9] execVM "LV\fillHouse.sqf";
			spawns in nearest building east soldiers in 50% of possible building positions with skill 0.75,
			and makes them patrol in & outside of that building
*/
if (!isServer)exitWith{};
private ["_blueMenArray3","_blueMenArray2","_BLUarrays","_redMenArray2","_OPFarrays","_greenMenArray","_grpId","_customInit","_center","_skls","_skills","_a","_buildings","_rat","_milHQ","_milGroup","_menArray","_i","_newPos","_i2","_unitType","_unit","_building","_sideOption","_blueMenArray","_redMenArray","_bPoss","_patrol","_pFile","_pType"];

_center = if (count _this > 0) then { _this select 0;};
_sideOption = if (count _this > 1) then { _this select 1;} else {2};
_patrol = if (count _this > 2) then { _this select 2;} else {true};
_pType = if (count _this > 3) then { _this select 3;} else {2};
_ratio = if (count _this > 4) then { _this select 4;} else {50};
_radius = if (count _this > 5) then { _this select 5;} else {1};
_skills = if (count _this > 6) then { _this select 6;} else {"default"};
_milGroup = if (count _this > 7) then { _this select 7;} else {nil}; if(!isNil("_milGroup"))then{if("_milGroup" == "nil0")then{_milGroup = nil;};};				//Changed by Dashnaw
_customInit = if (count _this > 8) then { _this select 8;} else {nil}; if(!isNil("_customInit"))then{if(_customInit == "nil0")then{_customInit = nil;};};
_grpId = if (count _this > 9) then { _this select 9;} else {nil};

if(isNil("LV_ACskills"))then{LV_ACskills = compile preprocessFile "LV\LV_functions\LV_fnc_ACskills.sqf";};
if(isNil("LV_vehicleInit"))then{LV_vehicleInit = compile preprocessFile "LV\LV_functions\LV_fnc_vehicleInit.sqf";};
if(isNil("LV_nearestBuilding"))then{LV_nearestBuilding = compile preprocessFile "LV\LV_functions\LV_fnc_nearestBuilding.sqf";};

_blueMenArray = ["B_Soldier_A_F","B_soldier_AR_F","B_medic_F","B_engineer_F","B_soldier_exp_F","B_Soldier_GL_F","B_soldier_M_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_soldier_repair_F","B_Soldier_F","B_soldier_LAT_F","B_Soldier_lite_F","B_Soldier_SL_F","B_Soldier_TL_F","B_soldier_AAR_F","B_soldier_AAA_F","B_soldier_AAT_F"];
_blueMenArray2 = ["B_recon_exp_F","B_recon_JTAC_F","B_recon_M_F","B_recon_medic_F","B_recon_F","B_recon_LAT_F","B_recon_TL_F","B_soldier_AAR_F","B_soldier_AAA_F","B_soldier_AAT_F"];
_blueMenArray3 = ["B_G_Soldier_A_F","B_G_soldier_AR_F","B_G_medic_F","B_G_engineer_F","B_G_soldier_exp_F","B_G_Soldier_GL_F","B_G_soldier_M_F","B_G_officer_F","B_G_Soldier_F","B_G_soldier_LAT_F","B_G_Soldier_lite_F","B_G_Soldier_SL_F","B_G_Soldier_TL_F"];
_BLUarrays = [_blueMenArray,_blueMenArray2,_blueMenArray3];
_redMenArray = ["O_Soldier_A_F","O_soldier_AR_F","O_medic_F","O_engineer_F","O_soldier_exp_F","O_Soldier_GL_F","O_soldier_M_F","O_soldier_AA_F","O_soldier_AT_F","O_officer_F","O_soldier_repair_F","O_Soldier_F","O_soldier_LAT_F","O_Soldier_lite_F","O_Soldier_SL_F","O_Soldier_TL_F","O_soldier_AAR_F","O_soldier_AAA_F","O_soldier_AAT_F"];
_redMenArray2 = ["O_recon_exp_F","O_recon_JTAC_F","O_recon_M_F","O_recon_medic_F","O_recon_F","O_recon_LAT_F","O_recon_TL_F","O_soldier_AAR_F","O_soldier_AAA_F","O_soldier_AAT_F"];
_OPFarrays = [_redMenArray,_redMenArray2];
_greenMenArray = ["I_Soldier_A_F","I_soldier_AR_F","I_medic_F","I_engineer_F","I_soldier_exp_F","I_Soldier_GL_F","I_soldier_M_F","I_soldier_AA_F","I_soldier_AT_F","I_officer_F","I_soldier_repair_F","I_Soldier_F","I_soldier_LAT_F","I_Soldier_lite_F","I_Soldier_SL_F","I_Soldier_TL_F","I_soldier_AAR_F","I_soldier_AAA_F","I_soldier_AAT_F"];

switch (_sideOption) do {
    case 1: {
        _milHQ = createCenter west;
		if(isNil("_milGroup"))then{_milGroup = createGroup west;}else{_milGroup = _milGroup};
        _menArray = (_BLUarrays call BIS_fnc_selectRandom);
    };
	case 2: {
        _milHQ = createCenter east;
        if(isNil("_milGroup"))then{_milGroup = createGroup east;}else{_milGroup = _milGroup};
        _menArray = (_OPFarrays call BIS_fnc_selectRandom);
    };
    default {
        _milHQ = createCenter resistance;
        if(isNil("_milGroup"))then{_milGroup = createGroup resistance;}else{_milGroup = _milGroup};
        _menArray = _greenMenArray;
    };
};

if(_center in allMapMarkers)then{
		_center0 = getMarkerPos _center;
	}else{
		if (typeName _center == "ARRAY") then{
			_center0 = _center;
		}else{
			_center0 = getPos _center;
		};
	};

if(_radius > 1)then{
	_buildings = ["all in radius",_center,_radius] call LV_nearestBuilding;
}else{
	_buildings = ["nearest one",_center] call LV_nearestBuilding;
};
if(isNil("_buildings"))exitWith{};
if(count _buildings == 0) exitWith{};

_bPoss = [];
_a = 0;
while { _a < (count _buildings) } do {
	_building = (_buildings select _a);
	_i = 0;
	while { ((_building buildingPos _i) select 0) != 0 } do {
		_bPoss set [count (_bPoss), (_building buildingPos _i)];
		_i = _i + 1;
	};
	_a = _a + 1;
};

if(typeName _ratio == "ARRAY")then{
	_rat = (_ratio select 0) + (round (random (_ratio select 1)));																	//Changed by Dashnaw
}else{
	_rat = ceil((_ratio / 100) * (count _bPoss));
};
_i2 = 0;
while{_i2 < _rat}do{
    //if(_radius > 1)then{_newPos = _bPoss select floor(random count _bPoss);}else{_newPos = _bPoss select _i2;};
	_newPos = _bPoss select floor(random count _bPoss);
	if(_rat < count _bPoss)then{_bPoss = _bPoss - [_newPos];};
    _i2 = _i2 + 1;

    _unitType = _menArray select (floor(random(count _menArray)));
	_unit = _milGroup createUnit [_unitType, _newPos, [], 0, "NONE"];
	_unit setpos _newPos;

	if(typeName _skills != "STRING")then{_skls = [_unit,_skills] call LV_ACskills;};

	if(_patrol)then{
        	switch (_pType) do {
            		case 1: {
                		_pFile = "LV\patrol-vF.sqf";
            		};
            		case 2: {
                		_pFile = "LV\patrol-vG.sqf";
            		};
        	};
			nul = [_unit] execVM format["%1",_pFile];
	}else{
        	doStop _unit;
    };
	if(!isNil("_customInit"))then{
		nul = [_unit,_customInit] spawn LV_vehicleInit;
	};
};

if(!isNil("_grpId"))then{
	call compile format ["LVgroup%1 = _milGroup",_grpId];
	call compile format["LVgroup%1spawned = true;", _grpId];
	_thisArray = [];
	{
		if(isNil("_x"))then{
			_thisArray set[(count _thisArray),"nil0"];
		}else{
			_thisArray set[(count _thisArray),_x];
		};
	}forEach _this;
	call compile format["LVgroup%1CI = ['fillhouse',%2]",_grpId,'_thisArray'];									//Changed by Dashnaw
	call compile format["LVgroup%1UNITS = [%2]",_grpId,_rat];													//Changed by Dashnaw
};

2. function LV_fnc_fullLandVehicle v1.22 - by SPUn / lostvar

//replaced v1.21
//ARMA3Alpha function LV_fnc_fullLandVehicle v1.22 - by SPUn / lostvar
//Spawns random vehicle full of random units and returns driver 
private ["_BLUhq","_BLUgrp","_veh","_grp","_OPFhq","_OPFgrp","_INDhq","_INDgrp","_roads","_radius","_pos1","_man1","_man","_i","_pos","_side","_BLUveh","_OPFveh","_INDveh","_men","_veh1","_vehSpots","_roadFound","_vehicle","_vCrew","_allUnitsArray","_crew","_driver"];
_pos = _this select 0;
_side = _this select 1;

_BLUveh = ["B_MRAP_01_F","B_MRAP_01_hmg_F","B_MRAP_01_gmg_F","B_Quadbike_01_F","B_Truck_01_transport_F","B_Truck_01_covered_F","B_APC_Tracked_01_rcws_F","B_APC_Tracked_01_AA_F","B_APC_Wheeled_01_cannon_F","B_MBT_01_cannon_F","B_MBT_01_arty_F","B_MBT_01_mlrs_F"];
_OPFveh = ["O_MRAP_02_F","O_MRAP_02_gmg_F","O_MRAP_02_hmg_F","O_Quadbike_01_F","O_Truck_02_transport_F","O_Truck_02_covered_F","O_MBT_02_arty_F","O_MBT_02_cannon_F","O_APC_Wheeled_02_rcws_F","O_APC_Tracked_02_cannon_F","O_APC_Tracked_02_AA_F"];
_INDveh = ["I_MRAP_03_F","I_MRAP_03_gmg_F","I_MRAP_03_hmg_F","I_Quadbike_01_F","I_Truck_02_transport_F","I_Truck_02_covered_F","I_APC_Wheeled_03_cannon_F","I_APC_Wheeled_03_cannon_F","I_APC_Wheeled_03_cannon_F"];

_men = [];
_veh = [];

switch(_side)do{
	case 0:{
		_BLUhq = createCenter west;
		_BLUgrp = createGroup west;
		_veh = _BLUveh;
		_grp = _BLUgrp;
	};
	case 1:{
		_OPFhq = createCenter east;
		_OPFgrp = createGroup east;
		_veh = _OPFveh;
		_grp = _OPFgrp;
	};
	case 2:{
		_INDhq = createCenter resistance;
		_INDgrp = createGroup resistance;
		_veh = _INDveh;
		_grp = _INDgrp;
	};
};

_veh1 = _veh select (floor(random(count _veh)));
_vehSpots = getNumber (configFile >> "CfgVehicles" >> _veh1 >> "transportSoldier");

_radius = 40;
_roads = [];
while{(count _roads) == 0}do{
	_roads = _pos nearRoads _radius;
	_radius = _radius + 10;
};
if(((_roads select 0) distance _pos)<200)then{
	//_pos = getPos(_roads select 0);
	_pos1 = [_pos,0,25,5,0,1,0] call BIS_fnc_findSafePos;
}else{
	_pos1 = [_pos,0,200,5,0,1,0] call BIS_fnc_findSafePos;
};
//_pos = [_pos1 select 0, _pos1 select 1, 0];

sleep 0.5;

_vehicle = createVehicle [_veh1, _pos, [], 0, "NONE"];
_vehicle setPos _pos;

_vehicle allowDamage false;
//sleep 2;
if(((vectorUp _vehicle) select 2) != 0)then{ _vehicle setvectorup [0,0,0]; };
//sleep 2;
_vehicle allowDamage true;

_vCrew = [_vehicle, _grp] call BIS_fnc_spawnCrew;
//_allUnitsArray set [(count _allUnitsArray), _vehicle];
_crew = crew _vehicle;

if(_vehSpots > 0)then{
	_i = 1; 
	for "_i" from 1 to _vehSpots do {
		_man1 = getText (configFile >> "CfgVehicles" >> _veh1 >> "crew");
		_man = _grp createUnit [_man1, _pos, [], 0, "NONE"];
		_man moveInCargo _vehicle;
		sleep 0.3;
	};
};

_driver = driver _vehicle;
_driver

3. function LV_fnc_removeGroup v0.2 - by SPUn / lostvar, REMAKE by kemor

//ARMA3Alpha function LV_fnc_removeGroup v0.2 - by SPUn / lostvar, REMAKE by kemor
//removes fillHouse or militarize units 
//Syntax: nul = [LVgroup*] execVM "LV\LV_functions\LV_fnc_removeGroupV2.sqf";
// * = id number (which is defined in fillHouse or militarize, so if ID is 10 = LVgroup10)
private["_grp"];

_grp = _this select 0;

{
	if(vehicle _x != _x)then
	{
		_veh = vehicle _x;		
		{
            //getting rid of the frikkin gunners!
			_x assignAsDriver _veh;
			unassignVehicle _x;
			moveOut _x;
			_x setPos [0,0,0];
			deleteVehicle _x;
		}forEach crew _veh;
		deleteVehicle _veh;	
	}
	else
	{
		deleteVehicle _x;
	};
}forEach units _grp;
deleteGroup _grp;

4. function LV_fnc_simpleCache v0.77 - by SPUn / lostvar

//replaced v0.6
/*ARMA3Alpha function LV_fnc_simpleCache v0.77 - by SPUn / lostvar

		This script caches fillHouse & militarize scripts.

	nul = [[ID's],[players],distance,keep count,MP] execVM "LV\LV_functions\LV_fnc_simpleCache.sqf";
	
	ID's		=	array of script ID's
	players 	=	array of players (doesnt matter what you set here if you use MP mode)
	distance	=	distance between player(s) and militarize/fillHouse on where scripts will be activated
	keep count	=	true = script will count & save AI amounts, false = AI amount will be reseted on each time it activates again
	MP			=	true = all alive non-captive playableUnits will activate scripts, false = only units in players-array
	
	example:
	
	nul = [[13,14],[playerUnit1],500,true,false] execVM "LV\LV_functions\LV_fnc_simpleCache.sqf";

*/
if (!isServer)exitWith{};
private ["_ready","_allUnits","_tempVehs","_mp","_i","_cPos","_inRange","_aliveCount","_grp","_center","_scriptParams","_id","_ids","_units","_distance","_amountArr","_script","_params","_vehicleAmount","_vehicleArr","_excludeSingleHeliPilot","_inRangeUnits","_pilotCandidate"];

//Additional settings:
_excludeSingleHeliPilot = false; //true = if single player flies over area as pilot, area wont trigger (reduces lag)
//

_ids = _this select 0;
_units = _this select 1;
_distance = _this select 2;
_keepCount = _this select 3;
_mp = _this select 4;

if(_mp)then{if(isNil("LV_GetPlayers"))then{LV_GetPlayers = compile preprocessFile "LV\LV_functions\LV_fnc_getPlayers.sqf";};};

while{true}do{
	for[{_i=0}, {_i<(count _ids)}, {_i=_i+1}] do{
		
		if(!isNil("LVgroup"+(str (_ids select _i))))then{ //if group does not exist, move to next id
			_ready = true;
			if(!isNil("LVgroup"+(str (_ids select _i))+"spawned"))then{ //check if zone is being created atm
				if(call compile("LVgroup"+(str (_ids select _i))+"spawned") == 'creating')then{
					_ready = false;
				};
			};
		
		if(_ready)then{ //skip ID if zone is currently being spawned
			call compile format["_grp = LVgroup%1;",(str (_ids select _i))]; //get group
			call compile format["_scriptParams = LVgroup%1CI",(str (_ids select _i))]; //get arguments
			
			_id = _ids select _i;
			_script = _scriptParams select 0;
			_params = _scriptParams select 1;

			_center = _params select 0;
		
			_inRange = false;
			if(_center in allMapMarkers)then{
				_cPos = getMarkerPos _center;
			}else{
				if (typeName _center == "ARRAY") then{
					_cPos = _center;
				}else{
					_cPos = getPos _center;
				};
			};
			if(_mp)then{_units = call LV_GetPlayers;};
			_inRangeUnits = [];
			{
				if((_x distance _cPos) < _distance)then{
					_inRange = true;
					_inRangeUnits set[(count _inRangeUnits),_x];
				};
			}forEach _units;
			
			if(_excludeSingleHeliPilot)then{
				if((count _inRangeUnits) == 1)then{
					_pilotCandidate = (_inRangeUnits select 0);
					if((vehicle _pilotCandidate) != _pilotCandidate)then{
						if(((vehicle _pilotCandidate) isKindOf "Air")&&((driver (vehicle _pilotCandidate))==_pilotCandidate))then{
							_inRange = false;
						};
					};
				};
			};
			if((isNil("LVgroup"+(str (_ids select _i))+"spawned"))&&(_inRange))then{
				hint format ["CREATING: LVgroup%1",_id];
				call compile format["LVgroup%1spawned = 'creating';", (_ids select _i)]; //set "creating" state so it's not nil anymore
				if(_script == "militarize")then{ 
					call compile format["nul = %1 execVM 'LV\militarize.sqf';",_params];
				}else{
					call compile format["nul = %1 execVM 'LV\fillHouse.sqf';",_params];
				};
			}else{
				if((!isNil("LVgroup"+(str (_ids select _i))+"spawned"))&&(!_inRange))then{
				if(call compile("LVgroup"+(str (_ids select _i))+"spawned") == 'true')then{ //run this only if it's true, not "creating"
					if(_keepCount)then{
						_aliveCount = ({alive _x} count units _grp);
						//_aliveCount = (count units _grp);
						_amountArr = [_aliveCount,0];
						if(_script == "militarize")then{
							_vehicleAmount = 0;
							_tempVehs = [];
							{
								if(vehicle _x != _x)then{
									
									if(alive _x)then{_aliveCount = _aliveCount - 1;};
									if(!(vehicle _x in _tempVehs))then{
										_tempVehs set[(count _tempVehs),(vehicle _x)];
										if((canMove (vehicle _x))&&(alive _x))then{
											_vehicleAmount = _vehicleAmount + 1; 
										};
									};
								};
								
							}forEach units _grp;
							_amountArr = [_aliveCount,0];
							call compile format["(LVgroup%1CI select 1) set [6, %2];",_id,_amountArr];
							if(_vehicleAmount > 0)then{
								_vehicleArr = [_vehicleAmount,0];
								call compile format["(LVgroup%1CI select 1) set [7, %2];",_id,_vehicleArr];
							};
							hint format ["DELETING: LVgroup%1 \n SAVED SIZE: %2 inf, %3 veh",_id,_aliveCount,_vehicleAmount];
						}else{
							//hint format ["DELETING: LVgroup%1 \n SAVED SIZE: %2",_id,_aliveCount];
							call compile format["(LVgroup%1CI select 1) set [4, %2];",_id,_amountArr];
						};
					};
						_allUnits = _grp getVariable "allUnits";
						{
							deleteVehicle _x;
						}forEach _allUnits;
						{
							if(vehicle _x != _x)then{deleteVehicle (vehicle _x);};
							deleteVehicle _x;
						}forEach units _grp;
						
					if(_keepCount)then{ //REMOVE this sentence if you want script to be terminated once all units have been killed
						if(_aliveCount == 0)then{
							_ids = _ids - [_id];
						};
					};
					call compile format["LVgroup%1spawned = nil;", (_ids select _i)];
				};
				};
			};
		};
		};
	};
	sleep 2;
};

5. function LV_fnc_simpleCachev2 v0.2 - by Na_Palm

/*ARMA3 function LV_fnc_simpleCachev2 v0.2 - by Na_Palm
initial version by SPUn / lostvar

		This script caches fillHouse & militarize scripts.

	nul = [[script parameter list], distance, keep count] execVM "LV\LV_functions\LV_fnc_simpleCache.sqf";
	
	script parameter list	=	array of [scriptID, [parameter]]
								scriptID = 1: militarize, 2: fillHouse
								parameter = array of required parameters for the script
								the same as you would use for them direcly
	distance				=	distance between player(s) and militarize/fillHouse on where scripts will be activated
	keep count				=	true = script will count & save AI amounts, false = AI amount will be reseted on each time it activates again
	
	For server admins, the loop can be switched off with command on server: {swAI_Run = false;}
	
	example 1 (for use in GameLogic):
	nul = [[[1, [<parameter for 1>]], [2, [<parameter for 2>]]], 500, true] execVM "LV\LV_functions\LV_fnc_simpleCachev2.sqf";

	example 2 (for use in init.sqf or initServer.sqf):
	LV_fnc_simpleCachev2 = compileFinal preProcessFileLineNumbers "LV\LV_functions\LV_fnc_simpleCachev2.sqf";
	[[[1, [<parameter for 1>]], [2, [<parameter for 2>]]], 500, true] spawn LV_fnc_simpleCachev2;

	example 3 (for use in init.sqf or initServer.sqf):
	LV_fnc_simpleCachev2 = compileFinal preProcessFileLineNumbers "LV\LV_functions\LV_fnc_simpleCachev2.sqf";
	_sCscript_list =[
						[1, [<parameter for 1>]],
						[2, [<parameter for 2>]]
					];
	[_sCscript_list, 500, true] spawn LV_fnc_simpleCachev2;

*/
if (!isServer)exitWith{};
if(isNil {LV_fnc_removeGroupv2}) then {LV_fnc_removeGroupv2 = compileFinal preProcessFileLineNumbers "LV\LV_functions\LV_fnc_removeGroupv2.sqf";};
if(isNil {NP_fnc_isPlayernear}) then {NP_fnc_isPlayernear = compileFinal preProcessFileLineNumbers "LV\LV_functions\NP_fnc_isPlayernear.sqf";};
if(isNil {LV_militarize}) then {LV_militarize = compileFinal preProcessFileLineNumbers "LV\militarize.sqf";};
if(isNil {LV_fillHouse}) then {LV_fillHouse = compileFinal preProcessFileLineNumbers "LV\fillHouse.sqf";};

private ["_distance","_grpname","_hndl","_keepCount","_MenCount","_needDespwn","_needSpwn",
"_posOfScriptMrkr","_scrptPara_list","_spwndSciptIdx_list","_VehCount"];

_scrptPara_list = [_this, 0, [], [[]]] call BIS_fnc_param;
_distance = [_this, 1, 1000, [0]] call BIS_fnc_param;
_keepCount = [_this, 2, false, [true]] call BIS_fnc_param;

//vars it needs
_spwndSciptIdx_list = [];
swAI_Run = true;
diag_log format["---- starting simpleCacheV2 now ------------------"];

while{((count _scrptPara_list) > 0) && swAI_Run} do {
	//check if to keep count
	if (_keepCount) then {
		{
			_grpname = grpNull;
			//is it already spawned?
			if (_forEachIndex in _spwndSciptIdx_list) then {
				_MenCount = 0;
				_VehCount = 0;
				//get groupname
				if ((_x select 0) == 1) then {
					call compile format["_grpname = LVgroup%1",(_x select 1 select 11)];
				} else {
					call compile format["_grpname = LVgroup%1",(_x select 1 select 9)];
				};
				//get unit/vehicle count in group
				_MenCount = ({alive _x} count units _grpname);
				if ((_x select 0) == 1) then {
					{
						if (vehicle _x != _x) then {
							if ((canMove (vehicle _x)) && (alive _x)) then {
								_VehCount = _VehCount + 1;
								_MenCount = _MenCount - 1;
							};
						};
						sleep 0.001;
					}forEach units _grpname;
				};
				if ((_MenCount == 0) && (_VehCount == 0)) then {
					//script has no units left, so delete it from _scrptPara_list and DESPAWN
					if ((_x select 0) == 1) then {
						call compile format["_grpname = LVgroup%1",(_x select 1 select 11)];
					} else {
						call compile format["_grpname = LVgroup%1",(_x select 1 select 9)];
					};
					[_grpname] call LV_fnc_removeGroupv2;
					_spwndSciptIdx_list = _spwndSciptIdx_list - [_forEachIndex];
					_scrptPara_list set [_forEachIndex, 999999];
					_scrptPara_list = _scrptPara_list - [999999];
				} else {
					//change parameter array according to new counts
					if ((_x select 0) == 1) then {
						//militarize
						(_x select 1) set [6, [_MenCount, 0]];
						(_x select 1) set [7, [_VehCount, 0]];
					} else {
						//fillHouse
						(_x select 1) set [4, [_MenCount, 0]];
					};
				};
			};
			sleep 0.001;
		}forEach _scrptPara_list;
	};
	
	//check if a spawned script needs to DESPAWN, then do it
	{
		_needDespwn = true;
		//is it already spawned?
		if (_forEachIndex in _spwndSciptIdx_list) then {
			//get position in accordance to type
			if ((_x select 1 select 0) in allMapMarkers) then {
				_posOfScriptMrkr = getMarkerPos (_x select 1 select 0);
			} else {
				if (typeName (_x select 1 select 0) == "ARRAY") then {
					_posOfScriptMrkr = (_x select 1 select 0);
				} else {
					_posOfScriptMrkr = getPos (_x select 1 select 0);
				};
			};
			//check if player near
			_needDespwn = !([_posOfScriptMrkr, _distance] call NP_fnc_isPlayernear);
		} else {
			_needDespwn	= false;
		};
		//despawn it
		if (_needDespwn) then {
			if ((_x select 0) == 1) then {
				call compile format["_grpname = LVgroup%1",(_x select 1 select 11)];
				//check if vehicle got hijacked
				//thanks Meatball for reminding me!
				{
					if (vehicle _x != _x) then {
						_hijacked = false;
						_hijGroup = grpNull;
						{
							if (alive _x) then {
								if !(_x in (units _grpname)) exitWith {_hijGroup = (group _x); _hijacked = true;};
							};
							if (_hijacked) exitWith {};
							sleep 0.001;
						}forEach crew _x;
						if (_hijacked) then {
							[_x] joinSilent _hijGroup;
						};
					};
					sleep 0.001;
				}forEach units _grpname;
			} else {
				call compile format["_grpname = LVgroup%1",(_x select 1 select 9)];
			};
			[_grpname] call LV_fnc_removeGroupv2;
			_spwndSciptIdx_list = _spwndSciptIdx_list - [_forEachIndex];
		};
		sleep 0.001;
	}forEach _scrptPara_list;
	
	//check if a script needs to SPAWN, then do it
	{
		_needSpwn = false;
		//is it already spawned?
		if !(_forEachIndex in _spwndSciptIdx_list) then {
			//get position in accordance to type
			if ((_x select 1 select 0) in allMapMarkers) then {
				_posOfScriptMrkr = getMarkerPos (_x select 1 select 0);
			} else {
				if (typeName (_x select 1 select 0) == "ARRAY") then {
					_posOfScriptMrkr = (_x select 1 select 0);
				} else {
					_posOfScriptMrkr = getPos (_x select 1 select 0);
				};
			};
			//check if player near
			_needSpwn = [_posOfScriptMrkr, _distance] call NP_fnc_isPlayernear;
		};
		//spawn it
		if (_needSpwn) then {
			if ((_x select 0) == 1) then {
				_hndl = (_x select 1) spawn LV_militarize;
				waitUntil {scriptDone _hndl};
			} else {
				_hndl = (_x select 1) spawn LV_fillHouse;
				waitUntil {scriptDone _hndl};
			};
			_spwndSciptIdx_list set [count _spwndSciptIdx_list, _forEachIndex];
		};
		sleep 0.001;
	}forEach _scrptPara_list;
	
	sleep 0.001;
};
diag_log format ["-%1-!!LV_simpleCachev2 SHOTDOWN!!--"];

6. MILITARIZE AREA SCRIPT v2.12 - by SPUn / lostvar

/*
				***		ARMA3Alpha MILITARIZE AREA SCRIPT v2.1 - by SPUn / lostvar	***
/*
				***		ARMA3Alpha MILITARIZE AREA SCRIPT v2.12 - by SPUn / lostvar	***

			Calling the script:
			
		default: 	nul = [this] execVM "LV\militarize.sqf";
		
		custom:		nul = [target, side, radius, spawn men, spawn vehicles, still, men ratio, vehicle ratio, 
							skills, group, custom init, ID] execVM "LV\militarize.sqf";

		Parameters:
		
	target 		=	center point (name of marker or object or unit which is the center point of militarized area,
									or position array)
	side 		=	(0 = civilian, 1 = blue, 2 = red, 3 = green) 													DEFAULT: 2
	radius 		=	(from center position) 																			DEFAULT: 150
	spawn men 	= 	[spawn land units, spawn water units]															DEFAULT: [true,false]
					(both values are true or false)
	spawn vehicles =[spawn land vehicles, spawn water vehicles, spawn air vehicles] 								DEFAULT: [true,false,false]
					(all values are true or false)	
	still 		= 	true or false 	(if false, then units will patrol in radius, checkin also buildings) 			DEFAULT: false
	men ratio 	=	(amount of spawning men is radius * men ratio, ie: 250 * 0.2 = 50 units) 						DEFAULT: 0.3
					NOTE: Array - you can also use following syntax: [amount,random amount] for example:
					[10,5] will spawn at least 10 units + random 1-5 units 
	vehicle ratio= 	(amount of spawning vehicles is radius * vehicle ratio, ie: 250 * 0.1 = 25 vehicles) 			DEFAULT: 0.1
					NOTE: Same array syntax as in "men ratio" works here too!
	skills 		= 	"default" 	(default AI skills) 																DEFAULT: "default"
				or	number	=	0-1.0 = this value will be set to all AI skills, ex: 0.8
				or	array	=	all AI skills invidiually in array, values 0-1.0, order:
		[aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, courage, commanding, general, endurance, reloadSpeed] 
		ex: 	[0.75,0.5,0.6,0.85,0.9,1,1,0.75,1,1] 
	group 		= 	group name or nil (if you want units in existing group, set it here. if nil, new group is made) DEFAULT: nil
					EXAMPLE: (group player)
	custom init = 	"init commands" (if you want something in init field of units, put it here) 					DEFAULT: nil
				NOTE: Keep it inside quotes, and if you need quotes in init commands, you MUST use ' or "" instead of ".
				EXAMPLE: "hint 'this is hint';"
	ID 			= 	number (if you want to delete units this script creates, you'll need ID number for them) 		DEFAULT: nil

EXAMPLE: nul = [this,2,50,[true,true],[true,false,true],false,[10,0],0.1,[0.2,0.2,0.2,0.85,0.9,0.75,0.1,0.6,1,1],nil,nil,13] execVM "LV\militarize.sqf";
*/
if (!isServer)exitWith{};
private ["_greenMenArray","_grpId","_customInit","_cPos","_skls","_skills","_dir","_range","_unitType","_unit","_radius","_men","_vehicles","_still","_centerPos","_menAmount","_vehAmount","_milHQ","_milGroup","_menArray","_blueMenArray","_redMenArray","_yellowMenArray","_side","_pos","_yellowCarArray","_allUnitsArray","_menRatio","_vehRatio","_diveArray","_validPos","_side","_driver","_whichOne","_vehicle","_crew","_thisArray","_smokesAndChems","_doorHandling","_BLUdivers","_OPFdivers","_INDdivers"];

//Extra options:
_smokesAndChems = true;
_doorHandling = true;
//

_cPos = if(count _this > 0)then{_this select 0;};
_side = if (count _this > 1) then { _this select 1; }else{2;};
_radius = if (count _this > 2) then { _this select 2; }else{150;};
_men = if (count _this > 3) then { _this select 3; }else{[true,false];};
_vehicles = if (count _this > 4) then { _this select 4; }else{[true,false,false];};
_still = if (count _this > 5) then { _this select 5; }else{false;};
_menRatio = if (count _this > 6) then { _this select 6; }else{0.3;};
_vehRatio = if (count _this > 7) then { _this select 7; }else{0.02;};
_skills = if (count _this > 8) then { _this select 8; }else{"default";};
_milGroup = if (count _this > 9) then { _this select 9; }else{nil;}; if(!isNil("_milGroup"))then{if(_milGroup == "nil0")then{_milGroup = nil;};};
_customInit = if (count _this > 10) then { _this select 10; }else{nil;}; if(!isNil("_customInit"))then{if(_customInit == "nil0")then{_customInit = nil;};};
_grpId = if (count _this > 11) then { _this select 11; }else{nil;}; 

if(_cPos in allMapMarkers)then{
	_centerPos = getMarkerPos _cPos;
}else{
	if (typeName _cPos == "ARRAY") then{
		_centerPos = _cPos;
	}else{
		_centerPos = getPos _cPos;
	};
};

if(isNil("LV_ACskills"))then{LV_ACskills = compile preprocessFile "LV\LV_functions\LV_fnc_ACskills.sqf";};
if(isNil("LV_vehicleInit"))then{LV_vehicleInit = compile preprocessFile "LV\LV_functions\LV_fnc_vehicleInit.sqf";};

if(isNil("LV_fullLandVehicle"))then{LV_fullLandVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullLandVehicle.sqf";};
if(isNil("LV_fullAirVehicle"))then{LV_fullAirVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullAirVehicle.sqf";};
if(isNil("LV_fullWaterVehicle"))then{LV_fullWaterVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullWaterVehicle.sqf";};

if(typeName _menRatio == "ARRAY")then{	
	_menAmount = (_menRatio select 0) + (random (_menRatio select 1));
}else{
	_menAmount = round (_radius * _menRatio);
};
if(typeName _vehRatio == "ARRAY")then{	
	_vehAmount = (_vehRatio select 0) + (random (_vehRatio select 1));
}else{
	_vehAmount = round (_radius * _vehRatio);
};
_allUnitsArray = [];

_blueMenArray = ["B_Soldier_A_F","B_soldier_AR_F","B_medic_F","B_engineer_F","B_soldier_exp_F","B_Soldier_GL_F","B_soldier_M_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_soldier_repair_F","B_Soldier_F","B_soldier_LAT_F","B_Soldier_lite_F","B_Soldier_SL_F","B_Soldier_TL_F","B_soldier_AAR_F","B_soldier_AAA_F","B_soldier_AAT_F"];
_redMenArray = ["O_Soldier_A_F","O_soldier_AR_F","O_medic_F","O_engineer_F","O_soldier_exp_F","O_Soldier_GL_F","O_soldier_M_F","O_soldier_AA_F","O_soldier_AT_F","O_officer_F","O_soldier_repair_F","O_Soldier_F","O_soldier_LAT_F","O_Soldier_lite_F","O_Soldier_SL_F","O_Soldier_TL_F","O_soldier_AAR_F","O_soldier_AAA_F","O_soldier_AAT_F"];
_greenMenArray = ["I_Soldier_A_F","I_soldier_AR_F","I_medic_F","I_engineer_F","I_soldier_exp_F","I_Soldier_GL_F","I_soldier_M_F","I_soldier_AA_F","I_soldier_AT_F","I_officer_F","I_soldier_repair_F","I_Soldier_F","I_soldier_LAT_F","I_Soldier_lite_F","I_Soldier_SL_F","I_Soldier_TL_F","I_soldier_AAR_F","I_soldier_AAA_F","I_soldier_AAT_F"];
_yellowMenArray = ["C_man_p_beggar_F","C_man_1","C_man_polo_2_F","C_man_polo_3_F","C_man_polo_4_F","C_man_polo_5_F","C_man_polo_6_F",
"C_man_shorts_1_F","C_man_1_1_F","C_man_1_2_F","C_man_1_3_F","C_man_p_fugitive_F","C_man_p_shorts_1_F","C_man_hunter_1_F",
"C_man_pilot_F","C_man_shorts_2_F","C_man_shorts_3_F","C_man_shorts_4_F","C_man_w_worker_F",
"C_man_p_beggar_F_euro","C_man_1_euro","C_man_polo_2_F_euro","C_man_polo_3_F_euro","C_man_polo_4_F_euro","C_man_polo_5_F_euro","C_man_polo_6_F_euro",
"C_man_shorts_1_F_euro","C_man_p_fugitive_F_euro","C_man_p_shorts_1_F_euro","C_man_shorts_2_F_euro","C_man_shorts_3_F_euro","C_man_shorts_4_F_euro",
"C_man_p_beggar_F_afro","C_man_1_afro","C_man_polo_2_F_afro","C_man_polo_3_F_afro","C_man_polo_4_F_afro","C_man_polo_5_F_afro","C_man_polo_6_F_afro",
"C_man_shorts_1_F_afro","C_man_p_fugitive_F_afro","C_man_p_shorts_1_F_afro","C_man_shorts_2_F_afro","C_man_shorts_3_F_afro","C_man_shorts_4_F_afro",
"C_man_p_beggar_F_asia","C_man_1_asia","C_man_polo_2_F_asia","C_man_polo_3_F_asia","C_man_polo_4_F_asia","C_man_polo_5_F_asia","C_man_polo_6_F_asia",
"C_man_shorts_1_F_asia","C_man_p_fugitive_F_asia","C_man_p_shorts_1_F_asia","C_man_shorts_2_F_asia","C_man_shorts_3_F_asia","C_man_shorts_4_F_asia"];

_BLUdivers = ["B_diver_F","B_diver_exp_F","B_diver_TL_F"];
_OPFdivers = ["O_diver_F","O_diver_exp_F","O_diver_TL_F"];
_INDdivers = ["I_diver_F","I_diver_exp_F","I_diver_TL_F"];

_yellowCarArray = ["C_Offroad_01_F","C_Quadbike_01_F","C_Hatchback_01_F","C_Hatchback_01_sport_F","C_SUV_01_F","C_Van_01_transport_F","C_Van_01_box_F"];

switch (_side) do { 
    case 1: {
        _milHQ = createCenter west;
		if(isNil("_milGroup"))then{_milGroup = createGroup west;}else{_milGroup = _milGroup;};
        _menArray = _blueMenArray;
		_diveArray = _BLUdivers;
    }; 
    case 2: {
        _milHQ = createCenter east;
        if(isNil("_milGroup"))then{_milGroup = createGroup east;}else{_milGroup = _milGroup;};
        _menArray = _redMenArray;
		_diveArray = _OPFdivers;
    }; 
	case 3: {
        _milHQ = createCenter resistance;
        if(isNil("_milGroup"))then{_milGroup = createGroup resistance;}else{_milGroup = _milGroup;};
        _menArray = _greenMenArray;
		_diveArray = _INDdivers;
    }; 
    default {
        _milHQ = createCenter civilian;
        if(isNil("_milGroup"))then{_milGroup = createGroup civilian;}else{_milGroup = _milGroup;};
        _menArray = _yellowMenArray;
    }; 
};


if((_men select 0)||(_men select 1))then{
	for "_i" from 1 to _menAmount do{
		_validPos = false;
		while{!_validPos}do{
			_dir = random 360;
			_range = random _radius;
			_pos = [(_centerPos select 0) + (sin _dir) * _range, (_centerPos select 1) + (cos _dir) * _range, 0];
			
			if(_side > 0)then{
				if(surfaceIsWater _pos)then{
					if(_men select 1)then{
						_unitType = _diveArray select (floor(random(count _diveArray)));
						_validPos = true;
					};
				}else{
					if(_men select 0)then{
						_unitType = _menArray select (floor(random(count _menArray)));
						_validPos = true;
					};
				};
			}else{
				if(!surfaceIsWater _pos)then{
					_unitType = _menArray select (floor(random(count _menArray)));
					_validPos = true;
				};
			};
		};
		_unit = _milGroup createUnit [_unitType, _pos, [], 0, "NONE"];
		_unit setPos _pos;

		if(!_still)then{
			if(_unitType in _menArray)then{
				nul = [_unit,_cPos,_radius,_doorHandling] execVM "LV\patrol-vD.sqf";
			}else{
				nul = [_unit,_pos] execVM 'LV\patrol-vH.sqf';
			};
		};
		_unit allowDamage false;
		_allUnitsArray set [(count _allUnitsArray), _unit];
			
		_unit addMagazine "SmokeShell";
		_unit addMagazine ["Chemlight_green","Chemlight_red","Chemlight_yellow","Chemlight_blue"] call BIS_fnc_selectRandom;
	};
};

_milGroup setBehaviour "SAFE";

if((_vehicles select 0)||(_vehicles select 1)||(_vehicles select 2))then{
    for "_i" from 1 to _vehAmount do{
        	
		_validPos = false;
		while{!_validPos}do{
		
			_dir = random 360;
			_range = random _radius;
			_pos = [(_centerPos select 0) + (sin _dir) * _range, (_centerPos select 1) + (cos _dir) * _range, 0];
			
			if(_side > 0)then{
				if(surfaceIsWater _pos)then{
					if(_vehicles select 1)then{
						_driver = [_pos, (_side - 1)] call LV_fullWaterVehicle;
						if(!_still)then{nul = [vehicle _driver,_pos] execVM 'LV\patrol-vH.sqf';};
						_validPos = true;
					};
				}else{
					if((_vehicles select 0)&&(_vehicles select 2))then{
						_whichOne = floor(random 10);
						if(_whichOne < 3)then{
							_driver = [_pos, (_side - 1)] call LV_fullAirVehicle;
							if(!_still)then{nul = [_driver,_pos,[200,200]] execVM 'LV\patrol-vE.sqf';};
							vehicle _driver flyInHeight 10;
							_validPos = true;
						}else{
							_driver = [_pos, (_side - 1)] call LV_fullLandVehicle;
							if(!_still)then{nul = [vehicle _driver,_pos] execVM 'LV\patrol-vE.sqf';};
							_validPos = true;
						};
					}else{
						if(_vehicles select 0)then{
							_driver = [_pos, (_side - 1)] call LV_fullLandVehicle;
							if(!_still)then{nul = [vehicle _driver,_pos] execVM 'LV\patrol-vE.sqf';};
							_validPos = true;
						}else{
							if(_vehicles select 2)then{
								_driver = [_pos, (_side - 1)] call LV_fullAirVehicle;
								if(!_still)then{nul = [_driver,_pos,[200,200]] execVM 'LV\patrol-vE.sqf';};
								vehicle _driver flyInHeight 10;
								_validPos = true;
							};
						};
					};
				};
			}else{
				if(!surfaceIsWater _pos)then{
					_unitType = _yellowCarArray select (floor(random(count _yellowCarArray)));
					_vehicle = createVehicle [_unitType, _pos, [], 0, "NONE"]; 
					_crew = [_vehicle, _milGroup] call BIS_fnc_spawnCrew;
					_driver = driver _vehicle;
					if(!_still)then{nul = [_driver,_pos] execVM 'LV\patrol-vE.sqf';};
					_validPos = true;
				};
			};
		
		};
		 
		_vehicle = vehicle _driver;
        _vehicle allowDamage false;
        
        _allUnitsArray set [(count _allUnitsArray), _vehicle];
        
		(units(group _driver)) joinSilent _milGroup; 
    };
	_milGroup setVariable["allUnits",_allUnitsArray];
};

	{ 
		if((typeName _skills != "STRING")&&((side _x) != civilian))then{ _skls = [_x,_skills] call LV_ACskills; }; 
		if(!isNil("_customInit"))then{ 
			[_x,_customInit] spawn LV_vehicleInit;
		};
	} forEach units _milGroup;


sleep 3;
{
    _x allowDamage true;
}forEach _allUnitsArray;

if(!isNil("_grpId"))then{
	_thisArray = [];
	{ 
		if(isNil("_x"))then{
			_thisArray set[(count _thisArray),"nil0"];
		}else{
			_thisArray set[(count _thisArray),_x];
		};
	}forEach _this;
	call compile format["LVgroup%1CI = ['militarize',%2]",_grpId,_thisArray];
	call compile format["LVgroup%1spawned = 'true';", _grpId];
	call compile format ["LVgroup%1 = _milGroup",_grpId];
};

if(_smokesAndChems)then{
[_milGroup] spawn {
	private ["_grp","_chance"];
	_grp = _this select 0;
	while{(count units _grp) > 0}do{
			{
				if((behaviour _x) == "COMBAT")then{
					if(daytime > 23 || daytime < 5)then{
						_chance = floor(random 100);
						if(_chance < 3)exitWith{
							if("Chemlight_green" in (magazines _x))exitWith{
								_x fire ["ChemlightGreenMuzzle","ChemlightGreenMuzzle","Chemlight_green"];
							};
							if("Chemlight_red" in (magazines _x))exitWith{
								_x fire ["ChemlightRedMuzzle","ChemlightRedMuzzle","Chemlight_red"];
							};
							if("Chemlight_yellow" in (magazines _x))exitWith{
								_x fire ["ChemlightYellowMuzzle","ChemlightYellowMuzzle","Chemlight_yellow"];
							};
							if("Chemlight_blue" in (magazines _x))exitWith{
								_x fire ["ChemlightBlueMuzzle","ChemlightBlueMuzzle","Chemlight_blue"];
							};
						};
					};
					if("SmokeShell" in (magazines _x))exitWith{ 
						_chance = floor(random 100);
						if(_chance < 3)exitWith{
							_x fire ["SmokeShellMuzzle","SmokeShellMuzzle","SmokeShell"];
						};
					};
				};
			}forEach units _grp;
		sleep 10;
	};
};
};

7.NP_fnc_isPlayernear.sqf  Version: 1.0  Author: Na_Palm

//	Name: NP_fnc_isPlayernear.sqf
//	Version: 1.0
//	Author: Na_Palm
//	Description: returns true if a player is near the position, else false
//-------------------------------------------------------------------------------------
private["_players","_position","_distance","_isNear"];

_position = [_this, 0, [0,0,0], [[]], [2,3]] call BIS_fnc_param;
_distance = [_this, 1, 1000, [0]] call BIS_fnc_param;

if (isMultiplayer) then {
	_players = playableUnits;
}else{
	_players = switchableUnits;
};

_isNear = false;
{
	if ((isPlayer _x) && (alive _x)) then {
		if ((_x distance _position)< _distance) exitWith {
			_isNear = true;
		};
	};
	if _isNear exitWith {};
	sleep 0.001;
}forEach _players;
//return
_isNear;

8.REINFORCEMENT CHOPPER SCRIPT v2.2 - by SPUn / lostvar Position search parameters fix by -=XTRA=-

/*
				***		ARMA3Alpha REINFORCEMENT CHOPPER SCRIPT v2.0 - by SPUn / lostvar	***
	
/*
				***		ARMA3Alpha REINFORCEMENT CHOPPER SCRIPT v2.2 - by SPUn / lostvar	***
						Position search parameters fix by -=XTRA=-
	
				Spawns chopper which transports infantry group to position and leaves after that
				
		Calling the script:
		
			default: 		nul = [this] execVM "LV\reinforcementChopper.sqf";
			custom: 		nul = [spot,exact,side,type,captive,patrol,target,direction,distance,precise,
								cycle,groupSize,skills,smoke,group,custom init,ID,MP] execVM "LV\reinforcementChopper.sqf";
								
	Parameters:
	
	spot 	= 	landing spot 	(name of marker or object or unit, or position array) 									DEFAULT: this
	exact 	= 	true or false 	(true = tries landing exactly on *spot, false = finds place where it fits) 				DEFAULT: true
	side 	= 	1 or 2 or 3		(1 = west, 2 = east, 3 = independent)													DEFAULT: 2
	type 	= 	number 			(Depends on side)																		DEFAULT: 1
				WEST: 1 = B_Heli_Light_01_armed_F, 2 = B_Heli_Light_01_F, 3 = B_Heli_Transport_01_F
				EAST: 1 = O_Heli_Attack_02_F, 2 = O_Heli_Attack_02_black_F, 3 = O_Heli_Light_02_F, 4 = O_Heli_Light_02_unarmed_F
				INDEPENDENT: 1 = I_Heli_Transport_02_F
	captive = 	true/false 		(if true, enemies wont notice them before chopper has landed) 							DEFAULT: false
	patrol 	= 	true/false 		(if false, units wont patrol in any way <- handy if you set (group player) as *group) 	DEFAULT: true
	target 	= 	patrol target 	(patrolling target for infantry group, options:											DEFAULT: player
								unit 	= 	units name, ex: enemyunit1
								marker 	= 	markers' name, ex: "marker01" (remember quotes with markers!)
								marker array = array of markers in desired order, ex: ["marker01","marker02","marker03"]
								group	= 	groups name, ex: (group enemy1)	OR BlueGroup17
								group array, ex: [(group player), (group blue2)]
								["PATROL",center position,radius] = uses patrol-vD.sqf, ex: ["PATROL",(getPos player),150]
	direction 	= 	"random" or 0-360 (direction where chopper comes from, use quotes with random!) 									DEFAULT: "random"
	distance 	= 	number (from how far KA60 comes from) 																				DEFAULT: 1500
	precise 	= 	true or false (true = heli will land even in middle of war, false = heli might have air fights etc before landing) 	DEFAULT: true
	cycle 		= 	true or false (if true and target is array of markers, unit will cycle these markers) 								DEFAULT: false
	groupSize 	= 	1-8 (infantry groups' size) 																						DEFAULT: 8
	skills 		= 	"default" 	(default AI skills) 																					DEFAULT: "default"
				or	number	=	0-1.0 = this value will be set to all AI skills, ex: 0.8
				or	array	=	all AI skills invidiually in array, values 0-1.0, order:
						[aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, courage, commanding, general, endurance, reloadSpeed] 
						ex: 	[0.75,0.5,0.6,0.85,0.9,1,1,0.75,1,1] 					
	smoke		=	[LZ smoke, cover smokes, flare, chemlights] (if chopper uses these on landing spot)									DEFAULT: [false,false,false,false]
	group 		= 	group name OR nil (if you want units in existing group, set it here. if this is left empty, new group is made) 		DEFAULT: nil
	custom init = 	"init commands" (if you want something in init field of units, put it here) 										DEFAULT: nil
					NOTE: Keep it inside quotes, and if you need quotes in init commands, you MUST use ' or "" instead of ",
						 ex: "hint 'this is hint';"
	ID 			= 	number (if you want to delete units this script creates, you'll need ID number for them)							DEFAULT: nil
	MP			= 	true/false	true = 'landing spot' will automatically be one of alive non-captive players								DEFAULT: false
	
	EXAMPLE: 	nul = [player,false,2,3,false,true,player,"random",1000,true,false,8,0.75,[false,true,false,true],nil,nil,33,false] execVM "LV\reinforcementChopper.sqf";
*/
if (!isServer)exitWith{};
private ["_BLUmen3","_mp","_smoke","_INDchoppers","_BLUchoppers","_OPFchoppers","_OPFarrays","_BLUarrays","_INDgrp","_INDhq","_INDmen","_OPFmen2","_BLUmen2","_captive","_patrol","_heliT","_chopperTypes","_chopperType","_setInit2","_setInit","_c0","_customInit","_tPos","_exactPos","_skls","_skills","_grpSize","_cycle","_precise","_man2","_direction","_distance","_targetM","_i2","_heliPad","_targetPos","_side","_targetMarker","_BLUmen","_OPFmen","_men","_hq","_grp1","_grp2","_man1","_man","_dir","_range","_pos","_heli","_vehSpots","_i","_wp1"];

//Extra options:
_doorHandling = true;
//

//Check parameters:
_tPos = if (count _this > 0) then {_this select 0};
_exactPos = if (count _this > 1) then {_this select 1; }else{true;};
_side = if (count _this > 2) then {_this select 2; }else{2;};
_chopperType = if (count _this > 3) then {_this select 3; }else{3;};
_captive = if (count _this > 4) then {_this select 4; }else{false;};
_patrol = if (count _this > 5) then {_this select 5; }else{true;};
_targetMarker = if (count _this > 6) then {_this select 6; }else{player;};
_direction = if (count _this > 7) then {_this select 7; }else{"random";};
_distance = if (count _this > 8) then {_this select 8; }else{1500;};
_precise = if (count _this > 9) then {_this select 9; }else{true;};
_cycle = if (count _this > 10) then {_this select 10; }else{false;};
_grpSize = if (count _this > 11) then {_this select 11; }else{8;};
_skills = if (count _this > 12) then {_this select 12; }else{"default";};
_smoke = if (count _this > 13) then {_this select 13; }else{[false,false,false,false];};
_grp2 = if (count _this > 14) then {_this select 14; }else{nil;};
_customInit = if (count _this > 15) then {_this select 15; }else{nil;};
_grpId = if (count _this > 16) then { _this select 16;} else {nil};
_mp = if (count _this > 17) then { _this select 17;} else {false};

if(_mp)then{if(isNil("LV_GetPlayers"))then{LV_GetPlayers = compile preprocessFile "LV\LV_functions\LV_fnc_getPlayers.sqf";};};

if(_mp)then{
	_tPos = call LV_GetPlayers;
	_targetPos = getPos(_tPos call BIS_fnc_selectRandom);
}else{
	//Check if spot is marker, object, or position array:
	if(_tPos in allMapMarkers)then{
		_targetPos = getMarkerPos _tPos;
	}else{
		if (typeName _tPos == "ARRAY") then{
			_targetPos = _tPos;
		}else{
			_targetPos = getPos _tPos;
		};
	};
};

//LZ smoke
if((_smoke select 0))then{
	[_targetPos,_distance] spawn {
		private["_targetPos","_a","_timesLimit","_distance"];
		_targetPos = _this select 0;
		_distance = _this select 1;
		_a = 0;
		_timesLimit = ceil(_distance / 1000);
		while{_a < _timesLimit}do{
			_smoke1 = "SmokeShellGreen" createVehicle _targetPos;
			sleep 50;
			_a = _a + 1;
		};
	};
};

//Prepare functions:
if(isNil("LV_ACskills"))then{LV_ACskills = compile preprocessFile "LV\LV_functions\LV_fnc_ACskills.sqf";};
if(isNil("LV_RandomSpot"))then{LV_RandomSpot = compile preprocessFile "LV\LV_functions\LV_fnc_randomSpot.sqf";};
if(isNil("LV_vehicleInit"))then{LV_vehicleInit = compile preprocessFile "LV\LV_functions\LV_fnc_vehicleInit.sqf";};

//Unit arrays:
_BLUmen = ["B_Soldier_A_F","B_soldier_AR_F","B_medic_F","B_engineer_F","B_soldier_exp_F","B_Soldier_GL_F","B_soldier_M_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_soldier_repair_F","B_Soldier_F","B_soldier_LAT_F","B_Soldier_lite_F","B_Soldier_SL_F","B_Soldier_TL_F","B_soldier_AAR_F","B_soldier_AAA_F","B_soldier_AAT_F"];
_BLUmen2 = ["B_recon_exp_F","B_recon_JTAC_F","B_recon_M_F","B_recon_medic_F","B_recon_F","B_recon_LAT_F","B_recon_TL_F","B_soldier_AAR_F","B_soldier_AAA_F","B_soldier_AAT_F"];
_BLUmen3 = ["B_G_Soldier_A_F","B_G_soldier_AR_F","B_G_medic_F","B_G_engineer_F","B_G_soldier_exp_F","B_G_Soldier_GL_F","B_G_soldier_M_F","B_G_officer_F","B_G_Soldier_F","B_G_soldier_LAT_F","B_G_Soldier_lite_F","B_G_Soldier_SL_F","B_G_Soldier_TL_F"];
_BLUarrays = [_BLUmen,_BLUmen2,_BLUmen3];
_OPFmen = ["O_Soldier_A_F","O_soldier_AR_F","O_medic_F","O_engineer_F","O_soldier_exp_F","O_Soldier_GL_F","O_soldier_M_F","O_soldier_AA_F","O_soldier_AT_F","O_officer_F","O_soldier_repair_F","O_Soldier_F","O_soldier_LAT_F","O_Soldier_lite_F","O_Soldier_SL_F","O_Soldier_TL_F","O_soldier_AAR_F","O_soldier_AAA_F","O_soldier_AAT_F"];
_OPFmen2 = ["O_recon_exp_F","O_recon_JTAC_F","O_recon_M_F","O_recon_medic_F","O_recon_F","O_recon_LAT_F","O_recon_TL_F","O_soldier_AAR_F","O_soldier_AAA_F","O_soldier_AAT_F"];
_OPFarrays = [_OPFmen,_OPFmen2];
_INDmen = ["I_Soldier_A_F","I_soldier_AR_F","I_medic_F","I_engineer_F","I_soldier_exp_F","I_Soldier_GL_F","I_soldier_M_F","I_soldier_AA_F","I_soldier_AT_F","I_officer_F","I_soldier_repair_F","I_Soldier_F","I_soldier_LAT_F","I_Soldier_lite_F","I_Soldier_SL_F","I_Soldier_TL_F","I_soldier_AAR_F","I_soldier_AAA_F","I_soldier_AAT_F"];

_BLUchoppers = ["B_Heli_Light_01_armed_F","B_Heli_Light_01_F","B_Heli_Transport_01_F"];
_OPFchoppers = ["O_Heli_Attack_02_F","O_Heli_Attack_02_black_F","O_Heli_Light_02_F","O_Heli_Light_02_unarmed_F"];
_INDchoppers = ["I_Heli_Transport_02_F"];

_chopperTypes = [];

//Side related group creation:
switch(_side)do{
	case 1:{
		_hq = createCenter west;
		_grp1 = createGroup west;
		if(isNil("_grp2"))then{_grp2 = createGroup west;}else{_grp2 = _grp2;};
		_men = (_BLUarrays call BIS_fnc_selectRandom);
		_chopperTypes = _BLUchoppers;
	};
	case 2:{
		_hq = createCenter east;
		_grp1 = createGroup east;
		if(isNil("_grp2"))then{_grp2 = createGroup east;}else{_grp2 = _grp2;};
		_men = (_OPFarrays call BIS_fnc_selectRandom);
		_chopperTypes = _OPFchoppers;
	};
	case 3:{
		_hq = createCenter resistance;
		_grp1 = createGroup resistance;
		if(isNil("_grp2"))then{_grp2 = createGroup resistance;}else{_grp2 = _grp2;};
		_men = _INDmen;
		_chopperTypes = _INDchoppers;
	};
};

//If *exact* is false, find landing spot which is not close another ones: //THIS block is fixed by GITS, now choppers should land!
if(!_exactPos)then{
            if(isNil("REKA60padArray"))then{REKA60padArray = [];};
            _finding = 1;
            _ra = 20;//here
            while{_finding > 0}do{
     
                    _tPos = [];
                    while{count _tPos < 1}do{
                            _spot = [_targetPos, _ra] call LV_RandomSpot;
                            _tPos = _spot isflatempty [12,0,0.3,4,0,false,objnull];///here
                            _ra = _ra + 10;//here
                    };
     
                    sleep 0.001;
                    _targetPos = _tPos;
                    _e1 = 0;
                    _finding = 0;
     
                    while{_e1<(count REKA60padArray)}do{
                            if(((REKA60padArray select _e1) distance _targetPos)<15)then{_finding = 1;};
                            _e1 = _e1 + 1;
                    };
            };
            REKA60padArray set [(count REKA60padArray), _targetPos];
};



_heliT = _chopperTypes select (_chopperType - 1);
_heliPad = createVehicle ["Land_helipadEmpty_F", _targetPos, [], 0, "NONE"]; 

if(typeName _direction == "STRING")then{_dir = random 360;}else{_dir = _direction;};
_range = _distance;
_pos = [(_targetPos select 0) + (sin _dir) * _range, (_targetPos select 1) + (cos _dir) * _range, 0];
_heli = createVehicle [_heliT, _pos, [], 0, "FLY"];

if(_grpSize > (getNumber (configFile >> "CfgVehicles" >> _heliT >> "transportSoldier")))then{
	_vehSpots = getNumber (configFile >> "CfgVehicles" >> _heliT >> "transportSoldier");
}else{
	_vehSpots = _grpSize;
};

_man1 = _men select (floor(random(count _men)));
_man = _grp1 createUnit [_man1, _pos, [], 0, "NONE"];
_man moveInDriver _heli;
_man setUnitRank "SERGEANT";
if(_precise)then{_man setBehaviour "CARELESS";};

[_man,_heli,_targetPos] spawn {
	_man = _this select 0;
	_heli = _this select 1;
	_targetPos = _this select 2;
	waitUntil {sleep 1; !isNil "_man" && !isNil "_heli"};
	waitUntil {sleep 1; !alive _man || !canMove _heli || isNil "_man" || isNil "_heli"};
	if (true) exitWith {
		if (!isNil "_targetPos" && !isNil "REKA60padArray") then {
			if ((_heli distance _targetPos) > 50)then{REKA60padArray = REKA60padArray - [_targetPos];};
		};
		if(_heli distance _targetPos > 200)then{
			sleep 15;
			deleteVehicle _man;
			sleep 15;
			deleteVehicle _heli;
		};
	};
};

_i = 1; 
for "_i" from 1 to _vehSpots do {
	_man1 = _men select (floor(random(count _men)));
	_man2 = _grp2 createUnit [_man1, _pos, [], 0, "NONE"];
	if(typeName _skills != "STRING")then{_skls = [_man2,_skills] call LV_ACskills;};
	_man2 moveInCargo _heli;
	if(!isNil("_customInit"))then{ 
		[_man2,_customInit] spawn LV_vehicleInit;
	};
};
if((_vehSpots == 0)&&(_grpSize > 0))then{
	_man1 = _men select (floor(random(count _men)));
	_man2 = _grp2 createUnit [_man1, _pos, [], 0, "NONE"];
	if(typeName _skills != "STRING")then{_skls = [_man2,_skills] call LV_ACskills;};
	_man2 moveInTurret [_heli, [0]];
	if(!isNil("_customInit"))then{ 
		[_man2,_customInit] spawn LV_vehicleInit;
	}; 
};

if(!isNil("_grpId"))then{
	call compile format ["LVgroup%1 = _grp2",_grpId];
};

if(_captive)then{
	{ _x setCaptive true; }forEach units _grp1;
	{ _x setCaptive true; }forEach units _grp2;
};

_heli doMove _targetPos;
while { _heli distance _targetPos > 260 } do { sleep 4; };
doStop _heli;
_heli land "LAND"; //you can also try "GET OUT" (then it wont land, only hovers)
while { (getPos _heli) select 2 > 3 } do { sleep 2; };

if((_smoke select 1))then{//Cover smoke
	[_targetPos,_heli] spawn {
		private["_targetPos","_a","_dir","_heli"];
		_targetPos = _this select 0;
		_heli = _this select 1;
		_dir = 0;
		_a = 0;
		while{_a < 16}do{
			_sPos = [((getPos _heli) select 0) + (sin _dir) * 12, ((getPos _heli) select 1) + (cos _dir) * 12, ((getPos _heli) select 2)];
			_smoke1 = "SmokeShell" createVehicle _sPos;
			_a = _a + 1;
			_dir = _dir + (360 / 16);
		};
	};
};
if((_smoke select 2))then{//Flare
	[_heli] spawn {
		private["_heli"];
		_heli = _this select 0;
		_flare = "F_40mm_Red" createVehicle [(getPos _heli) select 0,(getPos _heli) select 1,0];
	};
};
if((_smoke select 3))then{//Chemlights
		[_targetPos,_heli] spawn {
		private["_targetPos","_a","_dir","_heli"];
		_targetPos = _this select 0;
		_heli = _this select 1;
		_dir = 0;
		_a = 0;
		while{_a < 8}do{
			_sPos = [((getPos _heli) select 0) + (sin _dir) * 12, ((getPos _heli) select 1) + (cos _dir) * 12, ((getPos _heli) select 2)];
			_smoke1 = "Chemlight_red" createVehicle _sPos;
			_a = _a + 1;
			_dir = _dir + (360 / 8);
		};
	};
};

while { (getPos _heli) select 2 > 1 } do { sleep 1; };

if(_captive)then{
	{ _x setCaptive false; }forEach units _grp1;
	{ _x setCaptive false; }forEach units _grp2;
};

_grp2 leaveVehicle _heli;
{
	unassignVehicle _x;
	doGetOut _x; 
	_x setBehaviour "AWARE";
} forEach units _grp2;
_grp2 setCombatMode "RED";
while { (count (crew _heli)) > 1 } do { sleep 2;  };
_heli doMove _pos;



if(_patrol)then{
	if(typeName _targetMarker == "ARRAY")then{ //TARGET is array
		if((!((_targetMarker select 0) in allMapMarkers))&&(!((_targetMarker select 0) in allGroups)))then{
			if((typeName (_targetMarker select 0)) == "STRING")then{
				if((_targetMarker select 0) == "PATROL")then{ ////USE patrol-vD.sqf
					{
						_cPosition = _targetMarker select 1;
						_cRadius = _targetMarker select 2;
						nul = [_x,_cPosition,_cRadius,_doorHandling] execVM "LV\patrol-vD.sqf";
					}forEach units _grp2;
				};
			};
		}else{ //TARGET is array of Markers or Groups
			{ 
				_x setVariable ["target0",_targetMarker,false];
				_x setVariable ["mDis0", 1000, false];
				if(_cycle)then{
					nul = [_x,true] execVM "LV\LV_functions\LV_fnc_follow.sqf";
				}else{
					nul = [_x,false] execVM "LV\LV_functions\LV_fnc_follow.sqf";
				};
				sleep 2;
			}forEach units _grp2;
		};
	}else{
		if(_targetMarker in allMapMarkers)then{ /////TARGET is single Marker
			{ _x doMove getMarkerPos _targetMarker; } forEach units _grp2;
		}else{
				{ ////TARGET is single Unit/Object
					_x setVariable ["target0",_targetMarker,false];
					_x setVariable ["mDis0", 1000, false];
					nul = [_x] execVM "LV\LV_functions\LV_fnc_follow.sqf";
				}forEach units _grp2;
		};
	};
}else{
	//If patrol is set to false, units will idle. Additionally you can set custom actions here:
	
};

while { (_heli distance _pos > 200) } do { sleep 4; };

if((!_exactPos)&&((_heli distance _targetPos) > 50))then{REKA60padArray = REKA60padArray - [_targetPos];};

if((_heli distance _pos < 200))exitWith{
	deleteVehicle _man;
	deleteVehicle _heli;
	waituntil {sleep 1;(count units _grp1)==0};
    	deletegroup _grp1; 
};


Sorry for the long  Post but I could not UPLOAD a link with all eight files however now all the UPDATED files will always be here unlike the other links that are down or deleted now. HOPE THIS HELPS. Avibird

Share this post


Link to post
Share on other sites

I want to add say a ai fireteam to a players group during a mission from a menu trigger. Any advice guys?

Share this post


Link to post
Share on other sites

ok, sry am trying to understand the whole trigger Act for this script. Apparently, under FAQ for online doc....

Q: How to add script in Trigger?
If script's calling line goes like: nul = [this,1,50..] execVM... then usually you can just put the same line into Triggers' ON ACT -field and replace this with target objects name.
Add for example Game Logic there where you want this script to be located and name it gamelog01, and then call the script from trigger: nul = [gamelog01,1,50..] execVM.... In militarize, fillHouse and reinforcementChopper the first argument is target location/object/marker.

huh? lol

 

cant i just use normal code for this script in triggers? I have tried and it does not work. So... I only want to use heli drop, reinforcement and ambient combat codes.... do I need to change "this" to "player" or something?

 

thanks!

 

victor, do you want to just spawn in a AI grouped to player? that  sounds separate to this script.

If so, i would google/look up create group, join silent, dynamic AI spawn, there are most likely a lot of threads to that.

 

Updated:

 

Getting this error with reinforcement script.

if(!isN>
11:26:13   Error position: <_man1, _pos, [], 0, "NONE"];
};

if(!isN>
11:26:13   Error Undefined variable in expression: _man1
11:26:13 Error in expression <(count _men)));
_man = _grp createUnit [_man1, _pos, [], 0, "NONE"];
};

if(!isN>
11:26:13   Error position: <_man1, _pos, [], 0, "NONE"];
};

if(!isN>
11:26:13   Error Undefined variable in expression: _man1
11:26:13 Error in expression <(count _men)));
_man = _grp createUnit [_man1, _pos, [], 0, "NONE"];
};

Share this post


Link to post
Share on other sites

use this app to set up different task  http://lostvar.com/AISSP/AISSP.html     and then copy the line on the bottom to the activation field of the trigger  it should work

 

Per this.... something needs to be changed. the below is part of OP instruction guide. I have lines setup via that link anyhow and does not work via trigger as is. It seems something needs to change. ie the below directions. Other than that there is also an error from reinforcement script if anyone wants to fix.

Q: How to add script in Trigger?
If script's calling line goes like: nul = [this,1,50..] execVM... then usually you can just put the same line into Triggers' ON ACT -field and replace this with target objects name.
Add for example Game Logic there where you want this script to be located and name it gamelog01, and then call the script from trigger: nul = [gamelog01,1,50..] execVM.... In militarize, fillHouse and reinforcementChopper the first argument is target location/object/marker.

Getting this error with reinforcement script.

if(!isN>
11:26:13   Error position: <_man1, _pos, [], 0, "NONE"];
};

if(!isN>
11:26:13   Error Undefined variable in expression: _man1
11:26:13 Error in expression <(count _men)));
_man = _grp createUnit [_man1, _pos, [], 0, "NONE"];
};

if(!isN>
11:26:13   Error position: <_man1, _pos, [], 0, "NONE"];
};

if(!isN>
11:26:13   Error Undefined variable in expression: _man1
11:26:13 Error in expression <(count _men)));
_man = _grp createUnit [_man1, _pos, [], 0, "NONE"];
};

Share this post


Link to post
Share on other sites

hello guys, I'm trying to merge the Heli Paradrop script from http://lostvar.com/AISSP/AISSP.html  with the A3 wounding System script from https://forums.bistudio.com/topic/161291-a3-wounding-system/ . In A3 wonding system script I saw that all players and AI's have in their init "this setGroupID [" Alpha "];" is correct I put "this setGroupID [" Alpha "];" in custom init AISSP (Heli Paradrop)? I did it and reinforcement not work. Thank you.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×