Jump to content

[RELEASE] Vehicle Patrols on missions


Recommended Posts

  • 4 weeks later...

how would you off set the ai patrol veh from spawing in the building object when mission spawns 

 

//Spawn patrol
_patrol = ["patrol"] call DZMSGetVeh;
[_coords,   //Position to patrol
_coords, // Position to spawn
75, //Radius of patrol
10,                     //Number of waypoints to give
_patrol, //Classname of vehicle (make sure it has driver and gunner)
1 //Skill level of units 
] call DZMSVehiclePatrol;
 
 
if the veh patrol spawn just 20 meters away from center 0 things would be good.
Link to comment
Share on other sites

 

how would you off set the ai patrol veh from spawing in the building object when mission spawns 

 

//Spawn patrol
_patrol = ["patrol"] call DZMSGetVeh;
[_coords,   //Position to patrol
_coords, // Position to spawn
75, //Radius of patrol
10,                     //Number of waypoints to give
_patrol, //Classname of vehicle (make sure it has driver and gunner)
1 //Skill level of units 
] call DZMSVehiclePatrol;
 
 
if the veh patrol spawn just 20 meters away from center 0 things would be good.

 

 

The same way the buildings are displaced. You are going to have to catch all the coords, XYZ and offset them.

Link to comment
Share on other sites

//Spawn patrol
_patrol = ["patrol"] call DZMSGetVeh;
[_coords,   //Position to patrol
_coords, [(_coords select 0) +10, (_coords select 1) +5,-0.3];
75, //Radius of patrol
10,                     //Number of waypoints to give
_patrol, //Classname of vehicle (make sure it has driver and gunner)
1 //Skill level of units 
] call DZMSVehiclePatrol;
 
 
 
how should this be? since its not spawning        _coords, [(_coords select 0) +10, (_coords select 1) +5,-0.3];
Link to comment
Share on other sites

//Spawn patrol
_patrol = ["patrol"] call DZMSGetVeh;
[_coords,   //Position to patrol
_coords, // Position to spawn
75, //Radius of patrol
10,                     //Number of waypoints to give
_patrol, //Classname of vehicle (make sure it has driver and gunner)
1 //Skill level of units 
] call DZMSVehiclePatrol;
 
 
how would i add +20 at the position to spawn? so veh doesn't spawn center of building in mission and blow up
Link to comment
Share on other sites

 

//Spawn patrol
_patrol = ["patrol"] call DZMSGetVeh;
[_coords,   //Position to patrol
_coords, // Position to spawn
75, //Radius of patrol
10,                     //Number of waypoints to give
_patrol, //Classname of vehicle (make sure it has driver and gunner)
1 //Skill level of units 
] call DZMSVehiclePatrol;
 
 
how would i add +20 at the position to spawn? so veh doesn't spawn center of building in mission and blow up

 

//Spawn patrol
_patrol = ["patrol"] call DZMSGetVeh;
[_coords,   //Position to patrol
[(_coords select 0) + 20, (_coords select 1) + 20, 0], // Position to spawn
75, //Radius of patrol
10,                     //Number of waypoints to give
_patrol, //Classname of vehicle (make sure it has driver and gunner)
1 //Skill level of units 
] call DZMSVehiclePatrol;
Link to comment
Share on other sites

Hi, Im getting the following error.

10:17:02 Error in expression <nSilent _unitGroup;
ai_vehicle_units = (ai_vehicle_units + 1);

_patrol = ["patr>
10:17:02   Error position: <ai_vehicle_units + 1);

