Jump to content
Donnovan

Andre Aerial Patrol - [Coconut Release] - Any Map

Recommended Posts

this works perfectly i dont see how you cannot get this to work anyways heres my code

 

server side sqf file

if (isServer) then {
	_gridN = 15;
	_mapSize = 20479; //Napf
	donn_hwps = [];
	for "_i" from 1 to (_gridN - 1) do {
		_wpx = (_i/_gridN)*_mapSize;
		for "_y" from 1 to (_gridN - 1) do {
			_wpy = (_y/_gridN)*_mapSize;
			if !(surfaceIsWater [_wpx,_wpy]) then {donn_hwps = donn_hwps + [[_wpx,_wpy,0]];};
		};
	};
	donn_heliConvy = [
		/*0*/["UH1H_DZ",0,["100Rnd_762x51_M240","100Rnd_762x51_M240"],3],
		/*1*/["UH1H_DZ",4,[],4],
		/*2*/["Mi17_TK_EP1",5,["100Rnd_762x51_M240","100Rnd_762x51_M240"],5],
		/*3*/["CH_47F_EP1_DZE",6,["100Rnd_762x51_M240","4000Rnd_762x51_M134","4000Rnd_762x51_M134"],6],
		/*4*/["AH6J_EP1_DZ",1,[],2] //ARMED (PILOT)
	];
	//HELI MAIN CONFIG BEGIN
	_heliFormation =[[0,0,2],[2,2],[4,4,4,4,4],[3],[3],[1,1]];
	_heliAltitude =[[60,60,115],[100,100],[50,50,50,50,50],[100],[100],[115,115]];
	_heliSpeed =["NORMAL","NORMAL","FULL","LIMITED","NORMAL","FULL"];
	//HELI MAIN CONFIG END
	_spawn = [100,100,400];
	donn_heli_HD = {
		_heliHurt = _this select 0;
		_damage = _this select 2;
		if !(canMove _heliHurt) then {
			if (_heliHurt getVariable "dncmv") then {
				_heliHurt setVariable ["dncmv",false,false];
				{
					if (random 100 > 50) then {_x action ["Eject",_heliHurt];} else {_x setPos getPos _heliHurt;};
				} forEach crew _heliHurt;
			};
		};
		_damage
	};
	donn_heli_unit_HD = {
		_hurtedOne = _this select 0;
		_damage = _this select 2;
		_ofender = _this select 3;
		_grp = group _hurtedOne;
		if (combatMode _grp != "RED" && isPlayer _ofender) then {
			{_x enableAi "TARGET";} forEach units _grp;
			{_x enableAi "AUTOTARGET";} forEach units _grp;
			_grp reveal [_ofender,1.5];
			_grp setCombatMode "RED";_grp setBehaviour "COMBAT";
		};
		_damage
	};	
	donn_heli_unitKill = {
		_unit = _this select 0;
		_role = assignedVehicleRole _unit;
		if ((assignedVehicleRole _unit) select 0 == "Driver") then {
			_vehEject = assignedVehicle _unit;
			{
				if (random 100 > 40) then {_x action ["Eject",_vehEject];} else {_x setPos getPos _vehEject};
			} forEach crew _vehEject;
		};
		if ({alive _x} count units group _unit == 0) then {donn_heliGrps = donn_heliGrps - [group _unit];};
		_unit setVariable ["cashMoney",2500 + (round random 5) * 1000,true];
	};
	donn_makeAeroRoute = {
		_origin = _this select 0;
		_heli_group = _this select 1;
		_speed = _this select 2;
		_posBefore = _origin;
		_posNow = _origin;
		_wp = _heli_group addWaypoint [_posNow,0,0];
		_wp setWaypointCompletionRadius 65;
		_wp setWaypointType "MOVE";
		_wp setWaypointSpeed _speed;
		_posNext = [0,0,0];
		for "_c" from 1 to 5 do {
			_distToBefore = 0;
			_distToNext = 0;
			_found = false;
			for "_x" from 1 to 200 do {
				_posNext = donn_hwps call BIS_fnc_selectRandom;
				_distToNext = _posNow distance _posNext;
				_distToBefore = _posNext distance _posBefore;
				if (_distToNext > 3000 && _distToBefore > 4000) exitWith {};
				uiSleep 0.001;
			};
			if (!_found) then {_posNext = donn_hwps call BIS_fnc_selectRandom;};
			_wp = _heli_group addWaypoint [_posNext,0,_c];
			_wp setWaypointCompletionRadius 65;
			_wp setWaypointType "MOVE";
			_wp setWaypointSpeed _speed;
			_posNow = _posNext;
		};
		_wp = _heli_group addWaypoint [_origin,0,6];
		_wp setWaypointCompletionRadius 65;
		_wp setWaypointType "CYCLE";
		_wp setWaypointSpeed _speed;
	};
	donn_heliGrps = [];
	[] spawn {
		while {{!isNull _x} count donn_heliGrps > 0} do {
			{
				_grp = _x;
				_forceIn = true;
				{
					if (_grp knowsAbout _x >= 1.5) then {_grp reveal [_x,4];_forceIn = false;};
				} forEach playableUnits;
				if (_forceIn) then {
					if (combatMode _grp != "BLUE") then {
						{_x disableAi "TARGET";uiSleep 0.001;} forEach units _grp;
						{_x disableAi "AUTOTARGET";uiSleep 0.001;} forEach units _grp;
						//_grp setCombatMode "BLUE";_grp setBehaviour "CARELESS";
						_grp setCombatMode "YELLOW";_grp setBehaviour "COMBAT";
					};
					{
						if (vehicle _x == _x) then {[_x] orderGetIn true;uiSleep 0.001;};
					} forEach units _grp;
				};
			} forEach donn_heliGrps;	
			uiSleep 10;
		};
		diag_log "[AI HELI CONFIG] FINISHED.";
	};
	for "_cs" from 1 to (count _heliFormation) do {
		diag_log ("[HELI CONVOY] Initialized Spawn! " + str _cs);
		_heli_group = createGroup EAST;
		donn_heliGrps = donn_heliGrps + [_heli_group];
		_convoy = _heliFormation select (_cs-1);
		_convoyH = _heliAltitude select (_cs-1);
		_convoyS = _heliSpeed select (_cs-1);
		_qtd = count _convoy;
		_helis = [];
		{_helis = _helis + [donn_heliConvy select _x];} forEach _convoy;
		for "_n" from 1 to _qtd do {
			private ["_firstDriver"];
			_heli = _helis select (_n-1);
			_flyHeight = _convoyH select (_n-1);
			_motor = createVehicle [_heli select 0,_spawn,[],50,"FLY"];
			// UPDATE //
			dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_motor];
			{deleteVehicle _x;} forEach crew _motor;
			_motor removeAllEventHandlers "handleDamage";
			_motor addEventHandler ["handleDamage",{_this call donn_heli_HD}];
			_motor setVariable ["dncmv",true,false];
			_motor setVariable ["dnishp",true,true];
			_motor setVariable ["dnishpq",_heli select 3,true];
			_motor setFuel 1;
			_motor setVehicleLock "LOCKED";
			_motor flyInHeight _flyHeight;
			_ammos = _heli select 2;
			{_ammo = _x;for "_a" from 1 to 8 do {_motor addMagazineTurret [_ammo,[_forEachIndex]];};} forEach _ammos;
			_driverCount = 1;
			_turreterCount = count _ammos;
			_cargorsCount = _heli select 1;
			_crewCount = _driverCount + _turreterCount + _cargorsCount;
			_gunnerPos = 0;
			for "_y" from 1 to _crewCount do {
				_unit = _heli_group createUnit ["gsc_eco_stalker_mask_duty",[50,50,0],[],50,"PRIVATE"];
				_unit removeAllEventHandlers "killed";
				_unit removeAllEventHandlers "handleDamage";
				_unit addEventHandler ["killed",{_this call donn_heli_unitKill;}];
				_unit addEventHandler ["handleDamage",{_this call donn_heli_unit_HD}];
				[_unit] joinSilent _heli_group;
				_unit setSkill 0.85;
				removeAllWeapons _unit;
				{_unit removeMagazine _x} forEach magazines _unit;
				_unit addWeapon "RPK_74";
				_unit selectWeapon "RPK_74";
				for "_pa" from 1 to 2 do {_unit addMagazine "75Rnd_545x39_RPK";};			
				if (_y == 1) then {
					_unit assignAsDriver _motor;
					_unit moveInDriver _motor;
					_unit setSkill ["aimingAccuracy",0.65];
				};
				if (_y > 1 && _y <= 1 + _turreterCount) then {
					_unit assignAsGunner _motor;
					_unit moveInTurret [_motor,[_gunnerPos]];
					_gunnerPos = _gunnerPos + 1;
					_unit setSkill ["aimingAccuracy",1];
				};
				if (_y > 1 + _turreterCount) then {
					_unit assignAsCargo _motor;
					_unit moveInCargo _motor;
					_unit setSkill ["aimingAccuracy",0.65];
				};
			};
			{_x disableAi "TARGET";uiSleep 0.001;} forEach units _heli_group;
			{_x disableAi "AUTOTARGET";uiSleep 0.001;} forEach units _heli_group;
			_heli_group setCombatMode "BLUE";_heli_group setBehaviour "CARELESS";
			_sphere = createVehicle ["Sign_sphere100cm_EP1",[0,0,0],[],0,"CAN_COLLIDE"];
			_sphere attachTo [_motor,[0,0,3]];
		};
		[donn_hwps call BIS_fnc_selectRandom,_heli_group,_convoyS] call donn_makeAeroRoute;
		uiSleep (60*20);
	};
};

