Jump to content

[Release] Andre Convoy Patrol


Donnovan

Recommended Posts

I am also having players autobanned Did you find the problem?

I did not. I temporarily removed the covoys from our production server, but have them running on the test server. I will be running some tests this weekend to see if I can find a solution to the autoban, as I would love to place this back for our players.

Link to comment
Share on other sites

Really great work here. Nice support also.

 

 

I'm far to be an expert in script, but i still don't get why after 3 convoy spawn, there's no other convoy wich spawns .

Every AI are dead and cars doesn't disapear.

//Vehicles: Keep Number of Possibilities low. Its ok to repeate the same car with different configuration.
donn_carsConvy = [
	["C_SUV_01_EPOCH",3,[]],											//(0) SUV Unarmed
	["B_G_Offroad_01_armed_EPOCH",1,["100Rnd_127x99_mag_Tracer_Yellow"]]		//(1) Off Road Armed
];

//Soldier of the Convoys (all the soldiers are the same)
donn_soldierSkin = "I_Soldier_EPOCH";

//ANDRE CONVOY ON SERVER
if (isServer) then { //change this line to run it on a Headless Client
	//=======================
	//BASIC KONFIGURATION 2!
	//=======================

	//CONVOY CONFIGURATION
	
	//Number of convoys to Spawn
	_cascasToSpawn = 20;
	//Time between each consecutive spawn
	_timeBetweenSpawns = 30;
	//Cars in each convoy (refere to donn_carsConvy)
	_convoyFormation = [
		[1,1],		// convoy 1		
		[1,1,2],	// convoy 2
		[1,1,2,2] 	// convoy 3
		// [1],		// convoy 4
		// [0,0],	// convoy 5
		// [0,0],	// convoy 6				
		// [0,1],	// convoy 7
		// [1,1]	// convoy 8
	];

I set "30" to save time.

Any idea ?

 

Thanks again for the work you made here.

Slug

Link to comment
Share on other sites

mySlug,

 

The number of elements in _convoyFormation must be equal to the number in _cascasToSpawn.

 

Since your _convoyFormation have only 3 elements, the script will spawn only 3 convoys. If you want it to spawn 20 convoys, add more 17 convoys to it, like this, for example:

_cascasToSpawn = 20;

_convoyFormation = [
	[0],		// convoy 1		
	[0],		// convoy 2
	[0], 		// convoy 3
	[0,0],		// convoy 4
	[0,0],		// convoy 5
	[0,0],		// convoy 6				
	[0,0],		// convoy 7
	[1],		// convoy 8
	[1],		// convoy 9
	[1],		// convoy 10
	[0,1],		// convoy 11
	[0,1],		// convoy 12
	[1,1],		// convoy 13
	[1,1],		// convoy 14
	[1,1],		// convoy 15
	[0,0,1],	// convoy 16
	[0,0,1],	// convoy 17
	[0,1,1],	// convoy 18
	[1,1,1],	// convoy 19
	[1,1,1]		// convoy 20
];

Also, IMPORTANT, you can't use 2, you only can use 0 and 1: 0 is the SUV and 1 is the armed Off Road.

donn_carsConvy = [
	["C_SUV_01_EPOCH",3,[]],    //(*0*) SUV Unarmed
	["B_G_Offroad_01_armed_EPOCH",1,["100Rnd_127x99_mag_Tracer_Yellow"]]    //(*1*) Off Road Armed
];
Link to comment
Share on other sites

For some reason I am not seeing the convoys on the map. When I engaged a convoy  yesterday I got booted with an error for donn_pshot until I added  !"donn_pshot" exception. So I am fairly sure the convoy I encountered was spawned by this script.

 

Any ideas?

Link to comment
Share on other sites

Changes:

 

1 - Turreters respond faster to attacks.

2 - UVC - Unstuck Vehicle Code :c)

3 - When attacked, vehicles try to get distance from the attacker for a limited time, than disembark.

4 - Vehicle & AI icons now don't blink.

5 - No AI is left on the street. Exception: car crash (wheels to the sky) and became unusable.

 

After some 1 or two tests i will put it on the main post, thankyou!

 

Here is it:

//=======================
//BASIC KONFIGURATION 1!
//=======================

//Vehicles: Keep Number of Possibilities low. Its ok to repeate the same car with different configuration.
donn_carsConvy = [
	["C_SUV_01_EPOCH",3,[]],											//(0) SUV Unarmed
	["B_G_Offroad_01_armed_EPOCH",1,["100Rnd_127x99_mag_Tracer_Yellow"]]	//(1) Off Road Armed
];

//Soldier of the Convoys (all the soldiers are the same)
donn_soldierSkin = "I_Soldier_EPOCH";