_patrol = ["patr>
10:17:02   Error Undefined variable in expression: ai_vehicle_units
10:17:02 File z\addons\dayz_server\DZMS\Scripts\DZMSVehiclePatrol.sqf, line 14

Line 14 is

ai_vehicle_units = (ai_vehicle_units + 1);

I can't seem to find where the original variable is set.

Also, from what I can tell, its not really effecting the patrols, but I could be wrong.

 

Thanks

Link to comment
Share on other sites

Hi, Im getting the following error.

10:17:02 Error in expression <nSilent _unitGroup;
ai_vehicle_units = (ai_vehicle_units + 1);

_patrol = ["patr>
10:17:02   Error position: <ai_vehicle_units + 1);

_patrol = ["patr>
10:17:02   Error Undefined variable in expression: ai_vehicle_units
10:17:02 File z\addons\dayz_server\DZMS\Scripts\DZMSVehiclePatrol.sqf, line 14

Line 14 is

ai_vehicle_units = (ai_vehicle_units + 1);

I can't seem to find where the original variable is set.

Also, from what I can tell, its not really effecting the patrols, but I could be wrong.

 

Thanks

 

put this right above that line.

ai_vehicle_units = [];
Link to comment
Share on other sites

Okay, doing that has no resulted in the following error.

21:31:56 Error in expression <];
ai_vehicle_units = (ai_vehicle_units + 1);

_patrol = ["patrol"] call DZMSGe>
21:31:56 Error position: <+ 1);

_patrol = ["patrol"] call DZMSGe>
21:31:56 Error Generic error in expression
21:31:56 File z\addons\dayz_server\DZMS\Scripts\DZMSVehiclePatrol.sqf, line 15

Additionally, this has broken AI spawning and ability to complete mission.

Link to comment
Share on other sites

Okay, doing that has no resulted in the following error.

21:31:56 Error in expression <];
ai_vehicle_units = (ai_vehicle_units + 1);

_patrol = ["patrol"] call DZMSGe>
21:31:56 Error position: <+ 1);

_patrol = ["patrol"] call DZMSGe>
21:31:56 Error Generic error in expression
21:31:56 File z\addons\dayz_server\DZMS\Scripts\DZMSVehiclePatrol.sqf, line 15

Additionally, this has broken AI spawning and ability to complete mission.

 

Woops, it wants a value instead of an array....

 

Use this line instead:

ai_vehicle_units = 0;
Link to comment
Share on other sites

  • 3 weeks later...

12:03:44 Error in expression < [(_x select 0),(_x select 1)]} forEach _aicskill;
ai_vehicle_units = 0;
ai_vehi>
12:03:44 Error position: <_aicskill;
ai_vehicle_units = 0;
ai_vehi>

 

 

only error i get now after fixing alot from patch.... 

Link to comment
Share on other sites

I got these errors :/ script fresh installed - patrol is working.

 

