From c055d44dcdb87e8db49fb23e632fc086aa44cce6 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:53:22 +0300 Subject: init --- Server/AI/Orders/AI_Patrol.sqf | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Server/AI/Orders/AI_Patrol.sqf (limited to 'Server/AI/Orders/AI_Patrol.sqf') diff --git a/Server/AI/Orders/AI_Patrol.sqf b/Server/AI/Orders/AI_Patrol.sqf new file mode 100644 index 0000000..8cff904 --- /dev/null +++ b/Server/AI/Orders/AI_Patrol.sqf @@ -0,0 +1,34 @@ +Private ["_destination","_maxWaypoints","_pos","_radius","_rand1","_rand2","_team","_type","_update","_wps","_z"]; +_team = _this select 0; +_destination = _this select 1; +_radius = if (count _this > 2) then {_this select 2} else {30}; +if (typeName _destination == 'OBJECT') then {_destination = getPos _destination}; + +_update = true; +if (side _team == west || side _team == east) then { + _update = (_team) Call CanUpdateTeam; +}; + +//--- Override. +if (_update) then {_team Call UpdateTeam}; + +_maxWaypoints = 8; +_wps = []; +for [{_z=0},{_z<=_maxWaypoints},{_z=_z+1}] do { + _rand1 = (random _radius) - (random _radius); + _rand2 = (random _radius) - (random _radius); + _pos = [(_destination select 0)+_rand1,(_destination select 1)+_rand2,0]; + _tries = 100; + while {surfaceIsWater _pos && _tries > 0} do { + _tries = _tries - 1; + _rand1 = (random _radius) - (random _radius); + _rand2 = (random _radius) - (random _radius); + _pos = [(_destination select 0)+_rand1,(_destination select 1)+_rand2,0]; + }; + _type = if (_z != _maxWaypoints) then {'MOVE'} else {'CYCLE'}; + _wps = _wps + [[_pos,_type,35,40,"",[]]]; +}; + +diag_log Format["[WFBE (INFORMATION)][frameno:%4 | ticktime:%5] AI_Patrol: The %1 %2 Team is patrolling at %3",side _team,_team,_destination,diag_frameno,diag_tickTime]; + +[_team, true, _wps] Call AIWPAdd; \ No newline at end of file -- cgit v1.3.1