//ANDRE CONVOY ON SERVER
if (isServer) then { //change this line to run it on a Headless Client
	//=======================
	//BASIC KONFIGURATION 2!
	//=======================

	//CONVOY CONFIGURATION
	
	//Time between each consecutive spawn
	_timeBetweenSpawns = 120;
	//Cars in each convoy (refere to donn_carsConvy)
	_convoyFormation = [
		[0],		// convoy 1		
		[0],		// convoy 2
		[1],		// convoy 3
		[1],		// convoy 4
		[0,0],	// convoy 5
		[0,1],	// convoy 6				
		[1,1],	// convoy 7
		[1,1]	// convoy 8
	];
	
	//Crew Skill (driver, cargors and turreters)
	_driverManSkill = 1.0; 	//Skill of the driver, from 0 to 1
	_cargoMansSkill = 0.5;	//Skill of the cargo ocupants, from 0 to 1
	_turretMansSkill = 0.4;	//Skill ot the turret operators, from 0 to 1

	//====================
	//MAP CONFIGURATION
	//====================

	//VEHICLES SPAWN: [[vehicle spawn position],[nothing],spawn angle,spawn radius]
	
	//ALTIS SPAWNS
	_spawns = [
		[[10648,15920,0.2],[],174,15],
		[[16514,15674,0.2],[],20,15],
		[[21484,7850,0.2],[],108,15],
		[[5797,13747,0.2],[],335,15]
	];

	//CHERNARUS SPAWNS
	/*
	_spawns = [
		[[2296,15313,0.1],[],152,15],
		[[9732,13466,0.1],[],184,15],
		[[13361,5430,0.1],[],269,15],
		[[33,1589,0.1],[],82,15]
	];
	*/

	//BORNHOLM SPAWNS
	/*
	_spawns = [
		[[14870,2816,0.2],[],0,15],
		[[3477,7397,0.2],[],180,15],
		[[10308,10118,0.2],[],0,15],
		[[5797,13747,0.2],[],0,15]
	];
	*/
	
	//====================
	//EXTRA KONFIGURATION!
	//====================

	//LOOT IN VEHICLE
	_loot1 = [
		[["addWeaponCargoGlobal","Srifle_GM6_F",[1,1,2]],["addMagazineCargoGlobal","5Rnd_127x108_Mag",[4,4,5]]],		//Maried Loot
		[["addWeaponCargoGlobal","m249_EPOCH",[1,1,2]],["addMagazineCargoGlobal","200Rnd_556x45_M249",[2,3,4]]],		//Maried Loot
		[["addWeaponCargoGlobal","srifle_DMR_01_F",[1,1,2]],["addMagazineCargoGlobal","10Rnd_762x51_Mag",[4,4,5]]],	//Maried Loot
		[["addWeaponCargoGlobal","M14_EPOCH",[1,1,2]],["addMagazineCargoGlobal","20Rnd_762x51_Mag",	[3,4,5]]],		//Maried Loot
		[["addWeaponCargoGlobal","Srifle_LRR_F",[1,1,2]],["addMagazineCargoGlobal","7Rnd_408_Mag",[4,4,5]]],			//Maried Loot
		[["addWeaponCargoGlobal","ItemCompass",[1,2,3]]],
		[["addWeaponCargoGlobal","ItemWatch",[1,2,3]]],
		[["addWeaponCargoGlobal","Binocular",[1,2,3]]],
		[["addWeaponCargoGlobal","acc_flashlight",[1,2,3]]],
		[["addMagazineCargoGlobal","VehicleRepair",[2,3,4]]],
		[["addMagazineCargoGlobal","lighter_epoch",[2,3,4]]],
		[["addMagazineCargoGlobal","honey_epoch",[4,5,6]]],
		[["addMagazineCargoGlobal","MortarBucket",[4,5,6]]],
		[["addMagazineCargoGlobal","KitCinderWall",[4,5,6]]],
		[["addMagazineCargoGlobal","jerrycan_epoch",[2,3,4]]],
		[["addMagazineCargoGlobal","ItemGoldBar",[1,2,3]]],
		[["addMagazineCargoGlobal","HandGrenade",[4,6,8]]],
		[["addBackpackCargoGlobal","B_Kitbag_mcamo",[1,2,2]]],
		[["addBackpackCargoGlobal","B_TacticalPack_mcamo",[1,2,2]]],
		[["addBackpackCargoGlobal","B_AssaultPack_mcamo",[1,2,2]]],
		[["addBackpackCargoGlobal","B_FieldPack_ocamo",[1,2,2]]],
		[["addBackpackCargoGlobal","smallbackpack_red_epoch",[1,2,2]]]
	];
	
	//=========================
	//END OF KONFIGURATION
	//=========================
	
	//==============================================================================================================
	//==============================================================================================================
	//==============================================================================================================
	//==============================================================================================================
	
	//Show Spawn Icons on Map
	_donn_casca_icons = [];
	{
		_donn_casca_icons = _donn_casca_icons + [[_x select 0,"Convoy Spawn " + str (_forEachIndex + 1)]];
	} forEach _spawns;
	{
		_mark = createMarker ["Donn_Spawn_" + str _forEachIndex, _x select 0];
		_mark setMarkerShape "Icon";
		_mark setMarkerText (_x select 1);
		_mark setMarkerType "mil_dot";
		_mark setMarkerColor "ColorPink";
	} forEach _donn_casca_icons;
	//Loot Selection Function
	_donn_selectLoot = {
		_loots = call compile str (_this select 0);
		_qtd = 4 + ((ceil random 3) - 1);
		_return = [];
		for "_x" from 0 to (_qtd - 1) do {
			_rnd = (ceil (random (count _loots))) - 1;
			_rnd = _rnd max 0;
			_return = _return + [_loots select _rnd];
			_loots deleteRange [_rnd,1];
		};
		_return
	};
	//Add/Remove Turret Ammo - Function
	donn_cascar_tuAmmo = {
		_ammos = _this select 0;
		_motor = _this select 1;
		_action = _this select 2;
		if (_action == "add") then {
			{
				_ammo = _x;
				for "_a" from 1 to 2 do {
					_motor addMagazineTurret [_ammo,[_forEachIndex]];
				};
			} forEach _ammos;
		};
		if (_action == "remove") then {
			{
				_motor removeMagazinesTurret [_x,[_forEachIndex]];
			} forEach _ammos;
		};
	};
	//Clean AI on death
	donn_cleanUnit = {
		_unit = _this select 0;
		removeBackpack _unit;
		{_unit removeMagazine _x;} forEach magazines _unit;
		if (random 100 > 70) then {
			{_unit removeWeapon _x;} forEach weapons _unit;
		};
		donn_units_motor = donn_units_motor - [_unit];
	};
	//Find Waypoints: Automatic find street waypoints
	_donn_wps = [];
	_roads = [0,0,0] nearRoads 50000;
	{
		_road = _x;
		if (count roadsConnectedTo _x > 2) then {
			_alone = true;
			{
				if (_road distance _x < 1200) exitWith {
					_alone = false;
				};
			} forEach _donn_wps;
			if (_alone) then {
				_donn_wps pushBack position _x;
			};
		};
	} forEach _roads;
	_roads = nil;
	//Bot Weapons
	_donn_weapons = [
		["m249_EPOCH","200Rnd_556x45_M249"],
		["m249Tan_EPOCH","200Rnd_556x45_M249"],
		["LMG_Mk200_F","200Rnd_65x39_cased_Box_Tracer"],
		["Arifle_MX_SW_F","100Rnd_65x39_caseless_mag_Tracer"],
		["Arifle_MX_SW_Black_F","100Rnd_65x39_caseless_mag_Tracer"],
		["LMG_Zafir_F","150Rnd_762x51_Box_Tracer"],
		["M14_EPOCH","20Rnd_762x51_Mag"],
		["M14Grn_EPOCH","20Rnd_762x51_Mag"],
		["srifle_EBR_F","20Rnd_762x51_Mag"],
		["srifle_DMR_01_F","10Rnd_762x51_Mag"],
		["arifle_MXM_F","30Rnd_65x39_caseless_mag_Tracer"],
		["arifle_MXM_Black_F","30Rnd_65x39_caseless_mag_Tracer"]
	];
	//Add Icon Function
	_addIcon = {
		_iName = _this select 0;
		_iPos = _this select 1;
		_iColor = _this select 2;
		_iText = _this select 3;
		_mark = createMarker [_iName, _iPos];
		_mark setMarkerColor _iColor;
		_mark setMarkerShape "Icon";
		_mark setMarkerType "mil_dot";
		_mark setMarkerText _iText;
	};
	//Casca Units Icons on Map
	donn_units_motor = [];
	[_addIcon] spawn {
		_addIcon = _this select 0;
		_add = [];
		_remove = [];
		_update = [];
		_donn_units_motor_icon_old = [];
		while {true} do {
			{
				_color = "";
				_txt = "";
				if (_x isKindOf "LandVehicle") then {
					_txt = str ({alive _x} count crew _x);
					if (_x getVariable ["donn_tu",false]) then {
						_color = "ColorRed";
					} else {
						_color = "ColorBlue";
					};
				} else {
					_txt = "";
					_color = "ColorYellow";
				};
				_array = [_x getVariable ["donn_goto","no_name"],position _x,_color,_txt];
				_array call _addIcon;
			} forEach _add;
			{
				deleteMarker (_x getVariable ["donn_goto","no_name"]);
			} forEach _remove;
			{
				_posXY = position _x;
				_marker = _x getVariable ["donn_goto","no_name"];
				_marker setMarkerPos (getPosATL _x);
				if (_x isKindOf "LandVehicle") then {
					_marker setMarkerText str ({alive _x} count crew _x);
				};

			} forEach _update;
			_donn_units_motor_icon = [];
			_vehIcon = [];
			{
				_veh = vehicle _x;
				_assigned = assignedVehicle _x;
				if (_veh != _x) then {
					if !(_veh in _vehIcon) then {
						_vehIcon = _vehIcon + [_veh];
						_donn_units_motor_icon pushBack _veh;
					};
				} else {
					_donn_units_motor_icon pushBack _x;
				};
				if !(_assigned in _vehIcon) then {
					_vehIcon = _vehIcon + [_assigned];
					_donn_units_motor_icon pushBack _assigned;
				};
			} forEach donn_units_motor;
			_add = _donn_units_motor_icon - _donn_units_motor_icon_old;
			_remove = _donn_units_motor_icon_old - _donn_units_motor_icon;
			_update = _donn_units_motor_icon - _add;
			_donn_units_motor_icon_old = _donn_units_motor_icon;
			sleep 2.5;
		};
	};
	//Safe Sleep To Avoid First Car to Dissapear on Player Contact
	sleep 20;
	//Spawn Casca Units/Cars
	for "_cs" from 1 to (count _convoyFormation) do {
		diag_log ("[CASCA CONVOY] Initialized Spawn! " + str _cs);
		//Inicialization
		_spawn = _spawns select ((_cs + ((count _spawns)-1)) mod (count _spawns));
		_origin = _spawn select 0;
		_rad = _spawn select 3;
		_rosa_group = createGroup RESISTANCE;
		_convoy = _convoyFormation select (_cs-1);
		_behaviorSafe = "CARELESS";
		_speed = "NORMAL";
		_qtd = count _convoy;
		_cars = [];
		{
			_cars = _cars + [donn_carsConvy select _x];
		} forEach _convoy;
		_turretersVeh = [];
		_turreters = [];
		_ammosVeh = [];
		for "_n" from 1 to _qtd do {
			private ["_firstDriver"];
			//Spawn Car
			_car = _cars select (_n - 1);
			_motor = createVehicle [_car select 0,_origin,[],_rad,"NONE"];
			_motor call EPOCH_server_setVToken;
			_motor setVariable ["donn_goto","CAR_" + str _cs + "_" + str _n,false];
			_motor allowDamage false;
			_motor removeAllEventHandlers "HandleDamage";
			_motor addEventHandler ["HandleDamage",{0}];
			_motor setDir (_spawn select 2);
			_motor setFuel 1;
			_motor addEventHandler ["GetIn",{
				_motor = _this select 0;
				_player = _this select 2;
				if (_player in playableUnits) then {
					_player action ['getOut', _motor];
				};
				donn_pvar_sendmess = [_player,"You can't enter this vehicle. It's a AI only vehicle."];
				publicVariable "donn_pvar_sendmess";
			}];
			//Refuel Vehicle
			_motor spawn {
				while {alive _this} do {
					_this setFuel 1;
					sleep 120;
				};
			};
			//Put Loot in the Car
			clearWeaponCargoGlobal _motor;
			clearMagazineCargoGlobal _motor;
			{
				{
					call compile format [
						"_motor %1 ['%2',%3];",
						_x select 0,
						_x select 1,
						_x select 2 select ((_qtd - 1) min 2)
					];
				} forEach _x;
			} forEach ([_loot1] call _donn_selectLoot);
			//Remove Vehicle Ammo
			_ammos = _car select 2;
			if (count _ammos > 0) then {
				[_ammos,_motor,"add"] call donn_cascar_tuAmmo;
				_turretersVeh = _turretersVeh + [_motor];
				_ammosVeh = _ammosVeh + [_ammos];
				_motor setVariable ["donn_tu",true,true];
			};
			//Spawn Soldiers
			_driverCount = 1;
			_turreterCount = count _ammos;
			_thisCarTurreters = [];
			_cargorsCount = _car select 1;
			_crewCount = _driverCount + _turreterCount + _cargorsCount;
			_gunnerPos = 0;
			_crew = [];
			for "_y" from 1 to _crewCount do {
				//Create Soldier
				_unit = _rosa_group createUnit [donn_soldierSkin,[50,50,50],[],50,"PRIVATE"];
				[_unit] joinSilent _rosa_group;
				donn_units_motor = donn_units_motor + [_unit];
				_unit addEventHandler ["Killed",{_this call donn_cleanUnit;}];
				_unit setVariable ["donn_goto","AI_" + str _cs + "_" + str _n + "_" + str _y,false];
				_unit setVariable ["donn_pshot",[],true];
				_unit disableAi "TARGET";
				_unit disableAi "AUTOTARGET";
				_crew = _crew + [_unit];	
				//Give Soldier Weapon and Ammo
				removeAllWeapons _unit;
				{_unit removeMagazine _x} forEach magazines _unit;
				_weap_mag = _donn_weapons call BIS_fnc_selectRandom;
				_weapon = _weap_mag select 0;
				_magazine = _weap_mag select 1;
				_unit addBackPack "B_Carryall_ocamo";
				_unit addWeapon _weapon;
				_unit selectWeapon _weapon;
				for "_pa" from 1 to 8 do {
					_unit addMagazine _magazine;
				};
				//Put AI in the car
				if (_y == 1) then {
					//Driver
					_unit assignAsDriver _motor;
					_unit moveInDriver _motor;
					_unit setSkill _driverManSkill;
					_firstDriver = _unit;
				};
				if (_y > 1 && _y <= 1 + _turreterCount) then {
					//Turreters
					_unit assignAsTurret [_motor,[_gunnerPos]];
					_unit moveInTurret [_motor,[_gunnerPos]];
					_unit setSkill _turretMansSkill;
					_gunnerPos = _gunnerPos + 1;
					_turreters = _turreters + [_unit];
					_thisCarTurreters = _thisCarTurreters + [_unit];
 				};
				if (_y > 1 + _turreterCount) then {
					//Cargors
					_unit assignAsCargo _motor;
					_unit moveInCargo _motor;
					_unit setSkill _cargoMansSkill;
				};
			};
			_rosa_group setCombatMode "GREEN";
			_rosa_group setBehaviour _behaviorSafe;
			//Garantee Vehicle Driver
			[_firstDriver,_crew,_thisCarTurreters,_motor] spawn {
				private ["_newDriver"];
				_thisCarTurreters = _this select 2;
				_crewToDriver = (_this select 1) - _thisCarTurreters;
				_motor = _this select 3;
				_driver = ObjNull;
				_lastOnes = false;
				while {count _crewToDriver > 0} do {
					while {count _crewToDriver > 0} do {
						if (isNull _driver) then {
							_driver = _this select 0;
						} else {
							_driver = _crewToDriver select 0;
							if (!_lastOnes) then {
								unassignVehicle _driver;
								_motor assignAsDriver _driver;
							};
						};
						waitUntil {sleep 2;(!(alive _driver) || isNull _driver)};
						{
							if (!(alive _x) || isNull _x) then {
								_crewToDriver = _crewToDriver - [_x];
							};
						} forEach _crewToDriver;
					};
					{
						if (alive _x) exitWith {
							_crewToDriver = [_x];
							_x setVariable ["donn_noTu",true,false];
							_lastOnes = true;
						};
					} forEach _thisCarTurreters;
				};
			};
			//Unstuck Car
			_motor spawn {
				_motor = _this;
				_excludeGeneral = [];
				_count = 0;
				while {true} do {
					//diag_log "[DONN DONN DONN] E LA VAMOS NOS!";
					_fix = false;
					sleep 5;
					while {!isNull driver _motor && isEngineOn _motor} do {
						_lastPos = position _motor;
						sleep 3;						
						_newPos = position _motor;
						if (_newPos distance _lastPos < 1) then {
							_count = _count + 1;
						} else {
							_count = 0;
							_excludeGeneral = [];
						};
						if (_count >= 15) exitWith {_fix = true;};
					};
					if (_fix) then {
						//diag_log "[DONN DONN DONN] CARRO STUCKOU!";
						_lastPos = position _motor;
						_noPlayerNear = true;
						_near = (position _motor) nearEntities ["CAManBase",350];
						{
							if (isPlayer _x) exitWith {
								_noPlayerNear = false;
							};
						} forEach _near;
						//diag_log ("[DONN DONN DONN] _noPlayerNear = " + str _noPlayerNear);
						if (_noPlayerNear) then {
							_roads = [];
							_grow = 1;
							_roadsNegative = (position _motor) nearRoads 20;
							while {count _roads < 5} do {
								_roads = (position _motor) nearRoads (50*_grow + 20);
								_roads = _roads - _roadsNegative;								
								_grow = _grow + 1;
							};
							//diag_log ("[DONN DONN DONN] _roads = " + str _roads);
							_notOk = true;
							_exclude = [];
							_theRoadSafe = _roads call BIS_fnc_selectRandom;
							//diag_log ("[DONN DONN DONN] _theRoadSafe (1) = " + str _theRoadSafe);
							while {_notOk} do {
								_minDist = 200;
								_theRoad = _theRoadSafe;
								{
									_dist = _motor distance _x;
									if (_dist < _minDist && !(_x in _exclude) && !(_x in _excludeGeneral)) then {
										_minDist = _dist;
										_theRoad = _x;
									};
								} forEach _roads;
								//diag_log ("[DONN DONN DONN] _theRoad (2) = " + str _theRoad);
								_occuping = ((position _theRoad) nearEntities ["CAManBase",15]) - [_motor];
								//diag_log ("[DONN DONN DONN] _occuping = " + str _occuping);
								_newPos = position _motor;
								//diag_log ("[DONN DONN DONN] mudanca antes tentar teleport = " + str (_newPos distance _lastPos));
								if (_newPos distance _lastPos >= 1) then {
									//diag_log "[DONN DONN DONN] SE MOVEU! FIM.";
									_notOk = false;
									_count = 0;
								} else {
									if (count _occuping == 0) then {
										//diag_log "[DONN DONN DONN] NINGUEM ATRAPALHANDO NO LOCAL!";
										_notOk = false;
										_count = 0;
										if (_theRoad != _theRoadSafe) then {_excludeGeneral pushBack _theRoad};
										//diag_log "[DONN DONN DONN] VAI TELEPORTAR!";
										_motor setPos (position _theRoad);
									} else {
										if (_theRoad != _theRoadSafe) then {_exclude pushBack _theRoad;};
										sleep 7.5;
									};
								};
							};
						};
					};
				};
			};
		};
		//Make Units leave/Embark car
		[_rosa_group,_turreters,_ammosVeh,_turretersVeh,_behaviorSafe] spawn {
			_rosa_group = _this select 0;
			_turreters = _this select 1;
			_ammosVeh = _this select 2;
			_turretersVeh = _this select 3;
			_behaviorSafe = _this select 4;
			_KA_playersLast = false;
			_followeds = [];
			_noknowTime = 0;
			_tm = 0;
			_tmSup = 0;
			_targetOff = true;
			_changer = 0;
			while {!isNil "_rosa_group"} do {
				_KA_players = false;
				_shotNearPlayers = _rosa_group getVariable ["donn_pshot",[]];
				if (count _shotNearPlayers > 0) then {
					{_rosa_group reveal [_x,4]} forEach _shotNearPlayers;
					_rosa_group setVariable ["donn_pshot",[],true];
					_KA_players = true;
					_followeds = (_followeds - _shotNearPlayers) + _shotNearPlayers;
				};
				if (!_targetOff) then {
					_followedsNew = [];
					_AiUnits = units _rosa_group;
					{if (alive _x) then {_followedsNew = _followedsNew + [_x];};} forEach _followeds;
					_followeds = _followedsNew;
					if (count _followeds > 0) then {
						_numbKA = 0;
						_numbKA_total = count _AiUnits;
						{
							_unit = _x;
							{
								if (_unit knowsAbout _x == 4 && _unit distance _x < 300) exitWith {_numbKA = _numbKA + 1;};
							} forEach _followeds;
						} forEach _AiUnits;
						if (_numbKA/_numbKA_total >= 0.5) then {_KA_players = true;};
					};
				};
				if (str _KA_players != str _KA_playersLast && _KA_players) then {
					{_x enableAi "AUTOTARGET";} forEach units _rosa_group;
					_rosa_group setCombatMode "RED";
					//{[_ammosVeh select _forEachIndex,_x,"add"] call donn_cascar_tuAmmo;} forEach _turretersVeh;
					_inCar = [];
					_onFoot = [];
					{
						if (_x != vehicle _x) then {
							_inCar = _inCar + [_x];
						} else {
							_onFoot = _onFoot + [_x];
						};
					} forEach units _rosa_group;
					{_x enableAi "TARGET";} forEach _onFoot;
					_onFoot allowGetIn false;
					_avgDist = 1;
					_dividend = (count _inCar) * (count _followeds);
					_countPark = 0;
					if (_dividend > 0) then {
						while {(_avgDist > 0 && _avgDist < 80) && _countPark < 15} do {
							_sumDist = 0;
							{
								_unit = _x;
								{
									_sumDist = _sumDist + (_unit distance _x);
								} forEach _followeds;
							} forEach _inCar;
							_avgDist = _sumDist/_dividend;
							sleep 0.5;
							_countPark = _countPark + 1;
						};
					};
					_followedsNew = [];
					{if (alive _x) then {_followedsNew = _followedsNew + [_x];};} forEach _followeds;
					_followeds = _followedsNew;
					if (count _followeds > 0) then {
						_targetOff = false;
						_rosa_group setBehaviour "COMBAT";
						{_x enableAi "TARGET";} forEach _inCar;
						((units _rosa_group) - _turreters) allowGetIn false;
						_tmSup = 15;
					} else {
						_rosa_group setBehaviour _behaviorSafe;
						{_x disableAi "TARGET";} forEach _onFoot;
						{_x disableAi "AUTOTARGET";} forEach units _rosa_group;
						_onFoot allowGetIn true;
						_onFoot orderGetIn true;
						//{[_ammosVeh select _forEachIndex,_x,"remove"] call donn_cascar_tuAmmo;} forEach _turretersVeh;
					};
				};
				if (!_KA_players) then {_noknowTime = _noknowTime + _tm;};
				if (!_KA_players && _noknowTime > 35 && !_targetOff) then {
					_targetOff = true;
					{_x disableAi "TARGET";} forEach units _rosa_group;
					{_x disableAi "AUTOTARGET";} forEach units _rosa_group;
					_rosa_group setCombatMode "GREEN";
					(units _rosa_group) allowGetIn true;
					sleep 0.005;
					(units _rosa_group) orderGetIn true;
					_rosa_group setBehaviour _behaviorSafe;
					//{[_ammosVeh select _forEachIndex,_x,"remove"] call donn_cascar_tuAmmo;} forEach _turretersVeh;
					_followeds = [];
					_tmSup = 0;
				};
				_KA_playersLast = _KA_players;
				_tm = 1 max _tmSup;
				if (_KA_players) then {_noknowTime = -_tm;};
				sleep _tm;
				if ((_targetOff && _changer mod 5 == 0) || !_targetOff) then {
					{
						if (_x getVariable ["donn_noTu",false] && alive _x) then {
							_turreters = _turreters - [_x];
							_veh = vehicle _x;
							unassignVehicle _x;
							_veh assignAsDriver _x;
							if (_targetOff) then {
								_x moveInDriver (vehicle _x);
							} else {
								[_x] allowGetIn false;
							};
						};
					} forEach _turreters;
					if (_targetOff) then {
						(units _rosa_group) allowGetIn true;
						(units _rosa_group) orderGetIn true;
					};
				};
				_changer = _changer + 1;
			};
		};
		//Make the Route
		[_rosa_group,_spawn select 0,_donn_wps,_speed] spawn {
			private ["_alive"];
			_rosa_group = _this select 0;
			_origin = _this select 1;
			_donn_wps = _this select 2;
			_speed = _this select 3;
			_posBefore = _origin;
			_posNow = _origin;
			_wp = _rosa_group addWaypoint [_posNow,0,0];
			_wp setWaypointCompletionRadius 15;
			_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_wps call BIS_fnc_selectRandom;
					_distToNext = _posNow distance _posNext;
					_distToBefore = _posNext distance _posBefore;
					_otherIsland = false;
					if (_distToNext > 2500 && _distToNext < 5000 && _distToBefore > 2000) then {
						_found = true;
						_distUnits = _distToNext/20;
						_dltX = ((_posNext select 0) - (_posNow select 0))/_distUnits;
						_dltY = ((_posNext select 1) - (_posNow select 1))/_distUnits;
						for "_i" from 1 to _distUnits do {
							_travelPos = [(_posNow select 0)+_i*_dltX,(_posNow select 1)+_i*_dltX]; 
							if (surfaceIsWater _travelPos) exitWith {_found = false;};
						};
					};
					if (_found) exitWith {};
					sleep 0.001;
				};
				if (!_found) then {_posNext = _donn_wps call BIS_fnc_selectRandom;};
				_wp = _rosa_group addWaypoint [_posNext,0,_c];
				_wp setWaypointCompletionRadius 15;
				_wp setWaypointType "MOVE";
				_wp setWaypointSpeed _speed;
				_posNow = _posNext;
			};
			_wp = _rosa_group addWaypoint [_origin,0,6];
			_wp setWaypointCompletionRadius 15;
			_wp setWaypointType "CYCLE";
			_wp setWaypointSpeed _speed;
		};
		sleep _timeBetweenSpawns;
	};
};