mission side

andre_heliConvoy_items.sqf

/*
_motor = _this select 3;
_qLoot = _motor getVariable "dnishpq";
_loot1 = [
	[["addWeaponCargoGlobal","Mk_48_DZ",[1,1,2]],["addMagazineCargoGlobal","100Rnd_762x51_M240",[1,2,3]]],	//Maried Loot
	[["addWeaponCargoGlobal","M249_DZ",[1,1,2]],["addMagazineCargoGlobal","200Rnd_556x45_M249",[1,2,3]]],	//Maried Loot
	[["addWeaponCargoGlobal","G36C",[1,1,2]],["addMagazineCargoGlobal","30Rnd_556x45_Stanag",[2,3,4]]],		//Maried Loot
	[["addWeaponCargoGlobal","DMR_DZ",[1,1,2]],["addMagazineCargoGlobal","20Rnd_762x51_DMR",[3,4,5]]],		//Maried Loot
	[["addWeaponCargoGlobal","AK_47_M",[1,1,2]],["addMagazineCargoGlobal","30Rnd_762x39_AK47",[2,3,4]]],	//Maried Loot
	[["addWeaponCargoGlobal","NVGoggles",[2,3,4]]],
	[["addWeaponCargoGlobal","ItemEtool",[2,3,4]]],
	[["addWeaponCargoGlobal","Binocular_Vector",[2,3,4]]],
	[["addMagazineCargoGlobal","ItemBloodBag",[6,8,10]]],
	[["addMagazineCargoGlobal","PartEngine",[2,3,4]]],
	[["addMagazineCargoGlobal","ItemBandage",[10,15,20]]],
	[["addMagazineCargoGlobal","HandGrenade_West",[3,5,7]]],
	[["addMagazineCargoGlobal","ItemBriefcase100oz",[1,1,2]]]
];
if (_qLoot > 0) then {
	for "_i" from 1 to _qLoot do {
		_holder = createVehicle ["WeaponHolder",position player,[],1.5,"CAN_COLLIDE"];
		{
			call compile format [
				"_holder %1 ['%2',%3];",
				_x select 0,
				_x select 1,
				(_x select 2) call BIS_fnc_selectRandom
			];
		} forEach (_loot1 call BIS_fnc_selectRandom);
	};
	_motor setVariable ["dnishpq",0,true];
};
*/
//Original by Donnavan
//Modified by salival for better loot control
//find_suitable_ammunition from WAI, uses the same variables (but in this file instead since these are clientside)
//Edit the variables to suit your needs, the crate will spawn behind the player.

