Jump to content

[Release] Casca Vehicles Convoy for any Map


Donnovan

Recommended Posts

I tried it out again with your adjustment. 

Below is a bigger example of the RPT log.

The script appears to run, I see AI spawning, and driving around (albeit they seem a little "dumb" at times, comparing them to casca).

The errors appear to be persistent, and constant spamming in the RPT. Not sure if engaging the AI is what triggered them or not. I'll double check that in a bit.

The only other thing to point out is I used god mode when engaging them.

http://pastebin.com/5mdZ0Nh7


If I do not interact or engage the AI, on server startup this error appears:

12:06:00 "[CASCA CONVOY] Initialized Spawn! 1"
12:06:05 Error in expression <= _this select 3;
_mark = createMarker [_iName, _iPos];
_mark setMarkerColor _iC>
12:06:05   Error position: <_iName, _iPos];
_mark setMarkerColor _iC>
12:06:05   Error Undefined variable in expression: _iname
12:06:05 File mpmissions\DayZ_Overpoch_1.Chernarus\andre_convoy.sqf, line 194
Link to comment
Share on other sites

outlander, thanks a lot for the help.

 

Despite the big error log, seens something is not working weel with two getVariables because they are returning Null. I need to find why.

 

I will ask you take a break and let me check it better. Thanks a lot!

Link to comment
Share on other sites

Another error on startup:

12:05:43 Error in expression <en {
_cascaVehicles = _cascaVehicles + [_this select 0];
};
} forEach donn_carsC>
12:05:43   Error position: <_this select 0];
};
} forEach donn_carsC>
12:05:43   Error Undefined variable in expression: _this
12:05:43 File mpmissions\DayZ_Overpoch_1.Chernarus\andre_convoy.sqf, line 96
12:05:43 Error in expression <en {
_cascaVehicles = _cascaVehicles + [_this select 0];
};
} forEach donn_carsC>
12:05:43   Error position: <_this select 0];
};
} forEach donn_carsC>
12:05:43   Error Undefined variable in expression: _this
12:05:43 File mpmissions\DayZ_Overpoch_1.Chernarus\andre_convoy.sqf, line 96

All other errors stem from engaging the AI, and are persistent errors once you do.

Cheers, looking forward to testing it more.  :D

*Also wanted to add that I get no errors at all when using Casca Convoy*

Link to comment
Share on other sites

some Errors

Error Undefined variable in expression: _marker