//ANDRE CONVOY ON CLIENT
if (hasInterface) then {
	"donn_pvar_sendmess" addPublicVariableEventHandler {
		_player = _this select 1 select 0;
		_msg = _this select 1 select 1;
		if (player == _player) then {
			systemChat _msg;
		};
	};

	donn_cli_cascaCars = [];
	{
		_car = _x select 0;
		if !(_car in donn_cli_cascaCars)  then {
			donn_cli_cascaCars = donn_cli_cascaCars + [_car];
		};
	} forEach donn_carsConvy;
	
	donn_vecDir = {
		private ["_pnt1","_pnt2","_vec","_vecX","_vecY","_magnitude","_asin1","_asin2","_acos1","_acos2","_asin1r","_asin2r","_acos1r","_acos2r","_calcDir"];
		_pnt1 = _this select 0;
		_pnt2 = _this select 1;
		_vec = [(_pnt2 select 0) - (_pnt1 select 0), (_pnt2 select 1) - (_pnt1 select 1)];
		_vecX = _vec select 0;
		_vecY = _vec select 1;
		_magnitude = sqrt(_vecX^2 + _vecY^2);

		_asin1 = asin (_vecX/_magnitude);
		_asin2 = 180 - _asin1;
		_acos1 = acos (_vecY/_magnitude);
		_acos2 = -_acos1;
		
		_asin1 = (_asin1 + 360) mod 360;
		_asin2 = (_asin2 + 360) mod 360;
		_acos1 = (_acos1 + 360) mod 360;
		_acos2 = (_acos2 + 360) mod 360;
		
		_asin1r = (round (_asin1 * 100))/100;
		_asin2r = (round (_asin2 * 100))/100;
		_acos1r = (round (_acos1 * 100))/100;
		_acos2r = (round (_acos2 * 100))/100;

		_calcDir = 0;
		if (_asin1r == _acos1r) then {_calcDir = _asin1};
		if (_asin1r == _acos2r) then {_calcDir = _asin1};
		if (_asin2r == _acos1r) then {_calcDir = _asin2};
		if (_asin2r == _acos2r) then {_calcDir = _asin2};
		_calcDir = _calcDir mod 360;
		_calcDir
	};
	//[_angleToCheck,_toCheckOnAngle,_maxErrorLeft,_maxErrorRight] call _donn_angleInside;
	donn_angleInside = {
		private ["_angleToCheck","_onAngle","_left","_right","_dif","_angleOk"];
		_angleToCheck = _this select 0;
		_onAngle = _this select 1;
		_left = _onAngle - (_this select 2);
		_right = _onAngle + (_this select 3);
		_dif = abs (_left - _right);
		_angleToCheck = _angleToCheck mod 360;
		if (_angleToCheck < 0) then {_angleToCheck = _angleToCheck + 360;};
		_angleOk = false;
		if (_dif <= 180) then {
			if (_angleToCheck <= _right && _angleToCheck >= _left) then {_angleOk = true;};
			if (_angleToCheck <= _left && _angleToCheck >= _right) then {_angleOk = true;};
		} else {
			if ((_angleToCheck >= _right || _angleToCheck <= _left) && _right > _left) then {_angleOk = true;};
			if ((_angleToCheck >= _left || _angleToCheck <= _right) && _left > _right) then {_angleOk = true;};
		};
		_angleOk
	};
	donn_csc_firedRun = diag_tickTime;
	donn_csc_firedEH = {
		_dirPlayer = getDir player;
		_now = diag_tickTime;
		if (_now - donn_csc_firedRun > 1) then {
			donn_csc_firedRun = _now;
			_angleIsDanger = false;
			_nearCascaUnits = player nearEntities [donn_soldierSkin, 200];
			_nearCascaCars = player nearEntities [donn_cli_cascaCars, 200];
			_onSight = objNull;
			{
				if (count crew _x > 0) then {
					_dirDanger = [getPosATL player,getPosATL _x] call donn_vecDir;
					_corretor = (((((_x distance player) - 10) max 0)/50) min 1) * 35;
					_angleIsDanger = [_dirPlayer,_dirDanger,45-_corretor,45-_corretor] call donn_angleInside;
				};
				if (_angleIsDanger) then {
					_angleIsDanger = false;
					{
						if (alive _x) exitWith {
							_angleIsDanger = true;
							_onSight = _x;
						};
					} forEach crew _x;
				};
				if (_angleIsDanger) exitWith {};
			} forEach _nearCascaCars;
			if (!_angleIsDanger) then {
				{
					if (alive _x) then {
						_dirDanger = [getPosATL player,getPosATL _x] call donn_vecDir;
						_corretor = (((((_x distance player) - 10) max 0)/50) min 1) * 35;
						_angleIsDanger = [_dirPlayer,_dirDanger,45-_corretor,45-_corretor] call donn_angleInside;
					};
					if (_angleIsDanger) exitWith {_onSight = _x;};
				} forEach _nearCascaUnits;
			};
			if (_angleIsDanger) then {
				_groupUnit = group _onSight;
				_donn_pshot = _groupUnit getVariable ["donn_pshot",[]];
				_donn_pshot = (_donn_pshot - [player]) + [player];
				_groupUnit setVariable ["donn_pshot",_donn_pshot,true];
			};
		};
	};
	[] spawn {
		_firedEH = player addEventHandler ["Fired",{_this call donn_csc_firedEH;}];
		while {true} do {
			sleep 5;
			player removeEventHandler ["Fired",_firedEH];
			_firedEH = player addEventHandler ["Fired",{_this call donn_csc_firedEH;}];
		};
	};
};
Link to comment
Share on other sites

 

