Jump to content
Sign in to follow this  
toxicsludge

Video Tutorial: Random Patrols

Recommended Posts

Here I show you how to add random patrols using scripts to your Arma 3 missions.

This can be used for any map, on any unit, including Infantry, vehicles and air units.

Download the script here:

http://www.armaholic.com/page.php?id=19299

Add this code to the units 'Init' field and change to suit your preferences:

null = [this, 100, 200, "patrol1", "patrol1", 200, true, "SAFE", "RED", "LIMITED", "FILE", 0, 30, 0, [true,35,25,3,1]] execVM "USPS.sqf";

Share this post


Link to post
Share on other sites

Simple, and very well explained. Thanks TL!

Share this post


Link to post
Share on other sites
Simple, and very well explained. Thanks TL!
No worries mate! I've used this ever since Jester's vids taught me how to use the editor. Sometimes the simplest scripts are the best!

Share this post


Link to post
Share on other sites

For Random Patrols i use this:

if (!isServer) exitwith {};

private ["_pos","_dis","_nr","_locPos","_loc","_spawnPos","_grp","_patrol"];

_pos = _this select 0; // center position, use thistrigger for example
_dis = _this select 1; // max distance around center position
_nr = _this select 2; // number of spawned groups
_locPos = [];

_name = ["OIA_InfSentry","OIA_InfTeam"] call BIS_fnc_selectRandom; // Add other groups here if you like

for "_i" from 1 to (_nr) do
{
_loc = [_pos,_dis,[0,360],0,[0,_dis]] call SHK_pos;
_locPos = _locPos + [_loc];
};

if !(count _locPos == 0) then {
for "_i" from 1 to (count _locPos) do
{
	_spawnPos = (_locPos select (floor random count _locPos));
	_grp = createGroup east; // you could also spawn BLUFOR or INDEPENDENT groups
	_grp = [_spawnPos, east, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> _name)] call BIS_fnc_spawnGroup;
	_patrol = [_grp, _spawnPos, _dis, 7, "MOVE", "SAFE", "YELLOW", "LIMITED", "STAG COLUMN", "", [2,5,10]] call CBA_fnc_taskPatrol; // you could also use the Ultra Simple Patrol Script
	//DEBUG
	//[_spawnPos,"ColorRed"] call fnc_createMarker;
}
};

As you can see i use the mighty SHK_pos by Shuko to generate a number of random positions, then i spawn a random opfor patrol using the CBA_fnc_taskPatrol.

nul=[thistrigger,250,3] execVM "spawnInfPatrol.sqf";

would spawn 3 patrols inside a trigger area (set trigger size to 250 to see tha max. spawn distance in the editor).

So all you need to place in the editor is a single trigger !

Edited by Wiggum

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  

×