19:34:19 File mpmissions\__cur_mp.chernarus\andre_convoy.sqf, line 234
19:34:22 Error in expression <_x getVariable ["donn_goto","no_name"];
_marker setMarkerPos (getPosATL _x);
if >
19:34:22 Error position: <_marker setMarkerPos (getPosATL _x);
if >
19:34:22 Error Undefined variable in expression: _marker
19:34:22 File mpmissions\__cur_mp.chernarus\andre_convoy.sqf, line 234
19:34:42 "[CASCA CONVOY] Initialized Spawn! 2"
19:35:10 "WAI: 18 Active ground units"
19:35:10 "WAI: 6 Active emplacement units"
19:35:10 "WAI: 0 Active chopper patrol units (Crew)"
19:35:10 "WAI: 0 Active vehicle patrol units (Crew)"
19:35:23 "CLEANUP: INITIALIZING CLEANUP SCRIPT"
19:35:57 Error in expression } forEach _AiUnits;
if (_numbKA/_numbKA_total >= 0.5) then {_KA_players>
19:35:57 Error position: = 0.5) then {_KA_players>
19:35:57 Error Zero divisor
19:35:57 File mpmissions\__cur_mp.chernarus\andre_convoy.sqf, line 558
19:35:57 Error in expression if (count _shotNearPlayers > 0) then {
{_rosa_grou>

;

Link to comment
Share on other sites

Hey Donnovan, I got a question for you if you have the time.

Currently using your older, Casca Convoy while you're working on the Andre Convoy.

I notice around line 700:

		//Garantee Vehicle Driver
		[_crew,_motor,_firstDriver] spawn {
			private ["_newDriver"];
			_crew = _this select 0;
			_motor = _this select 1;
			_firstDriver = _this select 2;
			waitUntil {sleep 5;!(alive _firstDriver)};
			while {{alive _x} count _crew > 0} do {
				{
					if (alive _x) exitWith {_newDriver = _x};
				} forEach _crew;
				_newDriver assignAsDriver _motor;
				if (vehicle _newDriver == _motor && driver _motor != _newDriver) then {
					[_unit] orderGetIn false;
					sleep 4;
					[_unit] orderGetIn true;
				};
				waitUntil {sleep 5;!(alive _newDriver)};
			};
		};
	};

You're not declaring the local variable _unit in this function. Got a quick fix for this?

Cheers,

Link to comment
Share on other sites

Hey Donnovan,

I know you're a busy man but I was wondering if you have any progress on the Andre Convoy? I'm hoping to use it to replace most of my previous missions.

I've been using the Casca and love it, but I just find strange behavior like gunners jumping in and out of vehicles constantly.

Cheers,

Link to comment
Share on other sites

outlander, casca convoy is not ready for armed vehicles. I do not recomend using armed vehicle for it.

 

The only problem left in Andre Convoy for Arma 2 is that the vehicle enter in combat mode when a player is near, and this make then go out of the street. While in Arma 3 the deviation is small, in arma 2 its very big, the vehicle go deep in the forest/wild and this is not really what i intend, my desire is to make then run over the player.

 

I have TARGET and AUTOTARGET off but they still enters in combat mode and exit the street.

 

Working in a solution.

Link to comment
Share on other sites

outlander, casca convoy is not ready for armed vehicles. I do not recomend using armed vehicle for it.

 

The only problem left in Andre Convoy for Arma 2 is that the vehicle enter in combat mode when a player is near, and this make then go out of the street. While in Arma 3 the deviation is small, in arma 2 its very big, the vehicle go deep in the forest/wild and this is not really what i intend, my desire is to make then run over the player.

 

I have TARGET and AUTOTARGET off but they still enters in combat mode and exit the street.

 

Working in a solution.

 

Hi,

Just a smal suggestions: If you disableAI FMS, the execution of scripts for that AI will be blocked, i think that might be what you want. Just don't forget to turn it back on after and re-assign the waypoints.

Link to comment
Share on other sites

Next release will be for Arma 2, and right after it will be ported to Arma 3:

 

Changes:

 

- Many New Default Vehicle types (Arma 2):

---- Off Road Unarmed

---- Off Road Armed

---- Civ Truck High Crew Capacity

---- Civ Van High Crew Capacity

---- Armored Unarmed High Crew Capacity (BRDM)

---- Armored Unarmed High Crew Capacity (Med Evak Vodinik)

- Loot quantity in vehicle based on the crew number of the vehicle. So a trucks full of AI will have lots of loot.

- Bomb Mans (they explode when you shot their chest)

- No AI friendlly fire. Good for truck and high capacity vehicles disembark.

- No client side. Full on server or Headless Client.

---- To stop the convoy you need to shot the vehicle or any of its crew.

- A considerable number of spawn loops removed and converted to event handlers.

- Some multiple spawn loop checks joined in one spawn loop check.

- Some refinement and simplification of the code.

Link to comment
Share on other sites

If you like my work, please consider a donation:

 

btn_donate_LG.gif $USD

 

btn_donate_LG.gif $EURO

 

Please just donate after the script works to you.

Here is the new Version! You will love it!

 

To stop the convoy you need to shot the convoy vehicles or any of the AI.

IMPORTANT: If your sleep around line 371 is not "sleep 2.5;" you is using an old version, please get the file again, bellow. Thankyou!

//===========================================
//THIS VERSION IS FOR ARMA 2: ANDRE CONVOYS
//===========================================

if (isServer) then {
	//=======================
	//BASIC KONFIGURATION 1!
	//=======================

	//Vehicles: Its ok to repeate the same car with different configuration.
	donn_carsConvy = [
		//(0) Vehicle Unarmored Armed low Capacity
		["Offroad_DSHKM_Gue",0,["150Rnd_127x107_DSHKM"]],
		//(1) Vehicle Unarmored Unarmed Mediun Capacity
		["BAF_Offroad_D",2,[]],
		//(2) Vehicle Unarmed Armored High Capacity
		["BTR40_TK_GUE_EP1",4,[]],
		//(3) Vehicle Unarmed Armored High Capacity
		["GAZ_Vodnik_MedEvac",4,[]],
		//(4) Vehicle Trash High Capacity
		["S1203_TK_CIV_EP1",4,[]],
		//(5) Civil Truck Ultra High Capacity
		["Ural_TK_CIV_EP1",7,[]]
	];

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

	//=======================
	//BASIC KONFIGURATION 2!
	//=======================

	//CONVOY CONFIGURATION
	
	//Time between each consecutive spawn
	_timeBetweenSpawns = 200;

	//Cars in each convoy (refere to donn_carsConvy)
	_convoyFormation = [
		[0,1],	// convoy 1		
		[0,2],	// convoy 2
		[0,3],	// convoy 3
		[4],		// convoy 4
		[5],		// convoy 5		
		[0,1,0]	// convoy 6
	];
	
	//Crew Skill (driver, cargors and turreters)
	_driverManSkill = 0.6; 	//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
	_bomberManPerc = 0.1;	//Percentage of bomberman AI: 0 is 0% and 1 is 100%
	
	//====================
	//MAP CONFIGURATION
	//====================

	//VEHICLES SPAWN: [[vehicle spawn position],[nothing],spawn angle,spawn radius]
	
	//CHERNARUS SPAWNS
	_spawns = [
		[[2000,10907,0.2],[],100,15],
		[[7730,4798,0.2],[],22,15],
		[[7195,9700,0.2],[],0,15]
	];

	//====================
	//EXTRA KONFIGURATION!
	//====================

	//LOOT IN VEHICLE
	_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",[3,4,5]]],
		[["addWeaponCargoGlobal","ItemEtool",[3,4,5]]],
		[["addWeaponCargoGlobal","Binocular_Vector",[2,3,4]]],
		[["addMagazineCargoGlobal","ItemBloodBag",[8,12,16]]],
		[["addMagazineCargoGlobal","PartEngine",[5,7,9]]],
		[["addMagazineCargoGlobal","ItemBandage",[20,25,30]]],
		[["addMagazineCargoGlobal","HandGrenade_West",[6,10,14]]],
		[["addMagazineCargoGlobal","ItemBriefcase100oz",[1,1,1]]],
		[["addMagazineCargoGlobal","ItemBriefcase100oz",[1,2,2]]]
	];
	
	//=========================
	//END OF KONFIGURATION
	//=========================
	
	//==============================================================================================================
	//==============================================================================================================
	//==============================================================================================================
	//==============================================================================================================
	
	//Avoid Vehicles to Explode when Entering it
	waitUntil {sleep 2;!isNil "DZE_safeVehicle"};
	_cascaVehicles = [];
	{
		_car = _x select 0;
		if !(_car in _cascaVehicles) then {
			_cascaVehicles = _cascaVehicles + [_car];
		};
	} forEach donn_carsConvy;
	DZE_safeVehicle = DZE_safeVehicle + _cascaVehicles;	
	
	//AI handle damage Event Handler
	donn_casca_unit_HD = {
		_damage = _this select 2;
		if (_damage > 0.1) then { 
			_hurtedOne = _this select 0;
			_partDamage = _this select 1;
			_ofender = _this select 3;
			//diag_log (_partDamage + " / " + str _damage + " / " + str diag_tickTime);
			if (isPlayer _ofender) then {
				_unit = _this select 0;
				_dist = (_this select 3) distance _unit;
				_groupShoted = group _unit;
				_groupShoted setVariable ["donn_pshot",true,false]; //MANY
				if (_dist < 100) then {_groupShoted reveal [_this select 3,4];}; //MANY
				if (_partDamage == "body" && _damage > 1) then {
					if (_hurtedOne getVariable ["donn_bomb",false]) then {
						//diag_log "[DONN DONN DONN] BOOOOM!";
						_hurtedOne setVariable ["donn_bomb",false,false];
						_uPos = position _hurtedOne;
						"HelicopterExploSmall" createVehicle _uPos;
						"G_Camel_HE" createVehicle _uPos;
						_hurtedOne setDamage 1;					
					};
				};
			} else {
				if (_hurtedOne != _ofender) then {_damage = 0;};
			};
		};
		_damage
	};
	
	//Vehicle Handle Damage
	donn_casca_veh_HD = {
		_motor = _this select 0;
		_dist = (_this select 3) distance _motor;
		_groupShoted = _motor getVariable ["car_group",GrpNull];
		_inWar = _groupShoted getVariable ["donn_inWar",false];
		if (!_inWar) then {
			_crew = crew _motor;
			if (count _crew > 0) then {
				_groupShoted setVariable ["donn_pshot",true,false];
				if (_dist < 120) then {_groupShoted reveal [_this select 3,4];};
			};
		};
		if (_inWar) then {_groupShoted setVariable ["donn_pshot",true,false];	if (_dist < 120) then {_groupShoted reveal [_this select 3,4];};};
	};
	
	//Show Spawn Icons on Map
	_spawns spawn {
		_spawns = _this;
		_donn_casca_icons = [];
		{
			_donn_casca_icons = _donn_casca_icons + [[_x select 0,"Convoy Spawn " + str (_forEachIndex + 1)]];
		} forEach _spawns;
		while {true} do {
			{
				_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;
			sleep 15;
			{
				deleteMarker ("Donn_Spawn_" + str _forEachIndex);
			} forEach _donn_casca_icons;
		};
	};
	
	//Loot Selection Function
	_donn_selectLoot = {
		_lootsOriginal = _this select 0;
		_qtd = _this select 1;
		_loots = +_lootsOriginal;
		_qtd = _qtd min 8;
		_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 set [_rnd,"delme"];
			_loots = _loots - ["delme"];
			if (count _loots == 0) then {_loots = +_lootsOriginal;};
		};
		_return
	};
	
	//Add or 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 and re-assign a new driver
	donn_cleanUnit = {
		_unit = _this select 0;
		_motor = assignedVehicle _unit;
		_role = assignedVehicleRole _unit;
		_unit removeAllEventHandlers "handleDamage";
		if (_role select 0 == "Driver") then {
			_assignedVehDrv = assignedVehicle _unit;
			_unitsGrp = units group _unit;
			_newDriver = ObjNull;
			{
				if (alive _x) then {
					if (assignedVehicle _x == _assignedVehDrv) then {
						if (isNull _newDriver) then {
							_newDriver = _x;
						} else {
							if ((assignedVehicleRole _newDriver) select 0 == "Turret") then {
								_newDriver = _x;
							};
						};
					};
				};
			} forEach _unitsGrp;
			if (!isNull _newDriver) then {_newDriver assignAsDriver _motor;};
		};
		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 = _donn_wps + [position _x];
			};
		};
	} forEach _roads;
	_roads = nil;
	
	//Bot Weapons
	_donn_weapons = [
		["Mk_48_DZ","100Rnd_762x51_M240"],
		["M249_DZ","200Rnd_556x45_M249"],
		["G36C","30Rnd_556x45_Stanag"],
		["G36C_camo","30Rnd_556x45_Stanag"],
		["G36A_camo","30Rnd_556x45_Stanag"],
		["G36K_camo","30Rnd_556x45_Stanag"],
		["AK_47_M","30Rnd_762x39_AK47"],
		["AKS_74_U","30Rnd_545x39_AK"],
		["bizon_silenced","64Rnd_9x19_SD_Bizon"],
		["DMR_DZ","20Rnd_762x51_DMR"],
		["RPK_74","75Rnd_545x39_RPK"]
	];
	
	//Refual Vehicles
	donn_motor = [];
	[] spawn {
		while {true} do {
			{if (fuel _x > 0) then {_x setFuel 1;};} forEach donn_motor;
			uiSleep 120;
		};
	};	
	
	//Casca Units Icons on Map
	donn_units_motor = [];
	[] spawn {
		//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;
		};
		_add = [];
		_remove = [];
		_update = [];
		_donn_units_motor_icon_old = [];
		_count = 0;
		while {true} do {
			{
				deleteMarker vehicleVarName _x;
			} forEach _remove;
			{
				_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 = [vehicleVarName _x,position _x,_color,_txt];
				_array call _addIcon;
			} forEach _add;
			{
				_posXY = position _x;
				_marker = vehicleVarName _x;
				_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 = _donn_units_motor_icon + [_veh];
					};
				} else {
					_donn_units_motor_icon = _donn_units_motor_icon + [_x];
				};
				if !(_assigned in _vehIcon) then {
					_vehIcon = _vehIcon + [_assigned];
					_donn_units_motor_icon = _donn_units_motor_icon + [_assigned];
				};
			} forEach donn_units_motor;
			if (_count >= 10) then {
				_add = _donn_units_motor_icon;
				_remove = _donn_units_motor_icon_old;
				_donn_units_motor_icon_old = _donn_units_motor_icon;
				_count = 0;
			} else {
				_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;
			_count = _count + 1;
		};
	};
	
	//Safe Sleep
	sleep 10;
	
	//Spawn Casca Units/Cars
	_totalUnitCount = 0;
	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 EAST;
		_convoy = _convoyFormation select (_cs-1);
		_behaviorSafe = "CARELESS";
		_speed = "FULL";
		_qtd = count _convoy;
		_cars = [];
		{
			_cars = _cars + [donn_carsConvy select _x];
		} forEach _convoy;
		_donn_motor = [];
		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 allowDamage false;
			_motor setVehicleVarName ("CASCA_CAR_" + str _cs + "_" + str _n);
			_motor setVariable ["ObjectID","1",true];
			_motor setVariable ["ObjectUID","1",true];
			_motor setVariable ["car_group",_rosa_group,false];
			_motor removeAllEventHandlers "HandleDamage";
			_motor addEventHandler ["HandleDamage",{_this call donn_casca_veh_HD}];
			_motor setDir (_spawn select 2);
			_motor setFuel 1;
			_donn_motor = _donn_motor + [_motor];
			donn_motor = donn_motor + [_motor];
			_motor addEventHandler ["GetIn",{
				_motor = _this select 0;
				_unit = _this select 2;
				if (isPlayer _unit) then {
					_unit action ['getOut', _motor];
				};
			}];
			//Add Vehicle Ammo
			_ammos = _car select 2;
			if (count _ammos > 0) then {
				[_ammos,_motor,"add"] call donn_cascar_tuAmmo;
				_motor setVariable ["donn_tu",true,true];
			};
			//count Crew
			_driverCount = 1;
			_turreterCount = count _ammos;
			_cargorsCount = _car select 1;
			_crewCount = _driverCount + _turreterCount + _cargorsCount;
			//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,_crewCount] call _donn_selectLoot);
			//Spawn Soldiers
			_gunnerPos = 0;
			for "_y" from 1 to _crewCount do {
				//Create Soldier
				_totalUnitCount = _totalUnitCount + 1;
				_unit = _rosa_group createUnit [donn_soldierSkin,[50,50,50],[],50,"PRIVATE"];
				_unit setVehicleVarName ("CASCA_AI_" + str _cs + "_" + str _n + "_" + str _y);				
				[_unit] joinSilent _rosa_group;
				_unit addEventHandler ["Killed",{_this call donn_cleanUnit;}];
				_unit addEventHandler ["HandleDamage",{_this call donn_casca_unit_HD}];
				_isBomber = false;
				if (_totalUnitCount mod floor (1/_bomberManPerc) == 0) then {_isBomber = true;};
				_unit setVariable ["donn_bomb",_isBomber,false];
				donn_units_motor = donn_units_motor + [_unit];
				_unit disableAi "TARGET";
				_unit disableAi "AUTOTARGET";
				//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;
				};
				if (_y > 1 && _y <= 1 + _turreterCount) then {
					//Turreters
					_unit assignAsGunner _motor;
					_unit moveInTurret [_motor,[_gunnerPos]];
					_unit setSkill _turretMansSkill;
					_gunnerPos = _gunnerPos + 1;
 				};
				if (_y > 1 + _turreterCount) then {
					//Cargors
					_unit assignAsCargo _motor;
					_unit moveInCargo _motor;
					_unit setSkill _cargoMansSkill;
				};
			};
			_rosa_group setCombatMode "RED";
			_rosa_group setBehaviour _behaviorSafe;
			_rosa_group setVariable ["donn_pshot",false,false];
			_rosa_group setVariable ["donn_inWar",false,false];
			_rosa_group allowFleeing 0;
			//Unstuck Car
			_motor spawn {
				_motor = _this;
				_excludeGeneral = [];
				_count = 0;
				while {true} do {
					_fix = false;
					sleep 5;
					while {!isNull driver _motor && isEngineOn _motor} do {
						_lastPos = position _motor;
						sleep 5;						
						_newPos = position _motor;
						if (_newPos distance _lastPos < 0.5) then {
							_count = _count + 1;
						} else {
							_count = 0;
							_excludeGeneral = [];
						};
						if (_count >= 15) exitWith {_fix = true;};
					};
					if (_fix) then {
						_lastPos = position _motor;
						_noPlayerNear = true;
						_near = (position _motor) nearEntities ["CAManBase",350];
						{
							if (isPlayer _x) exitWith {
								_noPlayerNear = false;
							};
						} forEach _near;
						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;
							};
							_notOk = true;
							_exclude = [];
							_theRoadSafe = _roads call BIS_fnc_selectRandom;
							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;
								_occuping = ((position _theRoad) nearEntities ["CAManBase",15]) - [_motor];
								_newPos = position _motor;
								if (_newPos distance _lastPos >= 0.5) then {
									_notOk = false;
									_count = 0;
								} else {
									if (count _occuping == 0) then {
										_notOk = false;
										_count = 0;
										if (_theRoad != _theRoadSafe) then {_excludeGeneral = _excludeGeneral + [_theRoad]};
										_motor setPos (position _theRoad);
									} else {
										if (_theRoad != _theRoadSafe) then {_exclude = _exclude + [_theRoad];};
										sleep 7.5;
									};
								};
							};
						};
					};
				};
			};
		};
		//Make Units leave or Embark car
		[_rosa_group,_behaviorSafe,_donn_motor] spawn {
			_rosa_group = _this select 0;
			_behaviorSafe = _this select 1;
			_donn_motor = _this select 2;
			_KA_playersLast = false;
			_followeds = [];	
			_noHurtTime = 0;
			_tm = 0;
			_tmSup = 0;
			_targetOff = true;
			_reTravel = 0;
			while {!isNil "_rosa_group"} do {
				_KA_players = false;
				_shotNearPlayers = _rosa_group getVariable ["donn_pshot",false];
				if (isNil "_shotNearPlayers") then {_shotNearPlayers = false;};
				if (_shotNearPlayers) then {
					_rosa_group setVariable ["donn_pshot",false,false];
					_KA_players = true;
				};
				if (str _KA_players != str _KA_playersLast && _KA_players) then {
					_rosa_group setVariable ["donn_inWar",true,false];
					{_x enableAi "AUTOTARGET";} forEach units _rosa_group;
					_reTravel = 0;
					_vehGrp = [];
					_inCar = [];
					_onFoot = [];
					{
						_veh = vehicle _x;
						if (_x != _veh) then {
							if (!(_veh in _vehGrp) && !isNull driver _veh) then {_vehGrp = _vehGrp + [_veh];};
							_inCar = _inCar + [_x];
						} else {
							_onFoot = _onFoot + [_x];
						};
					} forEach units _rosa_group;
					{_x enableAi "TARGET";} forEach _onFoot;
					_start = time;
					_timePassed = 0;
					_danger = true;
					while {_danger && _timePassed < 2} do {
						_danger = false;
						{if ({isPlayer _x} count (_x nearEntities ["CAManBase",50]) > 0) then {_danger = true;};} forEach _vehGrp;
						sleep 1;
						_timePassed = time - _start;
					};
					_targetOff = false;
					{_x enableAi "TARGET";} forEach _inCar;
					_turreters = [];
					{if ((assignedVehicleRole _x) select 0 == "Turret") then {_turreters = _turreters + [_x];};} forEach units _rosa_group;
					_leaveToFight = (units _rosa_group) - _turreters;
					{sleep 0.001;[_x] allowGetIn false;} forEach _leaveToFight;
					{_x setFuel 0;} forEach _donn_motor;
					sleep 2.5;
					_rosa_group setBehaviour "COMBAT";
					_rosa_group setCombatMode "RED";
					_tmSup = 15;
				};
				if (!_KA_players) then {_noHurtTime = _noHurtTime + _tm;};
				if (!_KA_players && _noHurtTime > 180 && !_targetOff) then {
					_targetOff = true;
					{_x disableAi "TARGET";} forEach units _rosa_group;
					{_x disableAi "AUTOTARGET";} forEach units _rosa_group;
					sleep 1;
					_rosa_group setBehaviour _behaviorSafe;
					_rosa_group setCombatMode "RED";
					{[_x] allowGetIn true;sleep 0.001;[_x] orderGetIn true;} forEach units _rosa_group;
					_tmSup = 0;
					_reTravel = 1;
				};
				_KA_playersLast = _KA_players;
				_tm = 1 max _tmSup;
				if (_KA_players) then {_noHurtTime = -_tm;};
				sleep _tm;
				if (_reTravel > 0) then {
					_embNOk = [];
					{if (_x == vehicle _x && alive _x) then {_embNOk = _embNOk + [_x];};} forEach units _rosa_group;
					if (count _embNOk == 0) then {
						{_x setFuel 1;} forEach _donn_motor;_rosa_group setVariable ["donn_inWar",false,false];_reTravel = 0;
					} else {
						if (_reTravel > 60) then {{_x doMove (position (assignedVehicle _x));} forEach _embNOk;_reTravel = 1;};
						{[_x] allowGetIn true;sleep 0.01;[_x] orderGetIn true;} forEach _embNOk;
						_reTravel = _reTravel + 1;
					};
				};
			};
		};
		//Make the Route
		_origin = _spawn select 0;
		_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 Before Next Spawn
		sleep _timeBetweenSpawns;
	};
};
Link to comment
Share on other sites