find_suitable_ammunition = {

	private["_weapon","_result","_ammoArray"];

	_result 	= false;
	_weapon 	= _this;
	_ammoArray 	= getArray (configFile >> "cfgWeapons" >> _weapon >> "magazines");

	if (count _ammoArray > 0) then {
		_result = _ammoArray select 0;
		call {
			if(_result == "20Rnd_556x45_Stanag") 	exitWith { _result = "30Rnd_556x45_Stanag"; };
			if(_result == "30Rnd_556x45_G36") 		exitWith { _result = "30Rnd_556x45_Stanag"; };
			if(_result == "30Rnd_556x45_G36SD") 	exitWith { _result = "30Rnd_556x45_StanagSD"; };
		};
	};
	_result
};

private ["_crate_type","_crate","_num_weapons","_weapon","_ammo"];

//Edit the variables below to suit your needs
_crate_type 	= "USOrdnanceBox"; //this needs to be whitelisted in your battleye filters (createvehicle.txt) - you can do so by adding !="USOrdnanceBox" to a line that starts with 5. i.e 5 !="USOrdnanceBox"
_crate_items					= ["FoodMRE","ItemSodaOrangeSherbet","ItemSodaPepsi","ItemBandage","ItemSodaCoke","FoodCanBakedBeans","FoodCanPasta","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemHeatPack","ItemMorphine","CinderBlocks","ItemComboLock","ItemLightBulb","ItemLockbox","ItemSandbag","ItemTankTrap","ItemWire","MortarBucket","PartGeneric","PartGlass","PartPlankPack","ItemBriefcase100oz","ItemBriefcase100oz","ItemBriefcase100oz","ItemBriefcase100oz"];

_ai_wep_assault				= ["M16A4_ACG","Sa58V_RCO_EP1","SCAR_L_STD_Mk4CQT","M8_sharpshooter","M4A1_HWS_GL_camo","SCAR_L_STD_HOLO","M4A3_CCO_EP1","M4A3_CCO_EP1","M4A1_AIM_SD_camo","M16A4","m8_carbine","BAF_L85A2_RIS_Holo","Sa58V_CCO_EP1"];	// Assault
_ai_wep_machine				= ["MK_48_DZ","M249_EP1_DZ","Pecheneg_DZ","M240_DZ"];	// Light machine guns
_ai_wep_sniper				= ["M14_EP1","HUNTINGRIFLE","M4SPR","M24","M24_DES_EP1","SCAR_H_LNG_Sniper_SD","M110_NVG_EP1","SVD_CAMO","VSS_Vintorez","DMR_DZ","M40A3","KSVK_DZE","BAF_LRR_SCOPED"];	// Sniper rifles
_ai_wep_random				= _ai_wep_assault + _ai_wep_assault + _ai_wep_sniper + _ai_wep_machine;	

_motor = _this select 3;

player playActionNow "Medic";
uisleep 10;

_position = [(position player select 0) - (sin(getdir player)*2), (position player select 1) - (cos(getdir player)*2), (position player select 2)];
_dir = getDir player;

_crate 			= createVehicle [_crate_type,_position,[],0,"CAN_COLLIDE"];

_crate setVariable ["ObjectID","1",true];
_crate setVariable ["permaLoot",true];

_num_weapons	= 6;
_num_items	= 14;
_item_array	= _crate_items;

PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_crate];

clearWeaponCargoGlobal _crate;
clearMagazineCargoGlobal _crate;

if(_num_weapons > 0) then {

	_num_weapons = (ceil((_num_weapons) / 2) + floor(random (_num_weapons / 2)));

	for "_i" from 1 to _num_weapons do {
		_weapon = _ai_wep_random call BIS_fnc_selectRandom;
		_ammo = _weapon call find_suitable_ammunition;
		_crate addWeaponCargoGlobal [_weapon,1];
		_crate addMagazineCargoGlobal [_ammo, (1 + floor(random 5))];
	};
};

if(_num_items > 0) then {
	_num_items	= (ceil((_num_items) / 2) + floor(random (_num_items / 2)));
	for "_i" from 1 to _num_items do {
		_item = _item_array call BIS_fnc_selectRandom;
		if(typeName (_item) == "ARRAY") then {
			_crate addMagazineCargoGlobal [_item select 0,_item select 1];
		} else {
			_crate addMagazineCargoGlobal [_item,1];
		};
	};
};

_motor setVariable ["dnishpq",0,true];

if (alive _motor) then { systemChat "You manage to find a loot crate in the cargo hold";
} else { 
	systemChat "You manage to find a loot crate in the wreckage of the chopper"; 
};

scripts\client_heli.sqf

s_colect_heli = -1;
while {true} do {
	_donn_cursorTarget = cursorTarget;
	_objVar = _donn_cursorTarget getVariable ["dnishpq",0];
	_isHeliLoot = false;
	if (!isNil "_objVar") then {
		if (_objVar > 0) then {
			if (player distance _donn_cursorTarget < ((sizeOf typeOf _donn_cursorTarget)/2 + 4)) then {
				_isHeliLoot = true;
			};
		};
	};
	if (_isHeliLoot) then {
		if (s_colect_heli < 0) then {
			_heliTxt = "Collect Helicrash Loot ...";
			if (alive _donn_cursorTarget) then {_heliTxt = "Collect Helicrash Loot!";};
			s_colect_heli = player addaction[("<t color=""#6666bb"">" + _heliTxt + "</t>"),"andre_heliConvoy_items.sqf",_donn_cursorTarget,5,false,true,"",""];
		};
	} else {
		player removeAction s_colect_heli;
		s_colect_heli = -1;
	};
	uiSleep 1.5;
};

 

Share this post


Link to post
Share on other sites
On 12/7/2017 at 4:12 AM, l1nkrx7 said:

this works perfectly i dont see how you cannot get this to work anyways heres my code

 

