Jump to content

[Release] Casca Vehicles Convoy for any Map


Donnovan

Recommended Posts

[] spawn {
	waitUntil {!isNil "DZE_safeVehicle"};
	sleep 5;
	_cascaVehicles = ["Lada2","UAZ_CDF","HMMWV_M1035_DES_EP1","Offroad_DSHKM_Gue","UAZ_MG_CDF","WMMWV_M998A2_SOV_DES_EP1"];
	DZE_safeVehicle = DZE_safeVehicle + _cascaVehicles;
};

Added this as updated in post #1.  We are not being killed by the cars now!   :) However, we are promptly kicked out of the vehicle.  Four of us tried and none of us were able to sit in the cars, but like I said, we don't blow up for trying.

 

@ Charles,

 

I will love to help. You already helped me! But even if you had not helped.

 

You can edit anything you want.

 

About dificulty, you believe a vehicle with turret could help? This can be done really simple, since the code for it, and for bigger convoys (4, 5, 6 vehicles) is ready.

 

 

Our vision would be one single mission running at a time, perhaps a few times per server restart (this part I believe I know how to change).

 

As far as the convoy, we would envision an armed vehicle at the front and rear, with perhaps 2-3 SUV's in the middle, each with 4-6 AI.  Does this sound pretty close to what's already available, as you mentioned?

 

That being said, we really like and appreciate the script how it is, too.

Link to comment
Share on other sites

nice work

 

convoys run good but they are way too easy if you have a M240 lol

 

how do we add the turrents back in ?

 

added  "HMMWV_Armored","HMMWV_M1035_DES_EP1" yet no gunner in gunner position.

 

Any way to add a heli to convoy 100m above make it follow the leader ?

 

would also like to have 4,5,6 vehicles in each convoy

 

I run this as a event ["any","any","any","any",30,"convoy"] placed convoy.sqf in the module folder server side and 2nd script in custom folder mission side.

Link to comment
Share on other sites

nice work

 

convoys run good but they are way too easy if you have a M240 lol

 

how do we add the turrents back in ?

 

added  "HMMWV_Armored","HMMWV_M1035_DES_EP1" yet no gunner in gunner position.

 

Any way to add a heli to convoy 100m above make it follow the leader ?

 

would also like to have 4,5,6 vehicles in each convoy

 

I run this as a event ["any","any","any","any",30,"convoy"] placed convoy.sqf in the module folder server side and 2nd script in custom folder mission side.

To have the vehicles use their turrets  go to approx line 520 and find the   _cars = [   

Mine looks like so:

_cars = [
//[vehicle, cargo places, [gunner 1 ammo, gunner 2 ammo, ...], loot]
["BAF_Jackal2_L2A1_w",3,[3,3],_loot1 call BIS_fnc_selectRandom],
 
 
 
its the  gunner ammo sections you need to change.  Dont forget to add the vehicle to the _cascaVehicles   sections as well just to be safe.
 
Thats how i got them to be armed.  The Jackal has 2 gunners, passenger, and a  driver.  
 
Next is to figure out how to get in a vehicle and stay in it.  I only wan tthem to stay till restart so people can sell them or use them temporarily. 
 
Hope this helps!  :)
 
 
 
Link to comment
Share on other sites

 

To make the vehicles enterable, remove this code from the script:

_motor addEventHandler ["GetIn",{
	_motor = _this select 0;
	_player = _this select 2;
	if (_player in playableUnits) then {
		_player action ['getOut', _motor];
	};
}];

 

could you do this?

_motor addEventHandler ["GetIn",{
			_motor = _this select 0;
			_player = _this select 2;
			if (_player in playableUnits) then {
				_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: This vehicle will disappear on server restart!","PLAIN DOWN",5];
			};
		}];
Link to comment
Share on other sites

Every one of the _*rand variables (whether defined by BIS_fnc_selectRandom or by your loadout_fnc_selectRandom) contains exactly one item.  _rndnumber* are defined once and hold a constant number, so the randomization in the script,

		call compile format [
			"_motor %1 ['%2',%3];",
			_car select 3 select 0,
			_car select 3 select 1,
			_car select 3 select 2 select (_qtd - 1)
		];

will be for naught because every entry in [_rndnumber2, _rndnumber2, _rndnumber2]  is equal.

 

I assume you could do something like

_medicalrand = ["ItemPainkiller", "ItemMorphine", "ItemBandage", "ItemBloodbag", "ItemAntibiotic","ItemEpinephrine"];

[...]

["addMagazineCargoGlobal", (_medicalrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 2) + 2)]],

[...]

and repeat the last line a few times. Same for the other loot types. Note that the definition of _medicalrand now has no BIS_fnc_selectrandom, keeping the array intact for multiple choosing.

 

This way

  • there would be more lines generating medical loot in _loot1, each one picking randomly from _medicalrand and
  • each one generating a different set of numbers to be picked from.