_bomberManPerc = 0.1;	//Percentage of bomberman AI: 0 is 0% and 1 is 100%
This is the percentage of bomber mans in all convoys.

Examples:

0.0 - No bomber mans

0.5 - Half the AI are bomber mans.

1.0 - All AI are bomber mans.

Link to comment
Share on other sites

think there is too much loot in the vehicles imo, before you would have had just 1 loot pile in the vehilce eg 8 blood bags or 5 engines But now we have 3-4 loot piles in the vehicle eg 8 blood , 4 engines and guns etc which is a bit too much :)  like the script though thnx

Link to comment
Share on other sites

Tang0,

 

Quantity of loot piles is bases in the number of AI in the convoy. More AI, more loot piles.

Quantity of itens in each loot pile is based on the number of cars in the convoy. More cars, more itens in each loot plile.

 

What is the better to fix excessive loot?

 

1 - Make bots harder to kill so the loot is deserved?

2 - Lower quantity of loot piles?

3 - Lower quantity of itens in each loot piles?

4 - Add more simple itens on the loot pile table?

Link to comment
Share on other sites

i have missions on my server with hard ai and high end loot, i dont think ai can be made hard enough to warrent the high loot in the convoy tbh, i think probably 2 -  lower quanity of loot piles, though i suppose you could set each of those options at mission start in variables so they could be tweeked to each server needs - loving the convoy though - thnx :)

Link to comment
Share on other sites

This is nice:

 

1) - Bomber Man run to player.

2) - Configuration to set loot to low, medium and high.

3) - Bomber Man with different skin.

 

For item 2):

 

Now, quantity of loot piles in the vehicle (q) is equal to n, where n is the number of AI in the vehicle.

 

Now:

q = n

 

n = 10 makes q=10

n = 5 makes q = 5

n = 2 makes q = 2

n = 1 makes q = 1

 

Future:

q = ceil (n/x)

where x is the loot cutter

 

for x = 1

n = 10 makes q=10

n = 5 makes q = 5

n = 2 makes q = 2

n = 1 makes q = 1

 

for x = 2

n = 10 makes q=5

n = 5 makes q = 3

n = 2 makes q = 1

n = 1 makes q = 1

 

for x = 3

n = 10 makes q=4

n = 5 makes q = 2

n = 2 makes q = 1

n = 1 makes q = 1

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
×
×
  • Create New...