summaryrefslogtreecommitdiffstats
path: root/Server/AI/Orders/AI_Patrol.sqf
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
commite670b4ed55c459a21090bd0178ceaaaf12d87989 (patch)
treeb6833d5e842475f0ee27f5f617096445fdd4e4a1 /Server/AI/Orders/AI_Patrol.sqf
downloada2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.gz
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.bz2
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.zip
init
Diffstat (limited to 'Server/AI/Orders/AI_Patrol.sqf')
-rw-r--r--Server/AI/Orders/AI_Patrol.sqf34
1 files changed, 34 insertions, 0 deletions
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