When duplicating the lines in _loot you of course have to adjust the random number, that's lower (round(random 2)+2).

 

Ok, so I made some changes, but there's still just one item appearing in each vehicle. Here's the updated code I'm using:

 

_toolsrand = ["NVGoggles","ItemEtool","Binocular_Vector","ItemFlashlight","ItemWatch","ItemKnife","ItemHatchet","ItemCompass","ItemMap","ItemToolbox","ItemMatchbox","ItemFlashlightRed","ItemGPS","ItemCrowbar"];
_medicalrand = ["ItemPainkiller", "ItemMorphine", "ItemBandage", "ItemBloodbag", "ItemAntibiotic","ItemEpinephrine"];
_foodrand = ["FoodCanBadguy", "FoodCanBoneboy", "FoodCanCorn", "FoodCanCurgon", "FoodCanDemon", "FoodCanFraggleos", "FoodCanGriff", "FoodCanHerpy", "FoodCanOrlok", "FoodCanPowell", "FoodCanTylers", "FoodCanSardines", "FoodCanBakedBeans", "FoodCanFrankBeans", "FoodCanPasta", "ItemWaterbottleUnfilled","ItemWaterbottleBoiled","FoodmuttonCooked","FoodchickenCooked","FoodBaconCooked","FoodRabbitCooked","FoodCanUnlabeled","FoodPistachio","FoodNutmix","FoodMRE"];
_drinkrand = ["ItemSodaClays", "ItemSodaDrwaste", "ItemSodaLemonade", "ItemSodaLvg","ItemSodaMzly", "ItemSodaRabbit", "ItemSodaSmasht", "ItemSodaOrangeSherbet", "ItemSodaMdew", "ItemSodaRbull", "ItemSodaMtngreen", "ItemSodaCoke", "ItemSodaPepsi", "ItemWaterbottle"];
_backpackrand = ["DZ_Patrol_Pack_EP1","DZ_Assault_Pack_EP1","DZ_Czech_Vest_Puch"];
_partsrand = ["PartEngine","PartVRotor","PartWheel","PartGlass","PartFueltank","PartGeneric"];
_buildingrand = ["ItemSandbag","ItemTankTrap","ItemTentOld","ItemWire","30m_plot_kit","ItemVault","ItemTentDomed","ItemTentDomed2","ItemLightBulb","ItemGenerator","ItemComboLock","ItemLockbox","ItemPole","ItemCorrugated","ItemMixOil","bulk_ItemSandbag","bulk_ItemTankTrap","bulk_ItemWire","PartPlywoodPack","CinderBlocks","MortarBucket","PartPlankPack"];
_moneyrand = ["ItemSilverBar","ItemSilverBar","ItemSilverBar","ItemSilverBar","ItemSilverBar","ItemSilverBar","ItemSilverBar","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar10oz","ItemGoldBar10oz","ItemBriefcase10oz","ItemBriefcase50oz","ItemBriefcase100oz"];
_loot1 = [
	["addWeaponCargoGlobal",(_toolsrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 4) + 2)]],
	["addMagazineCargoGlobal",(_medicalrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 6) + 4)]],
	["addMagazineCargoGlobal",(_foodrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 8) + 2)]],
	["addBackpackCargoGlobal",(_backpackrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 1) + 2)]],
	["addMagazineCargoGlobal",(_partsrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 4) + 2)]],
	["addMagazineCargoGlobal",(_drinkrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 6) + 2)]],
	["addMagazineCargoGlobal",(_moneyrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 1) + 2)]]
];

Link to comment
Share on other sites

Now I decided that I don't want loot in the armed vehicles, only in the cargo vehicle, so I commented out the loot for the armed vehicles and I have this for the cargo vehicle:

_loot2 = [
	["addMagazineCargoGlobal",(_buildingrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 6) + 2)]],
	["addMagazineCargoGlobal",(_buildingrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 6) + 2)]],
	["addMagazineCargoGlobal",(_buildingrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 6) + 2)]],
	["addMagazineCargoGlobal",(_buildingrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 6) + 2)]],
	["addMagazineCargoGlobal",(_buildingrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 6) + 2)]],
	["addMagazineCargoGlobal",(_buildingrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 6) + 2)]],
	["addMagazineCargoGlobal",(_moneyrand call BIS_fnc_selectRandom), [(round(random 2) + 2), (round(random 2) + 2), (round(random 1) + 2)]]
];

When I checked the cargo vehicle, only the "moneyrand" was in there. None of the building supplies. Suggestions?

Link to comment
Share on other sites

I had another look into the script and came up with a different interpretation, sorry:

	_cars = [
		//[vehicle, cargo places, [gunner 1 ammo, gunner 2 ammo, ...], loot]
		["Lada2",1,[],_loot1 call BIS_fnc_selectRandom],
		["UAZ_CDF",2,[],_loot1 call BIS_fnc_selectRandom],
		["HMMWV_M1035_DES_EP1",3,[],_loot2 call BIS_fnc_selectRandom]
	];