Changes:

 

1 - Turreters respond faster to attacks.

2 - UVC - Unstuck Vehicle Code :c)

3 - When attacked, vehicles try to get distance from the attacker for a limited time, than disembark.

4 - Vehicle & AI icons now don't blink.

5 - No AI is left on the street. Exception: car crash (wheels to the sky) and became unusable.

 

After some 1 or two tests i will put it on the main post, thankyou!

 

Here is it:

Hi, thx for the script good job

installed the new version in my server its work without problem for the moment

i tell u if i have any pb :)

Link to comment
Share on other sites

I love this script! The only problem that I face for it, is the fact that I get kicked for Restriction #8. I know it has been addressed before, but I couldn't find an answer. 

 

*Here is the Setvariable Log: Value Restriction #8 "donn_pshot"
 

*Here is what my Setveriable.txt says: !"donn_pshot" !="_groupUnit setVariable [\"donn_pshot\",_donn_pshot,true];"

 

Please Help!!! 

 

When I get kicked, it is only because I shoot the SUV, no matter who is in it. Not when it is empty. 

Link to comment
Share on other sites

Okay maybe someone can tell me where I am going wrong. I put the script in an SQF copy pasted the execVM "andre_convoy.sqf"; //exec it on the root on init.sqf where it is suppose to go. I have made it the first one in the INIT and I get this in the RPT

 