18:14:34 [DZMS]: Running Major Mission EM1.
18:14:37 Error in expression < [(_x select 0),(_x select 1)]} forEach _aicskill;
ai_vehicle_units = (ai_vehicl>
18:14:37   Error position: <_aicskill;
ai_vehicle_units = (ai_vehicl>
18:14:37   Error Nicht definierte Variable in Ausdruck: _aicskill
18:14:37 File z\addons\dayz_server\DZMS\Scripts\DZMSVehiclePatrol.sqf, line 43

 

 

And when i add a hmmv the gunner has no ammo :(

 

edit:

 

i guess i fixed it - it works now (added line 14 and line 37) - but i dont know why a array for _aicskill fixed it oO

 

here my DZMSVehiclePatrol.sqf

if (!isServer)exitWith{};
private ["_heliTurrets","_wpnum","_radius","_gunner2","_skillarray","_startingpos","_heli_class","_startPos","_unitGroup","_pilot","_skill","_position","_wp","_patrol"];
_position = _this select 0;
_startingpos = _this select 1;
_radius = _this select 2;
_wpnum = _this select 3;
_heli_class = _this select 4;
_skill = _this select 5;
_skillarray = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];

_unitGroup = createGroup east;
_pilot = _unitGroup createUnit ["Bandit1_DZ", [0,0,0], [], 1, "NONE"];
[_pilot] joinSilent _unitGroup;
ai_vehicle_units = 0;
ai_vehicle_units = (ai_vehicle_units + 1);

_patrol = ["patrol"] call DZMSGetVeh;
_patrol = createVehicle [_patrol, [(_startingpos select 0),(_startingpos select 1), 0], [], 0, "CAN_COLLIDE"];
[_patrol] call DZMSSetupVehicle;
_patrol setFuel 1;
_patrol engineOn true;
_patrol setVehicleAmmo 1;
//_patrol addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}];
_patrol allowCrewInImmobile true; 
_patrol lock true;
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_patrol];

_pilot assignAsDriver _patrol;
_pilot moveInDriver _patrol;

_gunner = _unitGroup createUnit ["Bandit1_DZ", [0,0,0], [], 1, "NONE"];
_gunner assignAsGunner _patrol;
_gunner moveInTurret [_patrol,[0]];
[_gunner] joinSilent _unitGroup;

//Lets set the skills
_aicskill = [];
switch (_skill) do {
	case 0: {_aicskill = DZMSSkills0;};
	case 1: {_aicskill = DZMSSkills1;};
	case 2: {_aicskill = DZMSSkills2;};
	case 3: {_aicskill = DZMSSkills3;};
};
	
{_gunner setSkill [(_x select 0),(_x select 1)]} forEach _aicskill;
ai_vehicle_units = (ai_vehicle_units + 1);

//Now we need to figure out their loadout, and assign it
	
//Get the weapon array based on skill
_weaponArray = [_skill] call DZMSGetWeapon;

_weapon = _weaponArray select 0;
_magazine = _weaponArray select 1;
	
//diag_log text format ["[DZMS]: AI Weapon:%1 / AI Magazine:%2",_weapon,_magazine];
	
//Get the gear array
_aigearArray = [DZMSGear0,DZMSGear1,DZMSGear2,DZMSGear3,DZMSGear4];
_aigear = _aigearArray call BIS_fnc_selectRandom;
_gearmagazines = _aigear select 0;

{_pilot setSkill [(_x select 0),(_x select 1)]} forEach _aicskill;
{_x addweapon _weapon;_x addmagazine _magazine; _x addmagazine _magazine;} forEach (units _unitgroup);
{_x addEventHandler ["Killed",{[_this select 0, _this select 1, "vehicle"] call on_kill;}];} forEach (units _unitgroup);
[_patrol] spawn veh_monitor;

_unitGroup allowFleeing 0;
_unitGroup setBehaviour "CARELESS";
//_unitGroup setSpeedMode "FULL";
_unitGroup setCombatMode "RED";
for "_i" from 1 to _wpnum do {
	_wp = _unitGroup addWaypoint [[(_position select 0),(_position select 1),0],_radius];
	_wp setWaypointType "SAD";
	_wp setWaypointCompletionRadius 200;
};

_wp = _unitGroup addWaypoint [[(_position select 0),(_position select 1),0],100];
_wp setWaypointType "CYCLE";
_wp setWaypointCompletionRadius 200;

Link to comment
Share on other sites

  • 1 month later...

Hi people can any one shed some light on this error im getting with the DZMSVehiclePatrol script:

 

 

9:06:32 [DZMS]: Running Minor Mission SM4.
9:06:36 UH60Wreck_DZ: MainTurret - unknown animation source mainTurret
9:06:36 UH60Wreck_DZ: MainGun - unknown animation source mainGun
9:06:36 UH60Wreck_DZ: MachineGun_1 - unknown animation source Gatling_1
9:06:38 Error in expression <ach (units _unitgroup);
[_patrol] spawn veh_monitor;

_unitGroup allowFleeing 0;>
9:06:38 Error position: <veh_monitor;

_unitGroup allowFleeing 0;>
9:06:38 Error Undefined variable in expression: veh_monitor
9:06:38 File z\addons\dayz_server\DZMS\Scripts\DZMSVehiclePatrol.sqf, line 65
9:06:42 [DZMS]: (DZMSUnitsMinor) 3 AI Spawned, 3 units in mission.
9:06:45 [DZMS]: (DZMSUnitsMinor) 3 AI Spawned, 6 units in mission.
9:06:49 [DZMS]: (DZMSUnitsMinor) 3 AI Spawned, 9 units in mission.
9:06:50 [DZMS]: (DZMSUnitsMinor) Waiting for 0/9 Units or Less to be Alive and a Player to be Near the Objective.
9:07:07 "DZAI Monitor :: Server Uptime: [0d 0h 7m 19s]. Active AI Groups: 23."
9:07:07 "DZAI Monitor :: Static Spawns: 7. Respawn Queue: 0 groups queued."
9:07:07 "DZAI Monitor :: Dynamic Spawns: 0. Air Patrols: 7. Land Patrols: 8."

 

Mission still spawn cars as far as I can see

 

thanks

MegaZ

 

 this is the section with line 65 in red

 

//Get the gear array
_aigearArray = [DZMSGear0,DZMSGear1,DZMSGear2,DZMSGear3,DZMSGear4];
_aigear = _aigearArray call BIS_fnc_selectRandom;
_gearmagazines = _aigear select 0;

{_pilot setSkill [(_x select 0),(_x select 1)]} forEach _aicskill;
{_x addweapon _weapon;_x addmagazine _magazine; _x addmagazine _magazine;} forEach (units _unitgroup);
{_x addEventHandler ["Killed",{[_this select 0, _this select 1, "vehicle"] call on_kill;}];} forEach (units _unitgroup);
[_patrol] spawn veh_monitor;

_unitGroup allowFleeing 0;
_unitGroup setBehaviour "AWARE";
//_unitGroup setSpeedMode "FULL";
_unitGroup setCombatMode "RED";

Link to comment
Share on other sites

  • 2 weeks later...

After looking for veh_monitor in DZMS but finding it in WAI (old version, not 2.x)

veh_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI_v1\compile\vehicle_monitor.sqf";

I'm afraid there's a dependency to WAI left.

But looking into vehicle_monitor

if (!isServer) exitWith {};
private ["_mission","_veh"];
_veh = _this select 0;
if (count _this == 2) then {
	_mission = _this select 1;
} else {
	_mission = false;
};
waitUntil { count crew _veh > 0};
while {(alive _veh) and ({alive _x} count crew _veh > 0)} do {
	_veh setVehicleAmmo 1;
	_veh setFuel 1;
	if ({alive _x} count crew _veh == 0) then {
		_veh setDamage 1;
		_veh setVariable ["killedat", time];
	};
	if ((_mission) AND (clean_running_mission)) then {
		_veh setDamage 1;
		_veh setVariable ["killedat", time];
	};
	sleep 30;
};
_veh setDamage 1;
_veh setVariable ["killedat", time];

only clean_running_mission seems to be a WAI variable. That one seems to be set to true when a mission is running and false before/between missions.

Link to comment
Share on other sites

I used V2 though i changed it slightly, if your vehicles have no ammo use the DZ versions of them ie

DZMSPatrolVeh = ["ArmoredSUV_PMC_DZ","HMMWV_M998A2_SOV_DES_EP1_DZ","LandRover_Special_CZ_EP1_DZ","Offroad_DSHKM_Gue_DZ","Pickup_PK_GUE_DZ","HMMWV_M1151_M2_CZ_DES_EP1_DZ","GAZ_Vodnik_DZ"];

Link to comment
Share on other sites

  • 3 months later...

Hey Guys :)

Just a little Question:

Is it possible to add a Heli Patrol instead of the Land Vehicle Patrol?

That would be so nice, if someone can help me or post the code i will need for.

Thanks!

 

The code is a lot different as you need to manage their height, set the waypoints in the air, and set the fly-in heights when they first spawn.

Someone might do it, but it would require going through all the code.

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