server side sqf file

if (isServer) then {
	_gridN = 15;
	_mapSize = 20479; //Napf
	donn_hwps = [];
	for "_i" from 1 to (_gridN - 1) do {
		_wpx = (_i/_gridN)*_mapSize;
		for "_y" from 1 to (_gridN - 1) do {
			_wpy = (_y/_gridN)*_mapSize;
			if !(surfaceIsWater [_wpx,_wpy]) then {donn_hwps = donn_hwps + [[_wpx,_wpy,0]];};
		};
	};
	donn_heliConvy = [
		/*0*/["UH1H_DZ",0,["100Rnd_762x51_M240","100Rnd_762x51_M240"],3],
		/*1*/["UH1H_DZ",4,[],4],
		/*2*/["Mi17_TK_EP1",5,["100Rnd_762x51_M240","100Rnd_762x51_M240"],5],
		/*3*/["CH_47F_EP1_DZE",6,["100Rnd_762x51_M240","4000Rnd_762x51_M134","4000Rnd_762x51_M134"],6],
		/*4*/["AH6J_EP1_DZ",1,[],2] //ARMED (PILOT)
	];
	//HELI MAIN CONFIG BEGIN
	_heliFormation =[[0,0,2],[2,2],[4,4,4,4,4],[3],[3],[1,1]];
	_heliAltitude =[[60,60,115],[100,100],[50,50,50,50,50],[100],[100],[115,115]];
	_heliSpeed =["NORMAL","NORMAL","FULL","LIMITED","NORMAL","FULL"];
	//HELI MAIN CONFIG END
	_spawn = [100,100,400];
	donn_heli_HD = {
		_heliHurt = _this select 0;
		_damage = _this select 2;
		if !(canMove _heliHurt) then {
			if (_heliHurt getVariable "dncmv") then {
				_heliHurt setVariable ["dncmv",false,false];
				{
					if (random 100 > 50) then {_x action ["Eject",_heliHurt];} else {_x setPos getPos _heliHurt;};
				} forEach crew _heliHurt;
			};
		};
		_damage
	};
	donn_heli_unit_HD = {
		_hurtedOne = _this select 0;
		_damage = _this select 2;
		_ofender = _this select 3;
		_grp = group _hurtedOne;
		if (combatMode _grp != "RED" && isPlayer _ofender) then {
			{_x enableAi "TARGET";} forEach units _grp;
			{_x enableAi "AUTOTARGET";} forEach units _grp;
			_grp reveal [_ofender,1.5];
			_grp setCombatMode "RED";_grp setBehaviour "COMBAT";
		};
		_damage
	};	
	donn_heli_unitKill = {
		_unit = _this select 0;
		_role = assignedVehicleRole _unit;
		if ((assignedVehicleRole _unit) select 0 == "Driver") then {
			_vehEject = assignedVehicle _unit;
			{
				if (random 100 > 40) then {_x action ["Eject",_vehEject];} else {_x setPos getPos _vehEject};
			} forEach crew _vehEject;
		};
		if ({alive _x} count units group _unit == 0) then {donn_heliGrps = donn_heliGrps - [group _unit];};
		_unit setVariable ["cashMoney",2500 + (round random 5) * 1000,true];
	};
	donn_makeAeroRoute = {
		_origin = _this select 0;
		_heli_group = _this select 1;
		_speed = _this select 2;
		_posBefore = _origin;
		_posNow = _origin;
		_wp = _heli_group addWaypoint [_posNow,0,0];
		_wp setWaypointCompletionRadius 65;
		_wp setWaypointType "MOVE";
		_wp setWaypointSpeed _speed;
		_posNext = [0,0,0];
		for "_c" from 1 to 5 do {
			_distToBefore = 0;
			_distToNext = 0;
			_found = false;
			for "_x" from 1 to 200 do {
				_posNext = donn_hwps call BIS_fnc_selectRandom;
				_distToNext = _posNow distance _posNext;
				_distToBefore = _posNext distance _posBefore;
				if (_distToNext > 3000 && _distToBefore > 4000) exitWith {};
				uiSleep 0.001;
			};
			if (!_found) then {_posNext = donn_hwps call BIS_fnc_selectRandom;};
			_wp = _heli_group addWaypoint [_posNext,0,_c];
			_wp setWaypointCompletionRadius 65;
			_wp setWaypointType "MOVE";
			_wp setWaypointSpeed _speed;
			_posNow = _posNext;
		};
		_wp = _heli_group addWaypoint [_origin,0,6];
		_wp setWaypointCompletionRadius 65;
		_wp setWaypointType "CYCLE";
		_wp setWaypointSpeed _speed;
	};
	donn_heliGrps = [];
	[] spawn {
		while {{!isNull _x} count donn_heliGrps > 0} do {
			{
				_grp = _x;
				_forceIn = true;
				{
					if (_grp knowsAbout _x >= 1.5) then {_grp reveal [_x,4];_forceIn = false;};
				} forEach playableUnits;
				if (_forceIn) then {
					if (combatMode _grp != "BLUE") then {
						{_x disableAi "TARGET";uiSleep 0.001;} forEach units _grp;
						{_x disableAi "AUTOTARGET";uiSleep 0.001;} forEach units _grp;
						//_grp setCombatMode "BLUE";_grp setBehaviour "CARELESS";
						_grp setCombatMode "YELLOW";_grp setBehaviour "COMBAT";
					};
					{
						if (vehicle _x == _x) then {[_x] orderGetIn true;uiSleep 0.001;};
					} forEach units _grp;
				};
			} forEach donn_heliGrps;	
			uiSleep 10;
		};
		diag_log "[AI HELI CONFIG] FINISHED.";
	};
	for "_cs" from 1 to (count _heliFormation) do {
		diag_log ("[HELI CONVOY] Initialized Spawn! " + str _cs);
		_heli_group = createGroup EAST;
		donn_heliGrps = donn_heliGrps + [_heli_group];
		_convoy = _heliFormation select (_cs-1);
		_convoyH = _heliAltitude select (_cs-1);
		_convoyS = _heliSpeed select (_cs-1);
		_qtd = count _convoy;
		_helis = [];
		{_helis = _helis + [donn_heliConvy select _x];} forEach _convoy;
		for "_n" from 1 to _qtd do {
			private ["_firstDriver"];
			_heli = _helis select (_n-1);
			_flyHeight = _convoyH select (_n-1);
			_motor = createVehicle [_heli select 0,_spawn,[],50,"FLY"];
			// UPDATE //
			dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_motor];
			{deleteVehicle _x;} forEach crew _motor;
			_motor removeAllEventHandlers "handleDamage";
			_motor addEventHandler ["handleDamage",{_this call donn_heli_HD}];
			_motor setVariable ["dncmv",true,false];
			_motor setVariable ["dnishp",true,true];
			_motor setVariable ["dnishpq",_heli select 3,true];
			_motor setFuel 1;
			_motor setVehicleLock "LOCKED";
			_motor flyInHeight _flyHeight;
			_ammos = _heli select 2;
			{_ammo = _x;for "_a" from 1 to 8 do {_motor addMagazineTurret [_ammo,[_forEachIndex]];};} forEach _ammos;
			_driverCount = 1;
			_turreterCount = count _ammos;
			_cargorsCount = _heli select 1;
			_crewCount = _driverCount + _turreterCount + _cargorsCount;
			_gunnerPos = 0;
			for "_y" from 1 to _crewCount do {
				_unit = _heli_group createUnit ["gsc_eco_stalker_mask_duty",[50,50,0],[],50,"PRIVATE"];
				_unit removeAllEventHandlers "killed";
				_unit removeAllEventHandlers "handleDamage";
				_unit addEventHandler ["killed",{_this call donn_heli_unitKill;}];
				_unit addEventHandler ["handleDamage",{_this call donn_heli_unit_HD}];
				[_unit] joinSilent _heli_group;
				_unit setSkill 0.85;
				removeAllWeapons _unit;
				{_unit removeMagazine _x} forEach magazines _unit;
				_unit addWeapon "RPK_74";
				_unit selectWeapon "RPK_74";
				for "_pa" from 1 to 2 do {_unit addMagazine "75Rnd_545x39_RPK";};			
				if (_y == 1) then {
					_unit assignAsDriver _motor;
					_unit moveInDriver _motor;
					_unit setSkill ["aimingAccuracy",0.65];
				};
				if (_y > 1 && _y <= 1 + _turreterCount) then {
					_unit assignAsGunner _motor;
					_unit moveInTurret [_motor,[_gunnerPos]];
					_gunnerPos = _gunnerPos + 1;
					_unit setSkill ["aimingAccuracy",1];
				};
				if (_y > 1 + _turreterCount) then {
					_unit assignAsCargo _motor;
					_unit moveInCargo _motor;
					_unit setSkill ["aimingAccuracy",0.65];
				};
			};
			{_x disableAi "TARGET";uiSleep 0.001;} forEach units _heli_group;
			{_x disableAi "AUTOTARGET";uiSleep 0.001;} forEach units _heli_group;
			_heli_group setCombatMode "BLUE";_heli_group setBehaviour "CARELESS";
			_sphere = createVehicle ["Sign_sphere100cm_EP1",[0,0,0],[],0,"CAN_COLLIDE"];
			_sphere attachTo [_motor,[0,0,3]];
		};
		[donn_hwps call BIS_fnc_selectRandom,_heli_group,_convoyS] call donn_makeAeroRoute;
		uiSleep (60*20);
	};
};

