Jump to content
Sign in to follow this  
PeterBitt

Random Patrols on Streets

Recommended Posts

is it possible to make random vehicle patrols and force them to stay on the roads until contact?

i usualy use the USPS script but unfortunately the vehicles dont stick to the roads even in SAFE mode, they go off road all the time.

some help would be much appreciated, i searched but found no answer :)

Share this post


Link to post
Share on other sites

thank you for the reply!

i dont need to make convoys but single vehicles that patrol a given area, just like the USPS script does:

/*

Ultra Simple Patrol Script v1.4 by JW Custom

Put the below line in a units init field,

if your working with a group you only need to put it in the leaders init field.

------------------------------------------------------------------------------------------------------------

nul = [this, 500, "patrolMarker", "patrolMarker", 500, "AWARE", 100, "LIMITED", "FILE", 0, 0] execVM "USPS.sqf";

------------------------------------------------------------------------------------------------------------

argument 0: The unit/group leader we are dealing with

argument 1: The radius size where to randomly place the unit/group within

argument 2: The marker representing the radius center of where unit/group will be randomly placed within

argument 3: The marker representing the center of the unit/group patrol

argument 4: The radius size where unit/group will patrol within

argument 5: The behaviour of the unit/group

argument 6: Chance of unit/group existing in percentage. If set to 100 the unit/group will always exist.

argument 7: Movement speed of the unit/group.

argument 8: Group formation.

argument 9: Wait time in seconds before moving on to next waypoint. Set to 0 and theres no wait time.

argument 10: Altitude of unit/group. Unless unit/group are a air vehicle this should be set to 0.

For more detailed info read readme.rtf

*/

if (!isServer) exitWith {};

private ["_wp","_ranPos","_patrolMarker","_patrolRadius","_grp","_iniPos","_oldPos","_newPos","_grp","_spawnRadius","_unit","_spawnMarker","_unitBehaviour","_existChance","_unitSpeed","_unitFormation","_numGrp","_flyInHeight"];

_unit = _this select 0;

_spawnRadius = _this select 1;

_spawnMarker = _this select 2;

_patrolMarker = _this select 3;

_patrolRadius = _this select 4;

_unitBehaviour = _this select 5;

_existChance = _this select 6;

_unitSpeed = _this select 7;

_unitFormation = _this select 8;

_unitWaittime = _this select 9;

_flyInHeight = _this select 10;

_unit flyInHeight _flyInHeight;

_grp = group _unit;

_chance = ceil(random 100);

if (_chance > _existChance) then { {deleteVehicle vehicle _x; deleteVehicle _x; sleep 0.1;} forEach units _grp; };

_wp = _grp addWaypoint [getMarkerPos _patrolMarker, 1];

_wp setWaypointBehaviour _unitBehaviour;

_wp setWaypointSpeed _unitSpeed;

_wp setWaypointFormation _unitFormation;

_wp setWaypointType "MOVE";

_wp setWaypointCombatMode "RED";

[_grp, 1] setWaypointPosition [getMarkerPos _spawnMarker, _spawnRadius];

_iniPos = getWPPos [_grp,1];

if (_unit isKindOf "Man") then

{

{_x setpos _iniPos;} forEach units group _unit;

[_grp, 1] setWaypointPosition [getMarkerPos _patrolMarker, _patrolRadius];

sleep 2;

while {{alive _x} count units _grp > 0} do

{

waitUntil{ ((getPos leader _grp) distance (getWPPos [_grp,1]) < 5) };

sleep _unitWaittime;

[_grp, 1] setWaypointPosition [getMarkerPos _patrolMarker, _patrolRadius];

};

};

if(_unit isKindOf "Air") then

{

{vehicle _x setpos [(_iniPos select 0) + random 50, (_iniPos select 1) + random 50, _flyInHeight];} forEach units group _unit;

[_grp, 1] setWaypointPosition [getMarkerPos _patrolMarker, _patrolRadius];

sleep 2;

while {{alive _x} count units _grp > 0} do

{

waitUntil{ ((getPos leader _grp) distance (getWPPos [_grp,1]) < (_flyInHeight * 3) - _flyInHeight) };

sleep _unitWaittime;

[_grp, 1] setWaypointPosition [getMarkerPos _patrolMarker, _patrolRadius];

};

};

if(_unit isKindOf "LandVehicle") then

{

{vehicle _x setpos [(_iniPos select 0) + random 25, (_iniPos select 1) + random 25, 0];} forEach units group _unit;

[_grp, 1] setWaypointPosition [getMarkerPos _patrolMarker, _patrolRadius];

sleep 2;

while {{alive _x} count units _grp > 0} do

{

waitUntil{ ((getPos leader _grp) distance (getWPPos [_grp,1]) < 20) };

sleep _unitWaittime;

[_grp, 1] setWaypointPosition [getMarkerPos _patrolMarker, _patrolRadius];

};

};

the script is working perfectly exept for the little detail that the vehicles dont always drive on the roads, wich is what i want to have.

is there a way to make the script place the waypoints ONLY on roads?

Share this post


Link to post
Share on other sites
Doesn't upsmon have a roads only feature?

Yup, place a marker at the destination you want the patrol or convoy to move to, use the roads only feature and there ya go.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×