17:52:45 Creation of object R Bravo 1-1:4 failed, state MISSION ASKED
17:52:45 Client: Nonnetwork object 571c8360.
17:52:45 Client: Nonnetwork object 571ca5c0.
17:52:45 Client: Nonnetwork object 6a3d9600.
17:52:45 Ref to nonnetwork object R Bravo 1-1:4

If I bring it down to 3rd or 4th  I get andre_convoy.sqf not found.
I have been literally working this all day. Looked up these errors with no info. Any ideas?

Link to comment
Share on other sites

I love this script! The only problem that I face for it, is the fact that I get kicked for Restriction #8. I know it has been addressed before, but I couldn't find an answer. 

 

*Here is the Setvariable Log: Value Restriction #8 "donn_pshot"

 

*Here is what my Setveriable.txt says: !"donn_pshot" !="_groupUnit setVariable [\"donn_pshot\",_donn_pshot,true];"

 

Please Help!!! 

 

When I get kicked, it is only because I shoot the SUV, no matter who is in it. Not when it is empty.

That sounds like the setvariableval.txt kick.

Try changing line 9 in your setvariableval.txt to:

1 "[+;{(&%]" !"e\+00"

(Change the 5 to 1 basically.)

Link to comment
Share on other sites

Hey, my players love the script but I have a bit of a problem in that it somehow interferes with the melee weapons.

 

As soon as I include andre convoy I lose the ability to cut wood or mine rocks etc with the sledgehammer and there are no animations for either weapon.  Even a vanilla server with only andre convoy running loses wood cutting.

 

Any clues?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...