mission side

andre_heliConvoy_items.sqf

/*
_motor = _this select 3;
_qLoot = _motor getVariable "dnishpq";
_loot1 = [
	[["addWeaponCargoGlobal","Mk_48_DZ",[1,1,2]],["addMagazineCargoGlobal","100Rnd_762x51_M240",[1,2,3]]],	//Maried Loot
	[["addWeaponCargoGlobal","M249_DZ",[1,1,2]],["addMagazineCargoGlobal","200Rnd_556x45_M249",[1,2,3]]],	//Maried Loot
	[["addWeaponCargoGlobal","G36C",[1,1,2]],["addMagazineCargoGlobal","30Rnd_556x45_Stanag",[2,3,4]]],		//Maried Loot
	[["addWeaponCargoGlobal","DMR_DZ",[1,1,2]],["addMagazineCargoGlobal","20Rnd_762x51_DMR",[3,4,5]]],		//Maried Loot
	[["addWeaponCargoGlobal","AK_47_M",[1,1,2]],["addMagazineCargoGlobal","30Rnd_762x39_AK47",[2,3,4]]],	//Maried Loot
	[["addWeaponCargoGlobal","NVGoggles",[2,3,4]]],
	[["addWeaponCargoGlobal","ItemEtool",[2,3,4]]],
	[["addWeaponCargoGlobal","Binocular_Vector",[2,3,4]]],
	[["addMagazineCargoGlobal","ItemBloodBag",[6,8,10]]],
	[["addMagazineCargoGlobal","PartEngine",[2,3,4]]],
	[["addMagazineCargoGlobal","ItemBandage",[10,15,20]]],
	[["addMagazineCargoGlobal","HandGrenade_West",[3,5,7]]],
	[["addMagazineCargoGlobal","ItemBriefcase100oz",[1,1,2]]]
];
if (_qLoot > 0) then {
	for "_i" from 1 to _qLoot do {
		_holder = createVehicle ["WeaponHolder",position player,[],1.5,"CAN_COLLIDE"];
		{
			call compile format [
				"_holder %1 ['%2',%3];",
				_x select 0,
				_x select 1,
				(_x select 2) call BIS_fnc_selectRandom
			];
		} forEach (_loot1 call BIS_fnc_selectRandom);
	};
	_motor setVariable ["dnishpq",0,true];
};
*/
//Original by Donnavan
//Modified by salival for better loot control
//find_suitable_ammunition from WAI, uses the same variables (but in this file instead since these are clientside)
//Edit the variables to suit your needs, the crate will spawn behind the player.