is the culprit. Here only one entry from _loot1 or _loot2 is picked, regardless from how randomized _loot<n> is.

 

You could try to put something like (please check syntax)

// additional loot for last vehicle
if ( _x == _qtd ) then {
  _motor addMagazineCargoGlobal [(_moneyrand call BIS_fnc_selectRandom), (round(random 2) + 2)];
  _motor addMagazineCargoGlobal [(_drinkrand call BIS_fnc_selectRandom), (round(random 2) + 2)];
};

between the sections //Put Loot in the Car and //Put vehicle Ammo and expand it to include your other _*rand.

Link to comment
Share on other sites

If you have coin currency on your server I recommend adding these lines around line 600 or so

//Spawn Soldier


_driverCount = 1;
_turreterCount = count _ammos;
_cargorsCount = _car select 1;
_crewCount = _driverCount + _turreterCount + _cargorsCount;
_gunnerPos = 0;
_crew = [];
for "_y" from 1 to _crewCount do {
//Create Soldier
//_skin = ["Functionary1_EP1_DZ","TK_INS_Bonesetter_EP1","TK_INS_Bonesetter_EP1","TK_INS_Bonesetter_EP1","TK_INS_Bonesetter_EP1"];
_unit = _rosa_group createUnit ["Functionary1_EP1_DZ",[50,50,50],[],50,"PRIVATE"];
[_unit] joinSilent _rosa_group;
_unit setCombatMode "RED";
_unit setBehaviour "SAFE";
donn_units_motor = donn_units_motor + [_unit];
_unit addEventHandler ["Killed",{
_unit = _this select 0;
_cash = round(random 5) * 1000;
_unit setVariable["cashMoney",_cash,true];

_weapon = (weapons _unit) select 0;
removeAllWeapons _unit;
removeAllItems _unit;
if (random 100 > 50) then {
_unit addWeapon _weapon;
_unit selectWeapon _weapon;

Link to comment
Share on other sites

  • 2 weeks later...

I'm having issues with the actual AI not moving/driving. The convoys spawn every so often, I can see spawn point 1,2,3 on the map; But the vehicles just sit there not moving?
Any ideas what it could be?

*EDIT*
Seems to be the newest version of Infistar
 

/*  EXPERIMENTAL CU FIX   */ _CUF = true; /* true or false */ /* *experimental* - will transfer serverside units (including mission AI) to clientside */

 

Setting this to false fixes it.

Link to comment
Share on other sites

Tried the Andre Convoy, getting some errors;

 

 

12:39:08   Error Undefined variable in expression: _shotnearplayers

12:39:08 File mpmissions\DayZ_Overpoch_1.Chernarus\andre_convoy.sqf, line 536
12:39:09 Error in expression <etVariable ["donn_pshot",[]];
if (count _shotNearPlayers > 0) then {
{_rosa_grou>
12:39:09   Error position: <_shotNearPlayers > 0) then {
{_rosa_grou>
12:39:09   Error Undefined variable in expression: _shotnearplayers
12:39:09 File mpmissions\DayZ_Overpoch_1.Chernarus\andre_convoy.sqf, line 536
12:39:10 Error in expression <etVariable ["donn_pshot",[]];
if (count _shotNearPlayers > 0) then {
{_rosa_grou>
12:39:10   Error position: <_shotNearPlayers > 0) then {
{_rosa_grou>

 

 

12:38:03 Error in expression <lloweds;

} forEach _AiUnits;
if (_numbKA/_numbKA_total >= 0.5) then {_KA_players>
12:38:03   Error position: </_numbKA_total >= 0.5) then {_KA_players>
12:38:03   Error Zero divisor
12:38:03 File mpmissions\DayZ_Overpoch_1.Chernarus\andre_convoy.sqf, line 556
12:38:18 Error in expression <lloweds;
} forEach _AiUnits;
if (_numbKA/_numbKA_total >= 0.5) then {_KA_players>
12:38:18   Error position: </_numbKA_total >= 0.5) then {_KA_players>
12:38:18   Error Zero divisor
12:38:18 File mpmissions\DayZ_Overpoch_1.Chernarus\andre_convoy.sqf, line 556
12:38:33 Error in expression <lloweds;
} forEach _AiUnits;
if (_numbKA/_numbKA_total >= 0.5) then {_KA_players>
12:38:33   Error position: </_numbKA_total >= 0.5) then {_KA_players>
12:38:33   Error Zero divisor
Link to comment
Share on other sites

outlander,

 

Added a new line to the script. This line is commented with //here, outlander.

 

By the way, despite the errors, the script is working?

 

Those errors repeats again and again on the script?

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...