-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathfn_RangeEngage.sqf
More file actions
60 lines (51 loc) · 1.24 KB
/
Copy pathfn_RangeEngage.sqf
File metadata and controls
60 lines (51 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
Author: Genesis
Description:
This function handles units actively engaging enemies from a larger distance
Parameter(s):
0: ARRAY - List of all units within a group
Returns:
nil
*/
params ["_Group","_SniperList"];
private _NearestEnemy = (leader _Group) call VCM_fnc_ClstKnwnEnmy;
if (count _NearestEnemy > 0) then
{
private _ShootArray = [];
{
if (_Group knowsAbout (_x # 1) > 1.5) then
{
_ShootArray pushback (_x # 1);
};
} foreach _NearestEnemy;
if (count _ShootArray > 0) then
{
{
if !(_x in _SniperList) then
{
if ((random 100) > 50) then
{
private _rtrn = [_ShootArray,_x,true,""] call VCM_fnc_ClstObj;
private _LOS = lineIntersectsSurfaces [eyePos _x, eyePos _rtrn, objNull, objNull, false, 1,"VIEW","GEOM"];
if (count _LOS > 0) then
{
private _IntersectPos = ((_LOS # 0) # 0);
if (_IntersectPos distance2D _rtrn < 20) then
{
[_x,_rtrn] spawn
{
params ["_Unit","_rtrn"];
sleep (2 + RANDOM 4);
for "_i" from 1 to (random 2) do
{
_Unit doSuppressiveFire _rtrn;
sleep 3;
};
};
};
};
};
};
} foreach (units _Group);
};
};