find_suitable_ammunition = {

	private["_weapon","_result","_ammoArray"];

	_result 	= false;
	_weapon 	= _this;
	_ammoArray 	= getArray (configFile >> "cfgWeapons" >> _weapon >> "magazines");

	if (count _ammoArray > 0) then {
		_result = _ammoArray select 0;
		call {
			if(_result == "20Rnd_556x45_Stanag") 	exitWith { _result = "30Rnd_556x45_Stanag"; };
			if(_result == "30Rnd_556x45_G36") 		exitWith { _result = "30Rnd_556x45_Stanag"; };
			if(_result == "30Rnd_556x45_G36SD") 	exitWith { _result = "30Rnd_556x45_StanagSD"; };
		};
	};
	_result
};

private ["_crate_type","_crate","_num_weapons","_weapon","_ammo"];

//Edit the variables below to suit your needs
_crate_type 	= "USOrdnanceBox"; //this needs to be whitelisted in your battleye filters (createvehicle.txt) - you can do so by adding !="USOrdnanceBox" to a line that starts with 5. i.e 5 !="USOrdnanceBox"
_crate_items					= ["FoodMRE","ItemSodaOrangeSherbet","ItemSodaPepsi","ItemBandage","ItemSodaCoke","FoodCanBakedBeans","FoodCanPasta","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemHeatPack","ItemMorphine","CinderBlocks","ItemComboLock","ItemLightBulb","ItemLockbox","ItemSandbag","ItemTankTrap","ItemWire","MortarBucket","PartGeneric","PartGlass","PartPlankPack","ItemBriefcase100oz","ItemBriefcase100oz","ItemBriefcase100oz","ItemBriefcase100oz"];

_ai_wep_assault				= ["M16A4_ACG","Sa58V_RCO_EP1","SCAR_L_STD_Mk4CQT","M8_sharpshooter","M4A1_HWS_GL_camo","SCAR_L_STD_HOLO","M4A3_CCO_EP1","M4A3_CCO_EP1","M4A1_AIM_SD_camo","M16A4","m8_carbine","BAF_L85A2_RIS_Holo","Sa58V_CCO_EP1"];	// Assault
_ai_wep_machine				= ["MK_48_DZ","M249_EP1_DZ","Pecheneg_DZ","M240_DZ"];	// Light machine guns
_ai_wep_sniper				= ["M14_EP1","HUNTINGRIFLE","M4SPR","M24","M24_DES_EP1","SCAR_H_LNG_Sniper_SD","M110_NVG_EP1","SVD_CAMO","VSS_Vintorez","DMR_DZ","M40A3","KSVK_DZE","BAF_LRR_SCOPED"];	// Sniper rifles
_ai_wep_random				= _ai_wep_assault + _ai_wep_assault + _ai_wep_sniper + _ai_wep_machine;	

_motor = _this select 3;

player playActionNow "Medic";
uisleep 10;

_position = [(position player select 0) - (sin(getdir player)*2), (position player select 1) - (cos(getdir player)*2), (position player select 2)];
_dir = getDir player;

_crate 			= createVehicle [_crate_type,_position,[],0,"CAN_COLLIDE"];

_crate setVariable ["ObjectID","1",true];
_crate setVariable ["permaLoot",true];

_num_weapons	= 6;
_num_items	= 14;
_item_array	= _crate_items;

PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_crate];

clearWeaponCargoGlobal _crate;
clearMagazineCargoGlobal _crate;

if(_num_weapons > 0) then {

	_num_weapons = (ceil((_num_weapons) / 2) + floor(random (_num_weapons / 2)));

	for "_i" from 1 to _num_weapons do {
		_weapon = _ai_wep_random call BIS_fnc_selectRandom;
		_ammo = _weapon call find_suitable_ammunition;
		_crate addWeaponCargoGlobal [_weapon,1];
		_crate addMagazineCargoGlobal [_ammo, (1 + floor(random 5))];
	};
};

if(_num_items > 0) then {
	_num_items	= (ceil((_num_items) / 2) + floor(random (_num_items / 2)));
	for "_i" from 1 to _num_items do {
		_item = _item_array call BIS_fnc_selectRandom;
		if(typeName (_item) == "ARRAY") then {
			_crate addMagazineCargoGlobal [_item select 0,_item select 1];
		} else {
			_crate addMagazineCargoGlobal [_item,1];
		};
	};
};

_motor setVariable ["dnishpq",0,true];

if (alive _motor) then { systemChat "You manage to find a loot crate in the cargo hold";
} else { 
	systemChat "You manage to find a loot crate in the wreckage of the chopper"; 
};

scripts\client_heli.sqf

s_colect_heli = -1;
while {true} do {
	_donn_cursorTarget = cursorTarget;
	_objVar = _donn_cursorTarget getVariable ["dnishpq",0];
	_isHeliLoot = false;
	if (!isNil "_objVar") then {
		if (_objVar > 0) then {
			if (player distance _donn_cursorTarget < ((sizeOf typeOf _donn_cursorTarget)/2 + 4)) then {
				_isHeliLoot = true;
			};
		};
	};
	if (_isHeliLoot) then {
		if (s_colect_heli < 0) then {
			_heliTxt = "Collect Helicrash Loot ...";
			if (alive _donn_cursorTarget) then {_heliTxt = "Collect Helicrash Loot!";};
			s_colect_heli = player addaction[("<t color=""#6666bb"">" + _heliTxt + "</t>"),"andre_heliConvoy_items.sqf",_donn_cursorTarget,5,false,true,"",""];
		};
	} else {
		player removeAction s_colect_heli;
		s_colect_heli = -1;
	};
	uiSleep 1.5;
};

 

The issue I had with this is that you can loot the wreck 20 times if you are fast.

Share this post


Link to post
Share on other sites
19 hours ago, l1nkrx7 said:

this version shows a crate behind you after collecting you can only do this once

Thanks for sharing -

I'm not sure what the difference is but your code worked on the first try. 

Much appreciation ! 

Share this post


Link to post
Share on other sites
On 12/9/2017 at 5:36 AM, l1nkrx7 said:

this version shows a crate behind you after collecting you can only do this once

i just installed your version and i am able to loot the crash site a dozen times.

https://imgur.com/a/6BNfe

also, not sure if it matters but 

PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_crate];  should probably be 
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_crate];

Share this post


Link to post
Share on other sites
//Original by Donnavan
//Modified by salival for better loot control
//find_suitable_ammunition from WAI, uses the same variables (but in this file instead since these are clientside)
//Edit the variables to suit your needs, the crate will spawn behind the player.

find_suitable_ammunition = {

	private["_weapon","_result","_ammoArray"];

	_result 	= false;
	_weapon 	= _this;
	_ammoArray 	= getArray (configFile >> "cfgWeapons" >> _weapon >> "magazines");

	if (count _ammoArray > 0) then {
		_result = _ammoArray select 0;
		call {
			if(_result == "20Rnd_556x45_Stanag") 	exitWith { _result = "30Rnd_556x45_Stanag"; };
			if(_result == "30Rnd_556x45_G36") 		exitWith { _result = "30Rnd_556x45_Stanag"; };
			if(_result == "30Rnd_556x45_G36SD") 	exitWith { _result = "30Rnd_556x45_StanagSD"; };
		};
	};
	_result
};

private ["_crate_type","_crate","_num_weapons","_weapon","_ammo"];
if (dayz_actionInProgress) exitWith {"You are already performing an action, wait for the current action to finish." call dayz_rollingMessages;};
dayz_actionInProgress = true;
//Edit the variables below to suit your needs
_crate_type 	= "USOrdnanceBox"; //this needs to be whitelisted in your battleye filters (createvehicle.txt) - you can do so by adding !="USOrdnanceBox" to a line that starts with 5. i.e 5 !="USOrdnanceBox"
_crate_items					= ["FoodMRE","ItemSodaOrangeSherbet","ItemSodaPepsi","ItemBandage","ItemSodaCoke","FoodCanBakedBeans","FoodCanPasta","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemHeatPack","ItemMorphine","CinderBlocks","ItemComboLock","ItemLightBulb","ItemLockbox","ItemSandbag","ItemTankTrap","ItemWire","MortarBucket","PartGeneric","PartGlass","PartPlankPack","ItemBriefcase100oz","ItemBriefcase100oz","ItemBriefcase100oz","ItemBriefcase100oz"];

_ai_wep_assault				= ["M16A4_ACG","Sa58V_RCO_EP1","SCAR_L_STD_Mk4CQT","M8_sharpshooter","M4A1_HWS_GL_camo","SCAR_L_STD_HOLO","M4A3_CCO_EP1","M4A3_CCO_EP1","M4A1_AIM_SD_camo","M16A4","m8_carbine","BAF_L85A2_RIS_Holo","Sa58V_CCO_EP1"];	// Assault
_ai_wep_machine				= ["Mk48_CCO_DZ","M249_EP1_DZ","Pecheneg_DZ","M240_DZ"];	// Light machine guns
_ai_wep_sniper				= ["M14_EP1","HUNTINGRIFLE","M4SPR","M24","M24_DES_EP1","SCAR_H_LNG_Sniper_SD","M110_NVG_EP1","SVD_CAMO","VSS_Vintorez","DMR_DZ","M40A3","KSVK_DZE","BAF_LRR_SCOPED"];	// Sniper rifles
_ai_wep_random				= _ai_wep_assault + _ai_wep_assault + _ai_wep_sniper + _ai_wep_machine;	

_motor = _this select 3;

player playActionNow "Medic";
uisleep 8;

_position = [(position player select 0) - (sin(getdir player)*2), (position player select 1) - (cos(getdir player)*2), (position player select 2)];
_dir = getDir player;

_crate 			= createVehicle [_crate_type,_position,[],0,"CAN_COLLIDE"];

_crate setVariable ["ObjectID","1",true];
_crate setVariable ["permaLoot",true];

_num_weapons	= 6;
_num_items	= 14;
_item_array	= _crate_items;

dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_crate];

clearWeaponCargoGlobal _crate;
clearMagazineCargoGlobal _crate;

if(_num_weapons > 0) then {

	_num_weapons = (ceil((_num_weapons) / 2) + floor(random (_num_weapons / 2)));

	for "_i" from 1 to _num_weapons do {
		_weapon = _ai_wep_random call BIS_fnc_selectRandom;
		_ammo = _weapon call find_suitable_ammunition;
		_crate addWeaponCargoGlobal [_weapon,1];
		_crate addMagazineCargoGlobal [_ammo, (1 + floor(random 5))];
	};
};

if(_num_items > 0) then {
	_num_items	= (ceil((_num_items) / 2) + floor(random (_num_items / 2)));
	for "_i" from 1 to _num_items do {
		_item = _item_array call BIS_fnc_selectRandom;
		if(typeName (_item) == "ARRAY") then {
			_crate addMagazineCargoGlobal [_item select 0,_item select 1];
		} else {
			_crate addMagazineCargoGlobal [_item,1];
		};
	};
};

_motor setVariable ["dnishpq",0,true];

if (alive _motor) then { systemChat "You manage to find a loot crate in the cargo hold";
} else { 
	systemChat "You manage to find a loot crate in the wreckage of the chopper"; 
};
dayz_actionInProgress = false;

use the code above for  andre_heliConvoy_items.sqf and the wreck can only be looted 1x

Share this post


Link to post
Share on other sites

I keep getting these issues, and there is no flying helis. Any ideas? Thanks

 

23:07:32 ["z\addons\dayz_server\system\scheduler\sched_safetyVehicle.sqf","KILLING A HACKER","Peter Melvin"," IN ","UH60M_EP1_DZE"]
23:07:32 ["z\addons\dayz_server\system\scheduler\sched_safetyVehicle.sqf","KILLING A HACKER","Jan Hujer"," IN ","UH60M_EP1_DZE"]
23:07:32 ["z\addons\dayz_server\system\scheduler\sched_safetyVehicle.sqf","KILLING A HACKER","Sadat Jawadi"," IN ","UH60M_EP1_DZE"]
23:07:32 ["z\addons\dayz_server\system\scheduler\sched_safetyVehicle.sqf","KILLING A HACKER","Dylan King"," IN ","UH1H_DZ"]
23:07:32 ["z\addons\dayz_server\system\scheduler\sched_safetyVehicle.sqf","KILLING A HACKER","Radim Trachnikov"," IN ","UH1H_DZ"]
23:07:32 ["z\addons\dayz_server\system\scheduler\sched_safetyVehicle.sqf","KILLING A HACKER","Haikal Faruqi"," IN ","UH1H_DZ"]

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By Ghostrider-GRG
      Originally concieved by Blckeagls and supported here with permission
      Completely rewritten  to remove bugs and add functionallity.
       
       
      Current Version: Version 6.90
      Current Build: 176
      Description.
      Built-in support for Epoch or Exile.
      Updated: Built in Headless client support.
      New: includes tools to export missions from A3EDEN Editor - minimal editing/scripting required to generate new missions once the design is completed in the editr.
      A complete static and dynamic mission system rolled into one.
       
      AI infantry will aggressively pursue attackers, flank, use cover, and communicate with aircraft and ground vehicles.
      Supports missions on land and underwater.
      Includes hostage and arrest enemy leader style missions as well as conventional capture the crate missions.
      Missions can have infantry, static weapons, armed vehicle patrols and aircraft defending the area.
      Built in support for militarized missions with tanks and attack helis or jets if you wish.
      AI loadouts can be defined by arrays or based on items in CfgPricing (Epoch) or the Arsenal (Exile)
      Supports spawning of static AI infantry, vehicles, aircraft, surface vessels, static emplaced weapons and subs with scuba divers.
      Includes tools forspawning map addons exported using M3EDEN editor plugin.
      Includes tools for spawning static loot crates which can be randomized at each area, be spawned with a smoking wreck nearby to create that post-appocolyptic feels, and have randomized .oot.
      To download go to: https://github.com/Ghostrider-DbD-/blckeagles-revisited-RC
      For installation see: https://github.com/Ghostrider-DbD-/blckeagles-revisited-RC/blob/master/INSTALLATION.txt
      For a complete changelog see: https://github.com/Ghostrider-DbD-/blckeagles-revisited-RC/blob/master/changeLog.sqf
      V 6.90  Build 175
      Changes Include:
      1. Added new settings to specify the number of crew per vehhicle to blck_config.sqf and blck_config_mil.sqf
       
          // global settings for this parameters
          // Determine the number of crew plus driver per vehicle; excess crew are ignored.
          // This can be a value or array of [_min, _max];
          blck_vehCrew_blue = 3;
          blck_vehCrew_red = 3;
          blck_vehCrew_green = 3;
          blck_vehCrew_orange = 3;
          You can also define this value in missions by adding the following variable definition to the mission template:
          _vehicleCrewCount = [3,6]; // min/max number of AI to load including driver. see the missions\blue\template.sqf and blck_configs.sqf for more info.
      2.  Lists of items to be excluded from dynamically generated loadouts has been moved to:
          blck_config.sqf
          blck_config_mil.sqf
      3. Added a new setting that specifies whether logging of blacklisted items is done (handy for debugging)
          blck_logBlacklistedItems = true;  // set to false to disable logging
      4. Hit and Killed event handlers extensively reworked. Methods for notification of nearby AI and Vehicles of the killers whereabouts were revised to be more inclusive of neighboring AI.
      5. Issues with AIHit events fixed; AI now deploy smoke and heal.
      6. Removed some unnecessary logging.
      7. Other minor coding fixes and optimizations.
      Credits:
          Epoch Mod developer team, and in particular AWOL whose code has provided many lessons in scripting.
        blckeagls - Original developer of mission system 2.0.2   Narines - bug fixes and improvements.   Bill (DBD Clan) example compositions.   cyncrwler for help with troubleshooting and testing   Brian Soanes for helpful changes and performance tweaks.   Grahame for many rounds of testing, feedback and suggestions regarding features.   zxbutchxz for extensive testing of AI behavior. MGTDB for the fix for an issue with interacting with captives/targets on Exile servers. * Additional Credits include authors of other missions systems and scripts who's work influenced this release:
         Halve and He-Man.     Face (A3EAI)     KiloSwiss (SEM)     Hogscrapper (HC missions for A3)     the Vampire (DZMS and VEMF)     The FUCHS (EMS)     lazylink (early A2 Epoch mission system)     Matt11 (Wicked AI) Updates: License
      This Mission System is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
      http://creativecommons.org/licenses/by-nc-sa/4.0/
       
       

       
    • By FG_Trap
      Made a quick static ai mission that spawns on restart. 
      12 ai patrol the compound 
      4 Static m2's
      1 Heli Patrolling the compound 
      Crate for who ever clears all the ai.
      Some screenshots of the compound 


       
      https://github.com/Trapxxgods/Wai-Static-Mission 
    • By Harkness
      Happy to announce the launch of our new custom server. 
      DayZ Epoch Chernarus 
      To connect search for "v666" in your DayZ Launcher
      Server Modes/Mods/Addons
      Romero Style Zombies
      Snow & Cold Weather Effects (temp+breath)
      Custom Intro Radio Broadcast
      Spawn Location Options
      Safe Trader Areas
      Roaming/Driving/Flying AI Excursions
      AI Mission System
      Random Events
      Auto Re-fuel at any Gas Station
      Day/Night Cycle w/6 Hourly Reboots
      ++Many more to come! Want something added? Request it here
      Don't forget to register here for your own custom load-out and access to our community forums
       
      Note:
      This server is both PVP and PVE. We dont believe in giving players rules but cheating in any way will result in lifetime ban from whole community.
    • By thegdog
      home hosting a test server, how would i go about changing the spawning of the heli crash sites.  i been on a server that had heli sites everywhere.  also how would i go about adding events like bandit captures, medical supply areas, ect.  
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...