Epoch Update

Epoch Update
This commit is contained in:
Teh Dango 2017-10-25 21:36:31 -04:00
parent b40479ec0d
commit c5e98f17e6
317 changed files with 23168 additions and 0 deletions

BIN
sarge.pbo Normal file

Binary file not shown.

1
sarge/$PBOPREFIX$ Normal file
View File

@ -0,0 +1 @@
addons\sarge

1
sarge/$PREFIX$ Normal file
View File

@ -0,0 +1 @@
addons\sarge

View File

@ -0,0 +1,111 @@
/****************************************************************
File:
Author:
Description:
Parameter(s):
Returns:
****************************************************************/
private["_grp","_typeofgrp","_side"];
_grp = _this select 0;
_typeofgrp = _this select 1;
_side = side _grp;
switch (_side) do
{
case "WEST":
{
If ("arti" in _typeofgrp) then
{
If (!(_grp in UPSMON_ARTILLERY_WEST_UNITS)) then {UPSMON_ARTILLERY_WEST_UNITS pushback _grp;};
}
else
{
If (_grp in UPSMON_ARTILLERY_WEST_UNITS) then {UPSMON_ARTILLERY_WEST_UNITS = UPSMON_ARTILLERY_WEST_UNITS - [_grp];};
};
If ("plane" in _typeofgrp) then
{
If (!(_grp in UPSMON_SUPPORT_WEST_UNITS)) then {UPSMON_SUPPORT_WEST_UNITS pushback _grp;};
}
else
{
If (_grp in UPSMON_SUPPORT_WEST_UNITS) then {UPSMON_SUPPORT_WEST_UNITS = UPSMON_SUPPORT_WEST_UNITS - [_grp];};
};
If ("supply" in _typeofgrp) then
{
If (!(_grp in UPSMON_SUPPLY_WEST_UNITS)) then {UPSMON_SUPPLY_WEST_UNITS pushback _grp;};
}
else
{
If (_grp in UPSMON_SUPPLY_WEST_UNITS) then {UPSMON_SUPPLY_WEST_UNITS = UPSMON_SUPPLY_WEST_UNITS - [_grp];};
};
};
case "EAST":
{
If ("arti" in _typeofgrp) then
{
If (!(_grp in UPSMON_ARTILLERY_EAST_UNITS)) then {UPSMON_ARTILLERY_EAST_UNITS pushback _grp;};
}
else
{
If (_grp in UPSMON_ARTILLERY_EAST_UNITS) then {UPSMON_ARTILLERY_EAST_UNITS = UPSMON_ARTILLERY_EAST_UNITS - [_grp];};
};
If ("plane" in _typeofgrp) then
{
If (!(_grp in UPSMON_SUPPORT_EAST_UNITS)) then {UPSMON_SUPPORT_EAST_UNITS pushback _grp;};
}
else
{
If (_grp in UPSMON_SUPPORT_EAST_UNITS) then {UPSMON_SUPPORT_EAST_UNITS = UPSMON_SUPPORT_EAST_UNITS - [_grp];};
};
If ("supply" in _typeofgrp) then
{
If (!(_grp in UPSMON_SUPPLY_EAST_UNITS)) then {UPSMON_SUPPLY_EAST_UNITS pushback _grp;};
}
else
{
If (_grp in UPSMON_SUPPLY_EAST_UNITS) then {UPSMON_SUPPLY_EAST_UNITS = UPSMON_SUPPLY_EAST_UNITS - [_grp];};
};
};
case "RESISTANCE":
{
If ("arti" in _typeofgrp) then
{
If (!(_grp in UPSMON_ARTILLERY_GUER_UNITS)) then {UPSMON_ARTILLERY_GUER_UNITS pushback _grp;};
}
else
{
If (_grp in UPSMON_ARTILLERY_GUER_UNITS) then {UPSMON_ARTILLERY_GUER_UNITS = UPSMON_ARTILLERY_GUER_UNITS - [_grp];};
};
If ("plane" in _typeofgrp) then
{
If (!(_grp in UPSMON_SUPPORT_GUER_UNITS)) then {UPSMON_SUPPORT_GUER_UNITS pushback _grp;};
}
else
{
If (_grp in UPSMON_SUPPORT_GUER_UNITS) then {UPSMON_SUPPORT_GUER_UNITS = UPSMON_SUPPORT_GUER_UNITS - [_grp];};
};
If ("supply" in _typeofgrp) then
{
If (!(_grp in UPSMON_SUPPLY_GUER_UNITS)) then {UPSMON_SUPPLY_GUER_UNITS pushback _grp;};
}
else
{
If (_grp in UPSMON_SUPPLY_GUER_UNITS) then {UPSMON_SUPPLY_GUER_UNITS = UPSMON_SUPPLY_GUER_UNITS - [_grp];};
};
};
};

View File

@ -0,0 +1,40 @@
//****************************************************************
//File: UPSMON_CanSee.sqf
//Author: Azroul13
//Description:
// Check if the unit not facing something that block his view
//Parameter(s):
// <--- Unit
// <--- unit direction
// <--- Height
//Returns:
// boolean
//****************************************************************
private ["_see","_infront","_uposASL","_opp","_adj","_hyp","_eyes","_obstruction","_angle"];
_unit = _this select 0;
_angle = _this select 1;
_hyp = _this select 2;
_eyes = eyepos _unit;
_adj = _hyp * (cos _angle);
_opp = sqrt ((_hyp*_hyp) - (_adj * _adj));
_infront = if ((_angle) >= 180) then
{
[(_eyes select 0) - _opp,(_eyes select 1) + _adj,(_eyes select 2)]
}
else
{
[(_eyes select 0) + _opp,(_eyes select 1) + _adj,(_eyes select 2)]
};
_obstruction = (lineintersectswith [_eyes,_infront,_unit]) select 0;
_see = if (isnil("_obstruction")) then {true} else {false};
_see

View File

@ -0,0 +1,19 @@
/****************************************************************
File: UPSMON_DeleteWP.sqf
Author: Azroul13
Description:
delete waypoint for group
Parameter(s):
<--- group
Returns:
Nothing
****************************************************************/
private [];
while {(count (waypoints _this)) > 0} do
{
deleteWaypoint ((waypoints _this) select 0);
sleep 0.25;
};

View File

@ -0,0 +1,38 @@
/****************************************************************
File: UPSMON_DocreateWP.sqf
Author: Azroul13
Description:
Create waypoint for group
Parameter(s):
<--- group
<--- position of the waypoint
<--- type of the waypoint
<--- Formation of the waypoint
<--- Behaviour of the waypoint
<--- Combatmode of the waypoint
<--- Radius of the waypoint
Returns:
Nothing
****************************************************************/
private ["_grp","_targetpos","_wptype","_wpformation","_speedmode","_wp1","_radius","_CombatMode"];
_grp = _this select 0;
_targetpos = _this select 1;
_wptype = _this select 2;
_wpformation = _this select 3;
_speedmode = _this select 4;
_Behaviour = _this select 5;
_CombatMode = _this select 6;
_radius = _this select 7;
_wp1 = _grp addWaypoint [_targetPos,count (waypoints _grp)];
_wp1 setWaypointPosition [_targetPos,count (waypoints _grp)];
_wp1 setWaypointType _wptype;
_wp1 setWaypointFormation _wpformation;
_wp1 setWaypointSpeed _speedmode;
_wp1 setwaypointbehaviour _Behaviour;
_wp1 setwaypointCombatMode _CombatMode;
_wp1 setWaypointLoiterRadius _radius;
if (count _this > 8) then {sleep 3; (vehicle (leader _grp)) flyinheight (_this select 8)};

View File

@ -0,0 +1,41 @@
/****************************************************************
File: UPSMON_DocreateWP.sqf
Author: Azroul13
Description:
Create waypoint for group
Parameter(s):
<--- group
<--- position of the waypoint
<--- type of the waypoint
<--- Formation of the waypoint
<--- Behaviour of the waypoint
<--- Combatmode of the waypoint
<--- Radius of the waypoint
Returns:
Nothing
****************************************************************/
private ["_grp","_targetpos","_wptype","_wpformation","_speedmode","_wp1","_radius","_CombatMode"];
_grp = _this select 0;
_targetpos = _this select 1;
_wptype = _this select 2;
_wpformation = _this select 3;
_speedmode = _this select 4;
_Behaviour = _this select 5;
_CombatMode = _this select 6;
_radius = _this select 7;
_grp call UPSMON_DeleteWP;
_wp1 = _grp addWaypoint [_targetPos,0];
_wp1 setWaypointPosition [_targetPos,0];
_wp1 setWaypointType _wptype;
_wp1 setWaypointFormation _wpformation;
_wp1 setWaypointSpeed _speedmode;
_wp1 setwaypointbehaviour _Behaviour;
_wp1 setwaypointCombatMode _CombatMode;
_wp1 setWaypointLoiterRadius _radius;
//if (count _this > 8) then {sleep 3; (vehicle (leader _grp)) flyinheight (_this select 8)};
_grp setCurrentWaypoint [_grp,(_wp1 select 1)];

View File

@ -0,0 +1,38 @@
/****************************************************************
File: UPSMON_GetSIN.sqf
Author: MONSADA
Description:
Función que devuelve el valor negativo o positivo del coseno en base a un angulo
Parameter(s):
Returns:
****************************************************************/
private["_dir","_cos"];
_dir=_this select 0;
if (isnil "_dir") exitWith {};
if (_dir<90) then
{
_cos=1;
}
else
{
if (_dir<180) then
{
_cos=1;
}
else
{
if (_dir<270) then
{
_cos=-1;
}
else
{
_cos=-1;
};
};
};
_cos

View File

@ -0,0 +1,29 @@
/****************************************************************
File: UPSMON_GetOut.sqf
Author: MONSADA
Description:
Function for order a unit to exit if no gunner
Parameter(s):
Returns:
****************************************************************/
private["_vehicle","_npc","_getout" ,"_gunner"];
_npc = _this;
_vehicle = vehicle (_npc);
_gunner = objnull;
_gunner = gunner _vehicle;
sleep 0.05;
if (!alive _npc) exitwith{};
//If no leave the vehicle gunner
if ( isnull _gunner || !alive _gunner || !canmove _gunner || (_gunner != _npc && driver _vehicle != _npc && commander _vehicle != _npc) ) then {
[_npc] allowGetIn false;
_npc spawn UPSMON_doGetOut;
unassignVehicle _npc;
//sleep 0.2;
};

View File

@ -0,0 +1,29 @@
/****************************************************************
File: UPSMON_GetPos2D.sqf
Author: MONSADA
Description:
Función que devuelve una posición en 2D a partir de otra, una dirección y una distancia
Parameter(s):
<--- Position
<--- Direction
<--- Distance
Returns:
Position
****************************************************************/
private ["_pos","_dir","_dist","_cosU","_cosT","_relTX","_sinU","_sinT","_relTY","_newPos","_newPosX","_newPosY" ];
_pos = _this select 0;
_dir = _this select 1;
_dist = _this select 2;
if (isnil "_pos") exitWith {};
_targetX = _pos select 0; _targetY = _pos select 1;
//Calculamos posición
_cosU = [_dir] call UPSMON_GetCOS; _sinU = [_dir] call UPSMON_GetSIN;
_cosT = abs cos(_dir); _sinT = abs sin(_dir);
_relTX = _sinT * _dist * _cosU; _relTY = _cosT * _dist * _sinU;
_newPosX = _targetX + _relTX; _newPosY = _targetY + _relTY;
_newPos = [_newPosX,_newPosY];
_newPos;

View File

@ -0,0 +1,38 @@
/****************************************************************
File: UPSMON_GetSIN.sqf
Author: MONSADA
Description:
Función que devuelve el valor negativo o positivo del seno en base a un angulo
Parameter(s):
Returns:
****************************************************************/
private["_dir","_sin","_cos"];
_dir=_this select 0;
if (isnil "_dir") exitWith {};
if (_dir<90) then
{
_sin=1;
}
else
{
if (_dir<180) then
{
_sin=-1;
}
else
{
if (_dir<270) then
{
_sin=-1;
}
else
{
_sin=1;
};
};
};
_sin

View File

@ -0,0 +1,34 @@
/****************************************************************
File: UPSMON_Getnearestplayer.sqf
Author: Azroul13
Description:
Get the nearest player near the position.
Parameter(s):
<--- Position
<--- Distance
Returns:
Nearest unit or ObjNull
****************************************************************/
private ["_position","_nearestdist","_height","_nearest","_haslos"];
_position = _this select 0;
_nearestdist = _this select 1;
_nearest = objNull;
{
if (isPlayer _x) then
{
If ((getposATL _x) select 2 <= 100) then
{
If ((getposATL _x vectorDistance [_position select 0,_position select 1,0]) <= _nearestdist) exitwith
{
_nearest=_x;
};
};
};
} forEach playableUnits;
//playableUnits;
_nearest

View File

@ -0,0 +1,30 @@
/****************************************************************
File: UPSMON_Getunitsincargo.sqf
Author: Azroul13
Description:
Function for order a unit to exit if no gunner
Parameter(s):
Returns:
****************************************************************/
private["_vehicle","_unitsincargo","_crew"];
_vehicle = _this select 0;
_unitsincargo = [];
_crew = crew _vehicle;
{
If (alive _x) then
{
If () then
{
_unitsincargo pushback _x;
};
};
} foreach _crew;
_unitsincargo

View File

@ -0,0 +1,49 @@
/****************************************************************
File: UPSMON_Haslos.sqf
Author: Azroul13
Description:
Parameter(s):
<--- unit
<--- Target
<--- Max distance the unit can see the target
<--- Field of view of the unit
Returns:
Boolean
****************************************************************/
private ["_unit", "_target", "_range", "_fov","_eyeVector","_eyeDirection","_eyePosition","_targetPosition", "_inRange", "_result"];
_unit = [_this,0] call BIS_fnc_param;
_target = [_this,1] call BIS_fnc_param;
_range = [_this,2,100,[0]] call BIS_fnc_param;
_fov = [_this,3,130,[0]] call BIS_fnc_param;
_result = false;
_inRange = ((getposATL _unit) vectordistance (getposATL _target)) < _range;
_eyeVector = eyeDirection _unit;
_eyeDirection = ((_eyeVector select 0) atan2 (_eyeVector select 1));
_eyePosition = eyePos _unit;
_targetPosition = eyePos _target;
If (!(_target iskindof "CAManBase")) then
{
_targetPosition = aimpos _target;
};
if (_inRange) then
{
if ([_eyePosition, _eyeDirection, _fov, _targetPosition] call BIS_fnc_inAngleSector) then
{
if (!lineIntersects[_eyePosition, _targetPosition, vehicle _unit, vehicle _target]) then
{
if (!terrainIntersectASL[_eyePosition, _targetPosition]) then
{
_result = true;
};
};
};
};
_result;

View File

@ -0,0 +1,32 @@
/****************************************************************
File: UPSMON_LOS.sqf
Author: Azroul13
Description:
Parameter(s):
<--- position to check
<--- Target position
Returns:
Boolean
****************************************************************/
private ["_poso","_posd","_los_ok"];
_poso = _this select 0;
_posd = _this select 1;
_poso = [_poso select 0, _poso select 1, (getTerrainHeightASL [_poso select 0, _poso select 1]) +1];
_posd = [_posd select 0, _posd select 1, (getTerrainHeightASL [_posd select 0, _posd select 1]) +1];
_los_ok = false;
If (!terrainIntersectASL [_poso,_posd]) then
{
//lineIntersects [_poso, _posd]
If (count (lineintersectsobjs [_poso,_posd,objnull,objnull,false]) == 0) then
{
_los_ok = true;
};
};
_los_ok;

View File

@ -0,0 +1,24 @@
/****************************************************************
File: UPSMON_timeloop.sqf
Author: CarlGustav
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_lat","_day","_hour","_sunangle","_Night"];
_Night = false;
_lat = -1 * getNumber(configFile >> "CfgWorlds" >> worldName >> "latitude");
_day = 360 * (dateToNumber date);
_hour = (daytime / 24) * 360;
_sunangle = ((12 * cos(_day) - 78) * cos(_lat) * cos(_hour)) - (24 * sin(_lat) * cos(_day));
If (_sunangle < 0) then {_Night = true;};
If (_sunangle > 0) then {_Night = False;};
_Night;

View File

@ -0,0 +1,62 @@
/****************************************************************
File: UPSMON_Nowp.sqf
Author: Azroul13
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_grp","_target","_supstatus","_nowp"];
_grp = _this select 0;
_target = _this select 1;
_supstatus = _this select 2;
_nowp = true;
If (_grp getvariable ["UPSMON_NOWP",0] == 0) then
{
If (_grp getvariable ["UPSMON_Grpmission",""] != "AMBUSH") then
{
If (_grp getvariable ["UPSMON_Grpmission",""] != "FORTIFY") then
{
If (_grp getvariable ["UPSMON_Grpmission",""] != "RETREAT") then
{
If (_grp getvariable ["UPSMON_Grpmission",""] != "SURRENDER") then
{
_nowp = false;
};
}
};
};
}
else
{
switch (_grp getvariable ["UPSMON_NOWP",0]) do
{
case 1:
{
If (!IsNull _target) then
{
_nowp = false;
};
};
case 2:
{
If (_supstatus == "INCAPACITED") then
{
_nowp = false;
};
};
case 3:
{
//Always Nowp = true
};
};
};
_nowp

View File

@ -0,0 +1,37 @@
/****************************************************************
File: UPSMON_Replace.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_str","_old","_new","_out","_tmp","_jm","_la","_lo","_ln","_i"];
_str=_this select 0;
_arr=toArray(_str);
_la=count _arr;
_old=_this select 1;
_new=_this select 2;
_na=[_new] call UPSMON_StrToArray;
_lo=[_old] call UPSMON_StrLen;
_ln=[_new] call UPSMON_StrLen;
_out="";
for "_i" from 0 to (count _arr)-1 do {
_tmp="";
if (_i <= _la-_lo) then {
for "_j" from _i to (_i+_lo-1) do {
_tmp=_tmp + toString([_arr select _j]);
};
};
if (_tmp==_old) then {
_out=_out+_new;
_i=_i+_lo-1;
} else {
_out=_out+toString([_arr select _i]);
};
};
_out

View File

@ -0,0 +1,24 @@
/****************************************************************
File: UPSMON_SN_EHFIREDNEAR.sqf
Author: Rafalsky
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_unit","_shooter","_dist"];
_unit = _this select 0;
_shooter = _this select 1;
_dist = _this select 2;
If (alive _unit) then
{
If (!(_unit getvariable ["UPSMON_Civfleeing",false])) then
{
["FLEE",_unit,_shooter,_dist] spawn UPSMON_Civaction;
};
};

View File

@ -0,0 +1,24 @@
/****************************************************************
File: UPSMON_SN_EHHIT.sqf
Author: Rafalsky
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_unit","_shooter","_grpId"];
_unit = _this select 0;
_shooter = _this select 1;
_grp = group _unit;
if (!(_unit in UPSMON_GOTHIT_ARRAY)) then
{
if (side _unit != side _shooter) then
{
UPSMON_GOTHIT_ARRAY pushback _unit;
if (UPSMON_Debug > 0) then {player globalchat format["UNIT: %1, SHOOTER :%2 %3",_unit,_shooter,side _shooter]};
};
};

View File

@ -0,0 +1,40 @@
/****************************************************************
File: UPSMON_SN_EHHIT.sqf
Author: Rafalsky
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_unit","_shooter","_grpId"];
_unit = _this select 0;
_shooter = _this select 1;
_grp = group _unit;
if (!(_unit in UPSMON_GOTKILL_ARRAY)) then
{
if (side _unit != side _shooter) then
{
_alliednear = false;
{
if (alive _x) then
{
if (getposATL _unit vectordistance getposATL _x <= 30) exitwith
{
_alliednear = true;
};
};
} foreach units _grp;
If (_alliednear) then
{
UPSMON_GOTKILL_ARRAY pushback _unit;
//if (UPSMON_Debug > 0) then {player globalchat format["UNIT: %1, SHOOTER :%2 %3",_unit,_shooter,side _shooter]};
};
};
};

View File

@ -0,0 +1,51 @@
/****************************************************************
File: R_SN_EHKILLEDCIV.sqf
Author: Rafalsky
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_killer","_side"];
_killer = _this select 1;
//only if player killed a civilian
if (isPlayer _killer) then
{
KILLED_CIV_COUNTER set [0,(KILLED_CIV_COUNTER select 0) + 1];
// if (UPSMON_Debug > 0) then {player globalchat format["KILLER: %1, %2", side _killer,KILLED_CIV_COUNTER ]};
switch (side _killer) do
{
case west:
{
KILLED_CIV_COUNTER set [1,(KILLED_CIV_COUNTER select 1) + 1];
UPSMON_WEST_HM = UPSMON_WEST_HM - UPSMON_Ammountofhostility;
};
case east:
{
KILLED_CIV_COUNTER set [2,(KILLED_CIV_COUNTER select 2) + 1];
UPSMON_EAST_HM = UPSMON_EAST_HM - UPSMON_Ammountofhostility;
};
case resistance:
{
KILLED_CIV_COUNTER set [3,(KILLED_CIV_COUNTER select 3) + 1];
UPSMON_GUER_HM = UPSMON_GUER_HM - UPSMON_Ammountofhostility;
};
};
KILLED_CIV_COUNTER set [4,_killer];
//if (UPSMON_Debug > 0) then {player globalchat format["KILLER: %1", side _killer ]};
if (UPSMON_Debug > 0) then {player globalchat format["KILLED_CIV_COUNTER: %1",KILLED_CIV_COUNTER]};
if (R_WHO_IS_CIV_KILLER_INFO > 0) then
{
call compile format ["[{UPSMON_Logic_civkill globalChat ""A CIVILIAN WAS KILLED BY %1"";},""BIS_fnc_spawn""] call BIS_fnc_MP;",name _killer];
};
};

View File

@ -0,0 +1,16 @@
/****************************************************************
File: UPSMON_StrInStr.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_out"];
_in=_this select 0;
_out=if (([_this select 0,_this select 1] call UPSMON_StrIndex)==-1) then {false} else {true};
_out

View File

@ -0,0 +1,31 @@
/****************************************************************
File: UPSMON_StrIndex.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_hay","_ndl","_lh","_ln","_arr","_tmp","_i","_j","_out"];
_hay=_this select 0;
_ndl=_this select 1;
_out=-1;
_i=0;
if (_hay == _ndl) exitWith {0};
_lh=[_hay] call UPSMON_StrLen;
_ln=[_ndl] call UPSMON_StrLen;
if (_lh < _ln) exitWith {-1};
_arr=[_hay] call UPSMON_StrToArray;
for "_i" from 0 to (_lh-_ln) do
{
_tmp="";
for "_j" from _i to (_i+_ln-1) do {
_tmp=_tmp + (_arr select _j);
};
if (_tmp==_ndl) exitWith {_out=_i};
};
_out

View File

@ -0,0 +1,17 @@
/****************************************************************
File: UPSMON_StrLen.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_in","_arr","_len"];
_in=_this select 0;
_arr=[_in] call UPSMON_StrToArray;
_len=count (_arr);
_len

View File

@ -0,0 +1,20 @@
/****************************************************************
File: UPSMON_StrToArray.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_in","_i","_arr","_out"];
_in=_this select 0;
_arr = toArray(_in);
_out=[];
for "_i" from 0 to (count _arr)-1 do {
_out=_out+[toString([_arr select _i])];
};
_out

View File

@ -0,0 +1,107 @@
/****************************************************************
File: UPSMON_TRACK.sqf
Author: Azroul13
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_grpid","_leader","_pos","_rankshort","_lastname","_wppos","_markercolor","_grptype","_drawicon","_text","_trackername","_destname"];
While {true} do
{
{
If (!IsNull _x) then
{
If (alive (leader _x)) then
{
_grpid = _x getvariable ["UPSMON_grpid",0];
_leader = leader _x;
_pos = getposATL _leader;
_rankshort = [rank _leader,"displayNameShort"] call BIS_fnc_rankparams;
_lastname = name _leader;
_units = (units _x) - [_leader];
_wppos = waypointPosition [_x,count(waypoints _x)-1];
_markercolor = switch (side _leader) do {
case west: {"ColorBlue"};
case east: {"ColorRed"};
case resistance: {"ColorGreen"};
default {"ColorBlack"};
};
_grptype = [_leader] call UPSMON_grptype;
_drawicon = "b_inf";
If (_grptype == "Iscar") then {_drawicon = "b_motor_inf"};
If (_grptype == "IsAir") then {_drawicon = "b_plane";};
If (_grptype == "Isboat") then {_drawicon = "b_naval";};
_text = format ["%1. %2 - Grpcount: %3 - Mission: %4 Status: %5 - Target: %6",_rankshort, _lastname,count units _x,_x getvariable ["UPSMON_Grpmission","PATROL"],_x getvariable ["UPSMON_Grpstatus","GREEN"],_x getvariable ["UPSMON_GrpTarget",ObjNull]];
_trackername = format["trk_%1",_grpid];
if (getMarkerColor _trackername == "") then
{
_markerlead = createMarker [_trackername,[0,0]];
};
_trackername setMarkerShape "ICON";
_trackername setMarkerType _drawicon;
_trackername setmarkerpos _pos;
_trackername setmarkercolor _markercolor;
_trackername setMarkerText _text;
If (count(waypoints _x) != 0) then
{
_destname = format["dest_%1",_grpid];
_wptext = format ["%1. %2",_rankshort, _lastname];
if (getMarkerColor _destname == "") then
{
_markerobj = createMarker[_destname,[0,0]];
};
_destname setMarkerShape "ICON";
_destname setMarkerType "mil_objective";
_destname setmarkerpos _wppos;
_destname setmarkercolor _markercolor;
_destname setMarkerText _wptext;
};
If (count _units > 0) then
{
_i = 0;
{
_i = _i + 1;
_trackerunit = format["trk_%1_%2",_grpid,_i];
_unit = _x;
If (alive _unit) then
{
_pos2 = getposATL _unit;
if (getMarkerColor _trackerunit == "") then
{
_markerunit = createMarker [_trackerunit,[0,0]];
};
_trackerunit setMarkerShape "ICON";
_trackerunit setMarkerType "mil_triangle";
_trackerunit setmarkerpos _pos2;
_trackerunit setmarkercolor _markercolor;
_trackerunit setmarkerdir (getdir _unit);
}
else
{
if (getMarkerColor _trackerunit == "") then
{
Deletemarker _trackerunit;
};
};
} foreach _units;
};
};
};
} foreach UPSMON_Trackednpcs;
sleep 0.5;
};

View File

@ -0,0 +1,132 @@
/****************************************************************
File: UPSMON_TRACK.sqf
Author: Azroul13
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_grp"];
_grp = _this select 0;
If !(_grp in UPSMON_Trackednpcs) then {UPSMON_Trackednpcs set [count UPSMON_Trackednpcs,_grp];};
_eh = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler
["Draw",
'
{
If (!IsNull _x) then
{
if (count units _x > 0) then
{
_leader = leader _x;
_rankshort = [rank _leader,"displayNameShort"] call BIS_fnc_rankparams;
_lastname = name _leader;
_scale = (sizeof typeof _leader) / 30;
_units = (units _x) - [_leader];
_colorblufor = [(profilenamespace getvariable ["Map_BLUFOR_R",0]),(profilenamespace getvariable ["Map_BLUFOR_G",1]),(profilenamespace getvariable ["Map_BLUFOR_B",1]),(profilenamespace getvariable ["Map_BLUFOR_A",0.8])];
_coloropfor = [(profilenamespace getvariable ["Map_OPFOR_R",0]),(profilenamespace getvariable ["Map_OPFOR_G",1]),(profilenamespace getvariable ["Map_OPFOR_B",1]),(profilenamespace getvariable ["Map_OPFOR_A",0.8])];
_colorindfor = [(profilenamespace getvariable ["Map_Independent_R",0]),(profilenamespace getvariable ["Map_Independent_G",1]),(profilenamespace getvariable ["Map_Independent_B",1]),(profilenamespace getvariable ["Map_Independent_A",0.8])];
_colorciv = [(profilenamespace getvariable ["Map_Civilian_R",0]),(profilenamespace getvariable ["Map_Civilian_G",1]),(profilenamespace getvariable ["Map_Civilian_B",1]),(profilenamespace getvariable ["Map_Civilian_A",0.8])];
_color = [];
if (side _leader == west) then {_color = _colorblufor;};
if (side _leader == east) then {_color = _coloropfor;};
if (side _leader == resistance) then {_color = _colorindfor;};
if (side _leader == civilian) then {_color = _colorciv;};
_align = "right";
_fontsize = 0.04;
_grptype = [_leader] call UPSMON_grptype;
_drawicon = configfile >> "CfgMarkers" >> "b_inf" >> "icon";
_drawwpicon = configfile >> "CfgMarkers" >> "mil_objective" >> "icon";
If (_grptype == "Iscar") then {_drawicon = configfile >> "CfgMarkers" >> "b_motor_inf" >> "icon";};
If (_grptype == "IsAir") then {_drawicon = configfile >> "CfgMarkers" >> "b_plane" >> "icon";};
If (_grptype == "Isboat") then {_drawicon = configfile >> "CfgMarkers" >> "b_naval" >> "icon";};
_align = "left";
_textwp = "";
_text = format ["%1. %2 - Grpcount: %3 - Mission: %4 Status: %5 - Target: %6",_rankshort, _lastname,count units _x,_x getvariable ["UPSMON_Grpmission","PATROL"],_x getvariable ["UPSMON_Grpstatus","GREEN"],_x getvariable ["UPSMON_GrpTarget",ObjNull]];
(_this select 0) drawIcon [
getText _drawicon,
_color,
visiblePosition _leader,
0.5/ctrlMapScale (_this select 0),
0.5/ctrlMapScale (_this select 0),
direction _leader,
--,
1,
_fontsize,
"TahomaB",
_align
];
If (count(waypoints _x) != 0) then
{
_wppos = waypointPosition [_x,count(waypoints _x)-1];
(_this select 0) drawIcon [getText (_drawwpicon), _color,_wppos, 0.5/ctrlMapScale (_this select 0), 0.5/ctrlMapScale (_this select 0), direction _leader, _textwp, 1, _fontsize, "TahomaB", _align];
};
_behcolor = [1,1,1,1];
if (behaviour _leader == "SAFE") then {_behcolor = [0,0.8,0,1]};
if (behaviour _leader == "AWARE") then {_behcolor = [0.85,0.85,0,1]};
if (behaviour _leader == "COMBAT") then {_behcolor = [0.9,0,0,1]};
if (behaviour _leader == "STEALTH") then {_behcolor = [0,0,1,1]};
if !(((expectedDestination _leader) select 0) select 0 < 1 AND ((expectedDestination _leader) select 0) select 1 < 1) then
{
(_this select 0) drawArrow [
visiblePosition _leader,
((expectedDestination _leader) select 0),
_behcolor
];
};
};
};
} foreach UPSMON_Trackednpcs
'
];
/****************************************************************
_eh = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler
[
"Draw"
,'
_leader = leader _grp;
_rankshort = [rank _leader,"displayNameShort"] call BIS_fnc_rankparams;
_lastname = name _leader;
_scale = (sizeof typeof _leader) / 30;
_colorblufor = [(profilenamespace getvariable ["Map_BLUFOR_R",0]),(profilenamespace getvariable ["Map_BLUFOR_G",1]),(profilenamespace getvariable ["Map_BLUFOR_B",1]),(profilenamespace getvariable ["Map_BLUFOR_A",0.8])];
_coloropfor = [(profilenamespace getvariable ["Map_OPFOR_R",0]),(profilenamespace getvariable ["Map_OPFOR_G",1]),(profilenamespace getvariable ["Map_OPFOR_B",1]),(profilenamespace getvariable ["Map_OPFOR_A",0.8])];
_colorindfor = [(profilenamespace getvariable ["Map_Independent_R",0]),(profilenamespace getvariable ["Map_Independent_G",1]),(profilenamespace getvariable ["Map_Independent_B",1]),(profilenamespace getvariable ["Map_Independent_A",0.8])];
_colorciv = [(profilenamespace getvariable ["Map_Civilian_R",0]),(profilenamespace getvariable ["Map_Civilian_G",1]),(profilenamespace getvariable ["Map_Civilian_B",1]),(profilenamespace getvariable ["Map_Civilian_A",0.8])];
_color = [];
if (side _leader == west) then {_color = _colorblufor;};
if (side _leader == east) then {_color = _coloropfor;};
if (side _leader == resistance) then {_color = _colorindfor;};
if (side _leader == civilian) then {_color = _colorciv;};
_align = "right";
_fontsize = 0.04;
_grptype = [_leader] call UPSMON_grptype;
_drawicon = configfile >> "CfgMarkers" >> "b_inf" >> "icon";
If (_grptype == "Iscar") then {_drawicon = configfile >> "CfgMarkers" >> "b_motor_inf" >> "icon";};
If (_grptype == "IsAir") then {_drawicon = configfile >> "CfgMarkers" >> "b_plane" >> "icon";};
If (_grptype == "Isboat") then {_drawicon = configfile >> "CfgMarkers" >> "b_naval" >> "icon";};
_align = "left";
_unitshit = [];
{if (damage _x >= 0.65) then {_unitshit set [count _unitshit,_x];}}foreach units _leader;
_text = format ["%1. %2 - Grpcount: %3 - Wounding units: %4",_rankshort, _lastname,count units group _leader,count _unitshit];
(_this select 0) drawIcon [getText (_drawicon), _color, visiblePosition _leader, 0.5/ctrlMapScale (_this select 0), 0.5/ctrlMapScale (_this select 0), direction _leader, _text, 1, _fontsize, "TahomaB", _align];
_behcolor = [1,1,1,1];
if (behaviour _leader == "SAFE") then {_behcolor = [0.85,0.85,0,1]};
if (behaviour _leader == "AWARE") then {_behcolor = [0,0.8,0,1]};
if (behaviour _leader == "COMBAT") then {_behcolor = [0.9,0,0,1]};
if (behaviour _leader == "STEALTH") then {_behcolor = [0,0,1,1]};
if !(((expectedDestination _leader) select 0) select 0 < 1 AND ((expectedDestination _leader) select 0) select 1 < 1) then { (_this select 0) drawArrow [visiblePosition _leader, ((expectedDestination _leader) select 0), _behcolor];};'
];
****************************************************************/

View File

@ -0,0 +1,26 @@
/****************************************************************
File: UPSMON_arrayShufflePlus.sqf
Author: KillZoneKid
Description:
Parameter(s):
<--- Array
Returns:
Array
****************************************************************/
private ["_cnt","_el1","_rnd","_indx","_el2"];
_cnt = count _this - 1;
_el1 = _this select _cnt;
_this resize _cnt;
_rnd = random diag_tickTime * _cnt;
for "_i" from 0 to _cnt do {
_indx = floor random _rnd % _cnt;
_el2 = _this select _indx;
_this set [_indx, _el1];
_el1 = _el2;
};
_this set [_cnt, _el1];
_this

View File

@ -0,0 +1,30 @@
/****************************************************************
File: UPSMON_checkbackpack.sqf
Author: Azroul13
Description:
Parameter(s):
<--- bagpack
Returns:
---> Gun type classname
---> tripod type classname
****************************************************************/
private ["_bagpack","_cfg","_parents","_result","_gun","_tripod","_gun"];
_bagpack = _this select 0;
_cfg = (configFile >> "cfgVehicles" >> _bagpack);
_parents = [_cfg,true] call BIS_fnc_returnParents;
_result = [];
_gun = "";
_tripod = [];
if ("Weapon_Bag_Base" in _parents) then
{
_gun = gettext (configFile >> "cfgVehicles" >> _bagpack >> "assembleInfo" >> "assembleTo");
_tripod = getarray (configFile >> "cfgVehicles" >> _bagpack >> "assembleInfo" >> "base");
_result = [_gun,_tripod];
};
_result

View File

@ -0,0 +1,33 @@
/****************************************************************
File: UPSMON_createmarker.sqf
Author: Azroul13
Description:
Parameter(s):
Returns:
****************************************************************/
private["_pos","_m","_shape","_type","_color","_size"];
_pos = _this select 0;
_shape = _this select 1;
_type = _this select 2;
_color = _this select 3;
_size = 1;
If (count _this > 4) then {_size = _this select 4;};
_m = createMarker [format["mPos%1%2",(floor(_pos select 0)),(floor(_pos select 1))],_pos];
_m setmarkerColor _color;
_m setMarkerShape _shape;
If (_shape != "ICON") then
{
_m setMarkerSize _size;
_m setMarkerBrush _type
}
else
{
_m setMarkerType _type;
If (count _this > 4) then {_m setMarkerText (_this select 4);};
};

View File

@ -0,0 +1,18 @@
/****************************************************************
File: UPSMON_createmarker.sqf
Author: Azroul13
Description:
Parameter(s):
Returns:
****************************************************************/
private["_pos","_sign","_type"];
_pos = _this select 0;
_type = _this select 1;
_sign = _type createvehicle [0,0,0];
_sign setpos _pos;

View File

@ -0,0 +1,18 @@
/****************************************************************
File: UPSMON_deleteDead.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_u","_s"];
_u=_this select 0;
_s= _this select 1;
_u removeAllEventHandlers "killed";
sleep _s;
deletevehicle _u

View File

@ -0,0 +1,12 @@
/****************************************************************
File: UPSMON_distancePosSqr.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
round(((((_this select 0) select 0)-((_this select 1) select 0))^2 + (((_this select 0) select 1)-((_this select 1) select 1))^2)^0.5)

View File

@ -0,0 +1,21 @@
/****************************************************************
File: UPSMON_getArg.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_cmd","_arg","_list","_a","_v"];
_cmd=_this select 0;
_arg=_this select 1;
_list=_this select 2;
_a=-1;
{_a=_a+1; _v=format["%1",_list select _a];
if (_v==_cmd) then {_arg=(_list select _a+1)}} foreach _list;
_arg

View File

@ -0,0 +1,23 @@
/****************************************************************
File: UPSMON_randomPos.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_a","_b","_from","_to","_return"];
_from = _this select 0;
_to = _this select 1;
_return = 0;
_a = ((_to select 0) - (_from select 0));
_b = ((_to select 1) - (_from select 1));
if (_a != 0 || _b != 0) then {_return = _a atan2 _b};
if ( _return < 0 ) then { _return = _return + 360 };
_return

View File

@ -0,0 +1,52 @@
/****************************************************************
File: UPSMON_getminesclass.sqf
Author: Azroul13
Description:
Parameter(s):
Nothing
Returns:
Array of mines types
****************************************************************/
private ["_minesclassname","_minetype1","_minetype2","_cfgvehicles","_cfgvehicle","_inherit","_vehicle"];
_minesclassname = [];
_minetype1 = [];
_minetype2 = [];
_minetype3 = [];
_APMines = [];
_ATMines = [];
_underwatermines = [];
{
_mineTriggerType = tolower gettext (_x >> "mineTriggerType");
if (_mineTriggerType in ["radius","wire"]) then
{
_mineMagnetic = getnumber (_x >> "mineMagnetic");
_array = if (_mineMagnetic > 0) then {_ATMines} else {_APMines};
_underwatermine=[tolower configname _x,"underwater"] call UPSMON_StrInStr;
if (_underwatermine) then {_array=_underwatermines;};
_array set [count _array,tolower configname _x];
};
} foreach ((configfile >> "CfgMineTriggers") call bis_fnc_returnchildren);
{
_cfgvehicle = _x;
_inherit = inheritsFrom _cfgvehicle;
If ((configName _inherit) == "MineBase") then
{
_vehicle = configName _cfgvehicle;
_ammo = tolower gettext (_cfgvehicle >> "ammo");
_trigger = tolower gettext (configfile >> "cfgAmmo" >> _ammo >> "mineTrigger");
if (_trigger in _ATMines) then {_minetype1 set [count _minetype1,_vehicle];};
if (_trigger in _APMines) then {_minetype2 set [count _minetype2,_vehicle];};
if (_trigger in _underwatermines) then {_minetype3 set [count _minetype3,_vehicle];};
};
} foreach ((configfile >> "CfgVehicles") call bis_fnc_returnchildren);
_minesclassname = [_minetype1,_minetype2,_minetype3];
_minesclassname

View File

@ -0,0 +1,71 @@
/*
File: fn_findOverwatch.sqf
Author: Dean "Rocket" Hall
Description:
Function which selects a position that provides overwatch
onto another position.
Parameter(s):
_this select 0: the target position (position)
_this select 1: maximum distance from target in meters (optional)
_this select 2: minimum distance from target in meters (optional)
_this select 3: minimum height in relation to target in meters (optional)
_this select 4: position to start looking from, if different from target pos (optional)
*/
private ["_unit","_dir","_targetPos","_distance","_pool","_i","_flankAngle","_scan","_points","_targetPosTemp","_terrainscan","_los_ok","_final"];
_unit = _this select 0;
_dir = _this select 1;
_targetPos = getposATL _unit;
_pool = [];
_i = 0;
_scan = true;
while {_scan} do
{
_i = _i + 1;
_targetPosTemp = [_targetPos,[0,50],[_dir +70,_dir +220],0,[0,100],5] call UPSMON_pos;
If (!surfaceIsWater _targetPosTemp) then
{
_points = 0;
_targetPosTemp = [_targetPosTemp select 0,_targetPosTemp select 1,0];
If (_unit != vehicle _unit) then
{
If (isOnRoad _targetPosTemp) then
{
_points = _points +20;
};
_value = [_targetPosTemp,1,1] call UPSMON_TerraCognita;
_meadow = _value select 3;
_terr = _meadow * 100;
_elev = getTerrainHeightASL [_targetPosTemp select 0,_targetPosTemp select 1];
_points = _points + _terr + _elev;
}
else
{
_value = [_targetPosTemp,1,1] call UPSMON_TerraCognita;
_urban = _value select 0;
_forest = _value select 1;
_terr = (_urban + _forest) * 100;
_elev = getTerrainHeightASL [_targetPosTemp select 0,_targetPosTemp select 1];
_points = _points +_terr + _elev;
};
_los_ok = [_targetPos,_targetPosTemp] call UPSMON_LOS;
If (_los_ok) then {_points = _points + 200;};
_targetpostemp pushback _points;
_pool pushback _targetPosTemp;
};
If (count _pool > 10 || _i > 50) then {_scan = false};
};
_pool = [_pool, [], {_x select 3}, "DESCEND"] call BIS_fnc_sortBy;
If (count _pool > 0) then {_targetpos = [(_pool select 0) select 0,(_pool select 0) select 1,0];};
_targetPos;

View File

@ -0,0 +1,25 @@
/****************************************************************
File: UPSMON_randomPos.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_cx","_cy","_rx","_ry","_cd","_sd","_ad","_tx","_ty","_xout","_yout"];
_cx=_this select 0;
_cy=_this select 1;
_rx=_this select 2;
_ry=_this select 3;
_cd=_this select 4;
_sd=_this select 5;
_ad=_this select 6;
_tx=random (_rx*2)-_rx;
_ty=random (_ry*2)-_ry;
_xout=if (_ad!=0) then {_cx+ (_cd*_tx - _sd*_ty)} else {_cx+_tx};
_yout=if (_ad!=0) then {_cy+ (_sd*_tx + _cd*_ty)} else {_cy+_ty};
[_xout,_yout]

View File

@ -0,0 +1,31 @@
/****************************************************************
File: UPSMON_rotpoint.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_cp","_a","_tx","_ty","_cd","_sd","_cx","_cy","_xout","_yout"];
_cp=_this select 0;
_cx=_cp select 0;
_cy=_cp select 1;
_a=_this select 1;
_cd=cos(_a*-1);
_sd=sin(_a*-1);
_tx=_this select 2;
_ty=_this select 3;
_xout=if (_a!=0) then
{
_cx+ (_cd*_tx - _sd*_ty)
} else
{
_cx+_tx
};
_yout=if (_a!=0) then {_cy+ (_sd*_tx + _cd*_ty)} else {_cy+_ty};
[_xout,_yout,0]

View File

@ -0,0 +1,27 @@
/****************************************************************
File: UPSMON_setArg.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_cmd","_arg","_list","_a","_v"];
_cmd=_this select 0;
_arg=_this select 1;
_list=_this select 2;
_a=-1;
{
_a=_a+1;
_v= format ["%1", _list select _a];
if (_v==_cmd) then
{
_a=_a+1;
_list set [_a,_arg];
};
} foreach _list;
_list

View File

@ -0,0 +1,65 @@
/****************************************************************
File: UPSMON_spawnmines.sqf
Author: Azroul13
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_minesnbr","_minetype1","_minetype2","_positiontoambush","_minetype","_mineposition","_max","_min","_ang","_dir","_orgX","_orgY","_posX","_posY","_mineposition","_Mine"];
_minesnbr = _this select 0;
_minetype1 = _this select 1;
_minetype2 = _this select 2;
_positiontoambush = _this select 3;
_diramb = _this select 4;
_side = _this select 5;
for [{_i=0}, {_i < _minesnbr}, {_i=_i+1}] do
{
_minetype= _minetype1;
_mineposition = _positiontoambush;
If (_i > 0) then
{
_minetype = _minetype2;
// Many thanks Shuko ...
_max = 0; _min = 0;
if (floor (random 4) < 2) then
{
_min = _diramb + 270;
_max = _diramb + 335;
}
else
{
_min = _diramb + 25;
_max = _diramb + 90;
};
_ang = _max - _min;
// Min bigger than max, can happen with directions around north
if (_ang < 0) then { _ang = _ang + 360 };
if (_ang > 360) then { _ang = _ang - 360 };
_dir = (_min + random _ang);
_orgX = _positiontoambush select 0;
_orgY = _positiontoambush select 1;
_posX = _orgX + (((random 10) + (random 30 +5)) * sin _dir);
_posY = _orgY + (((random 10) + (random 30 +5)) * cos _dir);
_mineposition = [_posX,_posY,0];
};
_Mine=createMine [_minetype,_mineposition, [], 0];
_side revealMine _Mine;
if (UPSMON_Debug>0) then
{
[_mineposition,"Sign_Arrow_Large_GREEN_F"] spawn UPSMON_createsign;
[_mineposition,"Icon","Minefield","Colorred"] spawn UPSMON_createmarker
};
sleep 0.01;
};

View File

@ -0,0 +1,25 @@
/****************************************************************
File: UPSMON_stayInside.sqf
Author: KRONZKY
Description:
Parameter(s):
Returns:
****************************************************************/
private["_np","_nx","_ny","_cp","_cx","_cy","_rx","_ry","_d","_tp","_tx","_ty","_fx","_fy"];
_np=_this select 0; _nx=_np select 0; _ny=_np select 1;
_cp=_this select 1; _cx=_cp select 0; _cy=_cp select 1;
_rx=_this select 2; _ry=_this select 3; _d=_this select 4;
_tp = [_cp,_d,(_nx-_cx),(_ny-_cy)] call UPSMON_rotpoint;
_tx = _tp select 0; _fx=_tx;
_ty = _tp select 1; _fy=_ty;
if (_tx<(_cx-_rx)) then {_fx=_cx-_rx};
if (_tx>(_cx+_rx)) then {_fx=_cx+_rx};
if (_ty<(_cy-_ry)) then {_fy=_cy-_ry};
if (_ty>(_cy+_ry)) then {_fy=_cy+_ry};
if ((_fx!=_tx) || (_fy!=_ty)) then {_np = [_cp,_d*-1,(_fx-_cx),(_fy-_cy)] call UPSMON_rotpoint};
_np;

View File

@ -0,0 +1,43 @@
UPSMON_Getnearestplayer = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_Getnearestplayer.sqf";
UPSMON_Nighttime = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_Nighttime.sqf";
UPSMON_arrayShufflePlus = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_arrayShufflePlus.sqf";
UPSMON_getArg = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_getArg.sqf";
UPSMON_setArg = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_setArg.sqf";
UPSMON_distancePosSqr = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_distancePosSqr.sqf";
UPSMON_GetPos2D = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_GetPos2D.sqf";
UPSMON_GetCOS = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_GetCOS.sqf";
UPSMON_GetSIN = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_GetSIN.sqf";
UPSMON_Replace = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_Replace.sqf";
UPSMON_rotpoint = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_rotpoint.sqf";
UPSMON_StrIndex = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_StrIndex.sqf";
UPSMON_StrInStr = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_StrInStr.sqf";
UPSMON_StrLen = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_StrLen.sqf";
UPSMON_StrToArray = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_StrToArray.sqf";
UPSMON_CanSee = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_CanSee.sqf";
UPSMON_LOS = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_LOS.sqf";
UPSMON_Haslos = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_Haslos.sqf";
UPSMON_overwatch = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_overwatch.sqf";
UPSMON_DeleteWP = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_DeleteWP.sqf";
UPSMON_DocreateWP = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_DocreateWP.sqf";
UPSMON_DoaddWP = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_DoaddWP.sqf";
UPSMON_createmarker = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_createmarker.sqf";
UPSMON_createsign = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_createsign.sqf";
UPSMON_TRACK = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_TRACK.sqf";
UPSMON_checkbackpack = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_checkbackpack.sqf";
UPSMON_getminesclass = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_getminesclass.sqf";
UPSMON_spawnmines = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_spawnmines.sqf";
UPSMON_SN_EHHIT = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_SN_EHHIT.sqf";
UPSMON_SN_EHKILLED = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_SN_EHKILLED.sqf";
UPSMON_SN_EHFIREDNEAR = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_SN_EHFIREDNEAR.sqf";
UPSMON_deleteDead = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_deleteDead.sqf";
UPSMON_Nowp = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_Nowp.sqf";
UPSMON_AddtoArray = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Core\fnc\UPSMON_AddtoArray.sqf";

View File

@ -0,0 +1,45 @@
/****************************************************************
File: UPSMON_fnc_filter.sqf
Author: Robalo
Description:
Filter cover objects
Parameter(s):
<--- Object
Returns:
boolean
****************************************************************/
private ["_type","_z","_bbox","_dz","_dy"];
if (_this isKindOf "Man") exitWith {false};
if (_this isKindOf "STATICWEAPON") exitWith {false};
if (_this isKindOf "Bird") exitWith {false};
if (_this isKindOf "BulletCore") exitWith {false};
if (_this isKindOf "Grenade") exitWith {false};
if (_this isKindOf "WeaponHolder") exitWith {false};
if (_this isKindOf "WeaponHolderSimulated") exitWith {false};
if (_this isKindOf "Sound") exitWith {false};
//if (!isTouchingGround _this) exitWith {false};
if (isBurning _this) exitWith {false};
if (["slop", (format ["%1", _this])] call BIS_fnc_inString) exitWith {false};
if (["fence", (format ["%1", _this])] call BIS_fnc_inString) then
{
If (!(_this isKindOf "Strategic")) exitwith {false};
};
_type = typeOf _this;
if (_type == "") then
{
if (damage _this == 1) exitWith {false};
} else {
//if (_type in ["#soundonvehicle","#mark","#crater","#crateronvehicle","#soundonvehicle","#particlesource","#lightpoint","#slop"]) exitWith {false};
};
_z = (getPosATL _this) select 2;
if (_z > 0.3) exitWith {false};
_bbox = boundingBoxReal _this;
_dz = ((_bbox select 1) select 2) - ((_bbox select 0) select 2);
_dy = abs(((_bbox select 1) select 0) - ((_bbox select 0) select 0));//width
if ((_dz > 0.35) && (_dy > 0.35) ) exitWith {true};
false

View File

@ -0,0 +1,89 @@
/****************************************************************
File: UPSMON_fnc_find_cover.sqf
Author: OLLEM
Description:
Make a group move to cover
Parameter(s):
<--- Leader position
<--- Position to watch
<--- Radius searching
<--- Do the unit move or spawn to the cover position ?
<--- Array of group units
Returns:
Nothing
****************************************************************/
private ["_unitpos","_lookpos","_dist","_spawn","_units","_i","_objects","_vdir","_cpos","_object","_coverPosition"];
_unitpos = _this select 0;
_lookpos = _this select 1;
_dist = _this select 2;
_spawn = _this select 3;
_units = _this select 4;
_i = 0;
If (count _this > 5) then {_i = _this select 5;};
If (_i > 3) exitwith {_units};
if (_spawn) then
{
{
_pos2 = _unitpos findEmptyPosition [1,25];
_x setposATL _pos2;
}foreach _units;
};
_movetocover = [];
(group (_units select 0)) setvariable ["UPSMON_Cover",true];
if (UPSMON_Debug>0) then {player sidechat "Cover"};
//potential cover objects list
_objects = [(nearestObjects [_unitpos, [], _dist]), { _x call UPSMON_fnc_filter } ] call BIS_fnc_conditionalSelect;
_vdir = [_unitpos, _lookpos] call BIS_fnc_DirTo;
{
If (alive _x) then
{
If (count _objects > 0) then
{
_object = _objects select 0;
_objects = _objects - [_object];
If (!IsNull _object) then
{
//_x is potential cover object
_cPos = (getPosATL _object);
//set coverposition to 1.3 m behind the found cover
_coverPosition = [(_cPos select 0) - (sin(_vdir)*1.5), (_cPos select 1) - (cos(_vdir)*1.5), 0];
//Any object which is high and wide enough is potential cover position, excluding water
if (!(surfaceIsWater _coverPosition)) exitwith
{
if (UPSMON_Debug>0) then
{
_ballCover = "sign_sphere100cm_F" createvehicle _coverPosition;
_ballCover setpos _coverPosition;
diag_log format ["object: %1",_object];
};
_movetocover pushback _x;
[_x,[_object, _coverPosition],_lookpos,_spawn] spawn UPSMON_fnc_move_to_cover;
};
};
};
};
} foreach _units;
_units = _units - _movetocover;
If (count _units > 0) then
{
_i = _i + 1;
_units = [_unitpos,_lookpos,_dist,_spawn,_units] call UPSMON_fnc_find_cover;
};
_units;

View File

@ -0,0 +1,88 @@
/****************************************************************
File: UPSMON_fnc_move_to_cover.sqf
Author: OLLEM
Description:
Make a group move to cover
Parameter(s):
<--- unit
<--- Cover Array
<--- Cover object
<--- Cover position
<--- Position to watch
<--- Do the unit move or spawn to the cover position ?
Returns:
Nothing
****************************************************************/
private ["_unit","_coverArray","_lookpos","_spawn","_cover","_coverPosition","_coverDist","_stopped","_continue","_checkTime","_dist","_sight"];
_unit = _this select 0;
_coverArray = _this select 1;
_lookpos = _this select 2;
_spawn = _this select 3;
_cover = _coverArray select 0;
_coverPosition = _coverArray select 1;
if (_spawn) then
{
_unit setposATL _coverPosition;
doStop _unit;
if (_unit == leader (group _unit) || random 100 < 50) then
{
[_unit,_lookpos] call UPSMON_dowatch;
};
}
else
{
Dostop _unit;
_unit domove _coverPosition;
_unit forceSpeed 100;
_unit setDestination [_coverPosition, "LEADER PLANNED", true];
_coverDist = round ([getposATL _unit,_coverPosition] call UPSMON_distancePosSqr);
_stopped = true;
_continue = true;
_checkTime = (time + (1.7 * _coverDist) + 20);
while { _continue } do
{
_dist = ([getposATL _unit,_coverPosition] call UPSMON_distancePosSqr);
if (!(unitReady _unit) && (alive _unit) && (_dist > 1.25) && (_unit getvariable ["UPSMON_SUPSTATUS",""] == "")) then
{
//if unit takes too long to reach cover or moves too far out stop at current location
if (time <= _checkTime) then
{
_continue = false;
}
else
{
//_coverPosition = getPosATL _unit;
//_unit doMove _coverPosition;
//_continue = true;
};
}
else
{
_continue = false;
_stopped = false;
};
};
_unit forcespeed -1;
if (!( _stopped)) then
{
doStop _unit;
_unit setBehaviour "STEALTH";
_sight = [_unit,getdir _unit, 50] call UPSMON_CanSee;
If (!_sight) then {_unit setUnitPos "MIDDLE";};
};
};

View File

@ -0,0 +1,5 @@
UPSMON_fnc_move_to_cover = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Cover\fnc\UPSMON_fnc_move_to_cover.sqf";
UPSMON_fnc_find_cover = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Cover\fnc\UPSMON_fnc_find_cover.sqf";
UPSMON_fnc_filter = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Cover\fnc\UPSMON_fnc_filter.sqf";

View File

@ -0,0 +1,20 @@
UPSMON_getleader = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_getleader.sqf";
UPSMON_SetLeaderGrp = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_SetLeaderGrp.sqf";
UPSMON_getunits = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_getunits.sqf";
UPSMON_getNearestSoldier = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_getNearestSoldier.sqf";
UPSMON_grptype = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_grptype.sqf";
UPSMON_GetStaticTeam = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_GetStaticTeam.sqf";
UPSMON_composeteam = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_composeteam.sqf";
UPSMON_analysegrp = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_analysegrp.sqf";
UPSMON_supstatestatus = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_supstatestatus.sqf";
UPSMON_checkmunition = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_checkmunition.sqf";
UPSMON_Isgrpstuck = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_Isgrpstuck.sqf";
UPSMON_IsRetreating = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_IsRetreating.sqf";
UPSMON_IsSurrending = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_IsSurrending.sqf";
UPSMON_Cangrpmaneuver = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_Cangrpmaneuver.sqf";
UPSMON_Supressfire = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_Supressfire.sqf";
UPSMON_ChangeFormation = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\fnc\UPSMON_ChangeFormation.sqf";

View File

@ -0,0 +1,34 @@
private ["_grp","_nowp","_attackpos","_typeofgrp","_maneuver"];
_grp = _this select 0;
_nowp = _this select 1;
_attackpos = _this select 2;
_typeofgrp = _this select 3;
_maneuver = false;
If (!_nowp) then
{
If (count _attackpos > 0) then
{
If (!("static" in _typeofgrp)) then
{
If (!("arti" in _typeofgrp)) then
{
If (!("supply" in _typeofgrp)) then
{
If (_grp getvariable ["UPSMON_TIMEORDER",time] <= time) then
{
If (_grp getvariable ["UPSMON_Grpmission",""] != "TRANSPORT") then
{
_maneuver = true;
};
};
};
};
};
};
};
_maneuver;

View File

@ -0,0 +1,171 @@
/****************************************************************
File: UPSMON_SetStances.sqf
Author: Azroul13
Description:
Parameter(s):
Returns:
****************************************************************/
private ["_grp","_supstatus","_attackpos","_dist","_terrainscan","_haslos","_time"];
_grp = _this select 0;
_supstatus = _this select 1;
_attackpos = _this select 2;
_dist = _this select 3;
_terrainscan = _this select 4;
_haslos = _this select 5;
_typeofgrp = _this select 6;
If (!(_grp getvariable ["UPSMON_haschangedformation",false])) then
{
_grp setvariable ["UPSMON_haschangedformation",true];
If ("air" in _typeofgrp) then
{
If ((Speedmode _grp) != "FULL") then
{
_grp setspeedmode "FULL";
};
}
else
{
If (_supstatus != "SUPRESSED") then
{
If (count _attackpos > 0) then
{
If (_dist > 500 || !_haslos) then
{
If (vehicle (leader _grp) == (leader _grp)) then
{
If ((Speedmode _grp) != "NORMAL") then
{
_grp setspeedmode "NORMAL";
};
If (_dist < 200) then
{
If ((Formation _grp) != "LINE") then
{
_grp setformation "LINE";
};
}
else
{
If ((Formation _grp) != "STAG COLUMN") then
{
_grp setformation "STAG COLUMN";
};
};
};
}
else
{
If (_dist > 150) then
{
If (!(Behaviour (leader _grp) in ["COMBAT","STEALTH"])) then
{
_grp setBehaviour "COMBAT";
};
If ((Formation _grp) != "WEDGE") then
{
_grp setformation "WEDGE";
};
};
If (_dist <= 150) then
{
If ((_terrainscan select 0) == "forest" || (_terrainscan select 0) == "inhabited") then
{
If ((Speedmode _grp) != "LIMITED") then
{
_grp setspeedmode "LIMITED";
};
if ((_terrainscan select 0) == "inhabited") then
{
If ((_terrainscan select 1) > 230) then
{
If ((Formation _grp) != "STAG COLUMN") then
{
_grp setformation "STAG COLUMN";
};
};
};
};
If ((_terrainscan select 0) == "meadow") then
{
If ((Speedmode _grp) != "FULL") then
{
_grp setspeedmode "FULL";
};
If ((Formation _grp) != "LINE") then
{
_grp setformation "LINE";
};
};
};
};
};
}
else
{
If (_supstatus != "") then
{
If ((behaviour (leader _grp)) != "COMBAT") then
{
(leader _grp) setbehaviour "COMBAT";
};
If ((_terrainscan select 0) == "meadow") then
{
If (Speedmode _grp != "NORMAL") then
{
_grp setspeedmode "NORMAL";
};
};
If ((_terrainscan select 0) == "forest" || (_terrainscan select 0) == "inhabited") then
{
If ((Speedmode _grp) != "LIMITED") then
{
_grp setspeedmode "LIMITED";
};
If ((Formation _grp) != "DIAMOND") then
{
_grp setformation "DIAMOND";
};
};
}
else
{
If ((Speedmode _grp) != "LIMITED") then
{
_grp setSpeedmode "LIMITED";
};
If ((Behaviour (leader _grp)) != "STEALTH") then
{
_grp setBehaviour "STEALTH";
};
};
};
};
};
[_grp] spawn
{
private ["_grp"];
_grp = _this select 0;
sleep 20;
If (!IsNull _grp) then
{
_grp setvariable ["UPSMON_haschangedformation",false];
};
};

View File

@ -0,0 +1,54 @@
/****************************************************************
File: UPSMON_GetStaticTeam.sqf
Author: Azroul13
Description:
Check if group has weapon in bag (gun barrel and tripod)
Parameter(s):
<--- group
Returns:
---> Static Team [Gunner,Assistant]
---> Class of the static
****************************************************************/
private ["_grp","_position","_targetpos","_result","_staticTeam","_vehicle","_tripods","_unit","_backpack","_lots"];
_grp = _this select 0;
_result = [];
_staticTeam = [];
_vehicle = [];
_tripods = [];
{
if (alive _x) then
{
_unit = _x;
_backpack = backpack _Unit;
If (_backpack != "") then
{
_lots = [_backpack] call UPSMON_checkbackpack;
if (count _lots > 0) exitwith {_vehicle = _lots select 0; _tripods = _lots select 1; _staticTeam pushback _x;};
};
};
} foreach units _grp;
if (count _staticTeam > 0) then
{
{
if (alive _x) then
{
_unit = _x;
_backpack = backpack _Unit;
If (_backpack != "") then
{
if (_backpack in _tripods) exitwith {_staticTeam pushback _x;};
};
};
} foreach units _grp;
};
_result = [_staticTeam,_vehicle];
_result

View File

@ -0,0 +1,35 @@
/****************************************************************
File: UPSMON_GothitParam.sqf
Author: Azroul13
Description:
Is the unit hit ? Or Does it under fire ?
Parameter(s):
<--- unit
Returns:
Boolean
****************************************************************/
private ["_npc","_gothit"];
_npc = _this select 0;
_gothit = false;
If (isNil "tpwcas_running") then
{
if (group _npc in UPSMON_GOTHIT_ARRAY || group _npc in UPSMON_GOTKILL_ARRAY) then
{
_gothit = true;
};
}
else
{
_Supstate = [_npc] call UPSMON_supstatestatus;
if (group _npc in UPSMON_GOTHIT_ARRAY || group _npc in UPSMON_GOTKILL_ARRAY || _Supstate >= 2) then
{
_gothit = true;
};
};
_gothit

View File

@ -0,0 +1,37 @@
private ["_grp","_dist","_ratio","_supstatus","_unitsneedammo","_typeofgrp","_assignedvehicles","_attackpos"];
_grp = _this select 0;
_dist = _this select 1;
_ratio = _this select 2;
_supstatus = _this select 3;
_unitsneedammo = _this select 4;
_typeofgrp = _this select 5;
_attackpos = _this select 6;
_assignedvehicles = _this select 7;
If (_grp getvariable ["UPSMON_Grpmission",""] != "RETREAT") then
{
If (!("static" in _typeofgrp)) then
{
If (_ratio > 2 || (count units _grp) == count _unitsneedammo || (_supstatus != "INCAPACITED") || ("arti" in _typeofgrp) || ("support" in _typeofgrp)) then
{
If (_dist >= 300) then
{
If (_supstatus != "SUPRESSED") then
{
If (!(fleeing (leader _grp))) then
{
If ((random 100) <= (call (compile format ["UPSMON_%1_RETREAT",(_grp getvariable ["UPSMON_Origin",[]]) select 5]))) then
{
[_grp,_attackpos,_typeofgrp,_assignedvehicles] spawn UPSMON_DORETREAT;
_grp setvariable ["UPSMON_Grpmission","RETREAT"];
_grpstatus = "BLUE";
};
};
};
};
};
};
};

View File

@ -0,0 +1,38 @@
private ["_grp","_dist","_ratio","_supstatus","_unitsneedammo","_typeofgrp","_haslos"];
_grp = _this select 0;
_dist = _this select 1;
_ratio = _this select 2;
_supstatus = _this select 3;
_unitsneedammo = _this select 4;
_typeofgrp = _this select 5;
_haslos = _this select 6;
If (_grp getvariable ["UPSMON_Grpmission",""] != "RETREAT") then
{
If (UPSMON_SURRENDER) then
{
If ((random 100) <= (call (compile format ["UPSMON_%1_SURRENDER",(_grp getvariable ["UPSMON_Origin",[]]) select 5]))) then
{
If (!("air" in _typeofgrp)) then
{
If (_ratio > 2 || ((count units _grp) == count _unitsneedammo) || (_supstatus != "")) then
{
If (_supstatus == "SUPRESSED") then
{
If (_dist < 300) then
{
If (_haslos) then
{
_grp setvariable ["UPSMON_Grpmission","SURRENDER"];
_grpstatus = "BLUE";
};
};
};
};
};
};
};
};

View File

@ -0,0 +1,73 @@
/****************************************************************
File: UPSMON_Isgrpstuck.sqf
Author: Azroul13
Description:
Check if the group is stuck
Parameter(s):
Returns:
boolean
****************************************************************/
private ["_npc","_lastcurrpos","_currpos","_grp","_stuck","_rstuckControl"];
_npc = _this select 0;
_lastcurrpos = _this select 1;
_currpos = _this select 2;
_grp = group _npc;
_stuck = false;
//Stuck control
If (alive _npc) then
{
If (canmove _npc) then
{
If (!((vehicle _npc) iskindof "air")) then
{
If (_grp getvariable ["UPSMON_NOWP",0] == 0) then
{
If (_lastcurrpos select 0 == _currpos select 0 && _lastcurrpos select 1 == _currpos select 1) then
{
//time > _grp getvariable ["UPSMON_TIMEONTARGET",time]
If (_grp getvariable ["UPSMON_Grpmission",""] != "DEFEND") then
{
If (_grp getvariable ["UPSMON_Grpmission",""] != "FORTIFY") then
{
If (_grp getvariable ["UPSMON_Grpmission",""] != "AMBUSH") then
{
If (!(_npc getvariable ["UPSMON_searchingpos",false])) then
{
If (!(_grp getVariable ["UPSMON_movetolanding",false])) then
{
If (!(_grp getvariable ["UPSMON_embarking",false])) then
{
If (!((vehicle _npc) getvariable ["UPSMON_disembarking",false])) then
{
_rstuckControl = (_grp getvariable ["UPSMON_RSTUCKCONTROL",0]) + 1;
_grp setvariable ["UPSMON_RSTUCKCONTROL",_rstuckControl];
If (_rstuckControl >= 10) then
{
//[_npc] call UPSMON_cancelstop;
//{if (alive _x && leader _x != _x) then {_x dofollow (leader _x)};} foreach units _grp;
_grp setvariable ["UPSMON_RSTUCKCONTROL",0];
_stuck = true;
if (UPSMON_Debug>0) then {player sidechat format["%1 stucked, moving",_grp getvariable ["UPSMON_Grpid",0]]};
if (UPSMON_Debug>0) then {diag_log format["%1 stuck for %2 seconds - trying to move again",_grp getvariable ["UPSMON_Grpid",0]]};
};
};
};
};
};
};
};
};
};
};
};
};
};
_stuck

View File

@ -0,0 +1,39 @@
/****************************************************************
File: UPSMON_SetLeaderGrp.sqf
Author: Azroul13
Description:
Set the leader of the group
Parameter(s):
<--- Unit or Group
Returns:
---> Leader
****************************************************************/
private ["_unit","_Leader", "_grp"];
_unit = _this select 0;
_grp = group _unit;
_Leader = leader (_grp);
if ((_unit iskindof "Man")) then {
if(_unit != _Leader) then {
_grp selectLeader _unit;
};
} else {
if (!isnull(commander _unit) ) then {
_unit = commander _unit;
}else{
if (!isnull(driver _unit) ) then {
_unit = driver _unit;
}else{
_unit = gunner _unit;
};
};
_grp selectLeader _unit;
};
_Leader

View File

@ -0,0 +1,56 @@
private ["_units","_targetpos","_timeout","_delete","_unit","_target","_Pos","_direction"];
_units = _this select 0;
_targetpos = _this select 1;
_timeout = time + 15;
while {_timeout > time && {alive _x} count _units > 0} do
{
{
_delete = false;
If (alive _x) then
{
_unit = _x;
_target = _targetpos;
If (typename _targetpos == "ARRAY") then
{
_Pos = [_targetpos,[0,20],[0,360],0,[0,100],0] call UPSMON_pos;
_target = createVehicle ["UserTexture1m_F",[_Pos select 0,_Pos select 1,1], [], 0, "NONE"];
_delete = true;
};
If ([_unit,_target,300,130] call UPSMON_Haslos) then
{
[_unit,_target,100] call UPSMON_DOwatch;
sleep 1;
_direction = [_unit, _target] call BIS_fnc_dirTo;
_unit setDir _direction;
_weapon = primaryweapon _unit;
_mode = getArray (configFile >> "cfgweapons" >> _weapon >> "modes");
_firemode = "SINGLE";
If (random 100 < 60) then
{
If ("fullauto_medium" in _mode) then {_firemode = "fullauto_medium";};
If ("short" in _mode) then {_firemode = "short";};
};
if ((_mode select 0) == "this") then {_mode = _weapon};
If (needReload _unit == 1) then {reload _unit};
_unit selectWeapon (primaryweapon _unit);
_unit forceWeaponFire [ weaponState _unit select 1,_firemode];
[_unit] spawn
{
sleep 5;
(_this select 0) doTarget ObjNull;
(_this select 0) dofire ObjNull;
(_this select 0) doWatch ObjNull;
};
};
if (_delete) then
{
[_target] spawn {sleep 5; Deletevehicle (_this select 0)};
};
};
} foreach _units;
sleep ((random 0.4) +0.4);
};

View File

@ -0,0 +1,447 @@
/****************************************************************
File: UPSMON_analysegrp.sqf
Author: Azroul13
Description:
get all information about the group
Parameter(s):
<--- Group
Returns:
----> type of the group (array) ["arti","infantry","incargo","tank","transport","armed","apc","car","ship","static","staticbag"]
----> Capacity of the group (array) ["aa1","aa2","at1","at2","at3"] [AAcapability but without missile,AA missile,At Rocket,At missile,At gun]
----> Assigned vehicles (array)
****************************************************************/
private ["_grp","_assignedvehicles","_typeofgrp","_capacityofgrp","_result","_vehicleClass","_MagazinesUnit","_Cargo","_gunner","_ammo","_irlock","_laserlock","_airlock","_checkbag","_staticteam","_points","_vehicle"];
_grp = _this select 0;
_assignedvehicles = [];
_typeofgrp = [];
_capacityofgrp = [];
_engagementrange = 600;
_result = [];
_points = 0;
if (({alive _x} count units _grp) == 0) exitwith {_result = [_typeofgrp,_capacityofgrp,_assignedvehicles,_engagementrange];_result;};
_artibatteryarray = [];
{
If (alive _x) then
{
if ((vehicle _x) != _x && !(Isnull assignedVehicle _x) && !(_x in (assignedCargo assignedVehicle _x))) then
{
if (!((assignedVehicle _x) in _assignedvehicles)) then
{
_vehicle = assignedVehicle _x;
_assignedvehicles pushback _vehicle;
_MagazinesUnit = (magazines _vehicle);
_Cargo = getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> "transportSoldier");
_armor = getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> "armor");
_support = tolower gettext (configFile >> "CfgVehicles" >> typeof _vehicle >> "vehicleClass");
_cfgArtillery = getnumber (configFile >> "cfgVehicles" >> typeOf (_vehicle) >> "artilleryScanner");
_repair = getnumber (configFile >> "cfgVehicles" >> typeOf (_vehicle) >> "transportRepair");
_fuel = getnumber (configFile >> "cfgVehicles" >> typeOf (_vehicle) >> "transportFuel");
_munsupply = getnumber (configFile >> "cfgVehicles" >> typeOf (_vehicle) >> "attendant");
_gunner = gunner _vehicle;
_ammorated = [];
_points = _points + 1;
If (!IsNull _gunner) then
{
If (alive _gunner) then
{
{
_ammo = tolower gettext (configFile >> "CfgMagazines" >> _x >> "ammo");
_irlock = getNumber (configfile >> "CfgAmmo" >> _ammo >> "irLock");
_laserlock = getNumber (configfile >> "CfgAmmo" >> _ammo >> "laserLock");
_airlock = getNumber (configfile >> "CfgAmmo" >> _ammo >> "airLock");
_hit = getNumber (configfile >> "CfgAmmo" >> _ammo >> "hit");
if (_airlock == 1) then
{
if (_ammo iskindof "BulletBase") then
{
If (!("aa1" in _capacityofgrp)) then
{
_capacityofgrp pushback "aa1";
};
};
};
if (_airlock == 2) then
{
if (!(_ammo iskindof "BulletBase")) then
{
If (!("aa2" in _capacityofgrp)) then
{
_capacityofgrp pushback "aa2";
};
};
};
if (_irlock>0 || _laserlock>0) then
{
if (_ammo iskindof "MissileBase") then
{
If (!("at2" in _capacityofgrp)) then
{
_capacityofgrp pushback "at2";
};
};
};
if (_ammo iskindof "ShellBase") then
{
if (!("arti" in _typeofgrp)) then
{
If (!("at3" in _capacityofgrp)) then
{
_capacityofgrp pushback "at3";
};
};
};
if (_ammo iskindof "BulletBase") then
{
if (_hit >= 40) then
{
If (!("at1" in _capacityofgrp)) then
{
_capacityofgrp pushback "at1";
};
};
};
If (!(_ammo in _ammorated)) then
{
_points = _points + _hit;
_ammorated pushback _ammo;
};
} foreach _MagazinesUnit;
};
};
_points = _points + _armor;
If (_vehicle iskindof "car") then
{
If (!("car" in _typeofgrp)) then
{
_typeofgrp pushback "car";
};
If (_armor >= 500) then
{
If (!("heavy" in _typeofgrp)) then
{
_typeofgrp pushback "heavy";
};
};
If (_armor >= 250 && _armor < 500) then
{
If (!("medium" in _typeofgrp)) then
{
_typeofgrp pushback "medium";
};
};
If (_armor < 250) then
{
If (!("light" in _typeofgrp)) then
{
_typeofgrp pushback "light";
};
};
};
If (_vehicle iskindof "staticweapon") then
{
If (!("static" in _typeofgrp)) then
{
_typeofgrp pushback "static";
};
};
If (_vehicle iskindof "air") then
{
If (!("air" in _typeofgrp)) then
{
_typeofgrp pushback "air";
};
};
If (_vehicle iskindof "PLANE") then
{
If ("aa2" in _capacityofgrp || "aa1" in _capacityofgrp || "at1" in _capacityofgrp || "at2" in _capacityofgrp) then
{
If (!("plane" in _typeofgrp)) then
{
_typeofgrp pushback "plane";
};
};
};
If (_vehicle iskindof "Ship") then
{
If (!("Ship" in _typeofgrp)) then
{
_typeofgrp pushback "Ship";
};
};
If (_cargo >= 6) then
{
If (!("transport" in _typeofgrp)) then
{
_typeofgrp pushback "transport";
};
};
If (!IsNull (Gunner _vehicle)) then
{
If (!("armed" in _capacityofgrp)) then
{
_capacityofgrp pushback "armed";
_engagementrange = 1000;
};
};
If (_cfgArtillery == 1) then
{
If (!(_vehicle in _artibatteryarray)) then
{
_artibatteryarray pushback _vehicle;
_grp setvariable ["UPSMON_Battery",_artibatteryarray];
};
If (!("arti" in _typeofgrp)) then
{
_typeofgrp pushback "arti";
};
};
If (_support == "Support") then
{
If (!("supply" in _typeofgrp)) then
{
_typeofgrp pushback "supply";
};
If (_repair > 0) then
{
if (!("repair" in _capacityofgrp)) then
{
_capacityofgrp pushback "repair";
};
};
If (_fuel > 0) then
{
if (!("fuel" in _capacityofgrp)) then
{
_capacityofgrp pushback "fuel";
};
};
If (_munsupply > 0) then
{
if (!("ammo" in _capacityofgrp)) then
{
_capacityofgrp pushback "ammo";
};
};
If (!("support" in _typeofgrp)) then
{
_typeofgrp pushback "support";
};
};
if (_vehicle iskindof "tank" && !("tank" in _typeofgrp)) then
{_typeofgrp pushback "tank";};
if (_vehicle iskindof "Wheeled_APC_F" && !("apc" in _typeofgrp)) then
{_typeofgrp pushback "apc";};
};
}
else
{
If (vehicle _x != _x) then
{
If (!((assignedVehicle _x) in _assignedvehicles)) then
{
_assignedvehicles pushback (assignedVehicle _x);
}
};
_sweapon = secondaryWeapon _x;
_MagazinesUnit=(magazines _x);
_smagazineclass = [];
If (_sweapon != "") then
{
_smagazineclass = getArray (configFile >> "CfgWeapons" >> _sweapon >> "magazines");
};
_ammorated = [];
_points = _points + 1;
{
_ammo = tolower gettext (configFile >> "CfgMagazines" >> _x >> "ammo");
_irlock = getNumber (configfile >> "CfgAmmo" >> _ammo >> "irLock");
_laserlock = getNumber (configfile >> "CfgAmmo" >> _ammo >> "laserLock");
_airlock = getNumber (configfile >> "CfgAmmo" >> _ammo >> "airLock");
_hit = getNumber (configfile >> "CfgAmmo" >> _ammo >> "hit");
If (_airlock==2) then
{
if (!(_ammo iskindof "BulletBase")) then
{
If (_ammo in _smagazineclass) then
{
If (!("aa2" in _capacityofgrp)) then
{
_capacityofgrp pushback "aa2";
};
};
};
};
If (_irlock>0 || _laserlock>0) then
{
if ((_ammo iskindof "RocketBase") || (_ammo iskindof "MissileBase")) then
{
If (_ammo in _smagazineclass) then
{
If (!("at2" in _capacityofgrp)) then
{
_capacityofgrp pushback "at2";
};
};
};
};
If (_irlock==0 || _laserlock==0) then
{
if ((_ammo iskindof "RocketBase") || (_ammo iskindof "MissileBase")) then
{
If (_ammo in _smagazineclass) then
{
If (!("at1" in _capacityofgrp)) then
{
_capacityofgrp pushback "at1";
};
};
};
};
If (_ammo iskindof "ShellBase" || (_ammo iskindof "RocketBase") || (_ammo iskindof "MissileBase") && !(_ammo in _ammorated) && (_ammo in _smagazineclass)) then
{
_points = _points + _hit;
_ammorated pushback _ammo;
};
} foreach _MagazinesUnit;
if (!("infantry" in _typeofgrp)) then
{_typeofgrp pushback "infantry";};
};
_points = _points + ((1+(morale _x)) + (1-(damage _x)) + ((_x skillFinal "Endurance") + (_x skillFinal "courage")));
};
} foreach units _grp;
_checkbag = [_grp] call UPSMON_GetStaticTeam;
_staticteam = _checkbag select 0;
If (count _staticteam == 2) then
{
_cfgArtillery = getnumber (configFile >> "cfgVehicles" >> (_checkbag select 1) >> "artilleryScanner");
_capacityofgrp pushback ["staticbag"];
_engagementrange = 1000;
If (_cfgArtillery == 1) then
{
If (!("arti" in _typeofgrp)) then
{
_typeofgrp pushback "arti";
};
If (!((_staticteam select 0) in _artibatteryarray)) then
{
_artibatteryarray pushback _staticteam;
_grp setvariable ["UPSMON_Battery",_artibatteryarray];
};
If (count (_grp getvariable ["UPSMON_Mortarmun",[]]) == 0) then
{
_rounds = [_checkbag select 1] call UPSMON_GetDefaultmun;
_grp setvariable ["UPSMON_Mortarmun",_rounds];
};
};
};
[_grp,_typeofgrp] call UPSMON_AddtoArray;
_points = _points;
{
If (!IsNull _x) then
{
If ((_renfgroup getvariable ["UPSMON_GrpToRenf",ObjNull]) == _grp) then
{
If (({alive _x && !(captive _x)} count units _x) > 0) then
{
_points = _points + (_x getvariable ["UPSMON_Grpratio",0]);
};
};
};
} foreach (_grp getvariable ["UPSMON_RenfGrps",[]]);
_grp setvariable ["UPSMON_Grpratio",_points];
_grp setvariable ["UPSMON_GroupCapacity",_capacityofgrp];
_grp setvariable ["UPSMON_typeofgrp",_typeofgrp];
_grp setvariable ["UPSMON_Assignedvehicle",_assignedvehicles];
If (count _assignedvehicles > 0) then
{
_array = [];
{
If (canmove _x) then
{
If (driver _x in units _grp) then
{
_array pushback _x;
};
};
} foreach _assignedvehicles;
_grp setvariable ["UPSMON_LastAssignedvehicle",_array];
};
If (count (_grp getvariable ["UPSMON_LastAssignedvehicle",_assignedvehicles]) > 0) then
{
_array = [];
{
If (!IsNull _x) then
{
If (canmove _x) then
{
If (driver _x in units _grp) then
{
_array pushback _x;
};
};
};
} foreach _assignedvehicles;
_grp setvariable ["UPSMON_LastAssignedvehicle",_array];
};
//if (UPSMON_Debug>0) then {diag_log format ["Grpcompos/ typeofgrp:%1 Capacity:%2 Assignedvehicles:%3 range:%4 Points:%5",_typeofgrp,_capacityofgrp,_assignedvehicles,_engagementrange,_points];};
_result = [_typeofgrp,_capacityofgrp,_assignedvehicles,_engagementrange];
_result;

View File

@ -0,0 +1,37 @@
/****************************************************************
File: UPSMON_checkallied.sqf
Author: Azroul13
Description:
Are they any allied near the group
Use for Surrending condition
Parameter(s):
<--- leader
<--- Searching radius
<--- Unit Side
Returns:
Array [[Eni units],[Allied Units]]
****************************************************************/
private ["_npc","_mennear","_result","_radius"];
_npc = _this select 0;
_radius = _this select 1;
_side = side _npc;
_mennear = _npc nearTargets 180;
_result = false;
_allied = [];
_eny = [];
_enemySides = _npc call BIS_fnc_enemySides;
{
_unit = _x select 4;
_unitside = _x select 2;
If ((alive _unit) && (_unitside == _side) && !(_unit in (units _npc)) && !(captive _unit)) then {_allied = _allied + [_x];};
If ((alive _unit) && (_unitside in _enemySides) && _npc knowsabout _unit >= UPSMON_knowsAboutEnemy) then {_eny = _eny + [_x];}
} foreach _mennear;
_result = [_allied,_eny];
_result

View File

@ -0,0 +1,79 @@
/****************************************************************
File: UPSMON_checkmunition.sqf
Author: Azroul13
Description:
Check if unit in the group is out of munition
Parameter(s):
<--- leader
Returns:
Array of units who needs ammo
****************************************************************/
private ["_npc","_units","_result","_unit","_weapon","_magazineclass","_magazines","_weapon","_sweapon","_mags","_magazinescount","_smagazineclass"];
_npc = _this select 0;
_units = units _npc;
_result = [];
_minmag = 2;
{
If (!IsNull _x) then
{
If (alive _x) then
{
If (vehicle _x == _x) then
{
_unit = _x;
_magsneeded = [[],[]];
_weapon = primaryWeapon _unit;
_sweapon = secondaryWeapon _unit;
_magazineclass = getArray (configFile / "CfgWeapons" / _weapon / "magazines");
_smagazineclass = [];
If (_sweapon != "") then {_smagazineclass = getArray (configFile / "CfgWeapons" / _sweapon / "magazines");};
_mags = magazinesAmmoFull _unit;
If (count _smagazineclass > 0) then
{
_magazinescount = {(_x select 0) in _smagazineclass} count _mags;
_arr = [];
{_arr pushback _x} foreach _smagazineclass;
_magsneeded set [0,_arr];
If (_magazinescount == 0) then
{
If (!(_unit in _result)) then
{
_result pushback _unit;
};
};
};
If (count _magazineclass > 0) then
{
_magazinescount = {(_x select 0) in _magazineclass} count _mags;
_arr = [];
{_arr pushback _x} foreach _magazineclass;
_magsneeded set [1,_arr];
If (_magazinescount <= 2) then
{
If (!(_unit in _result)) then
{
_result pushback _unit;
};
};
};
If (_unit in _result) then
{
if (UPSMON_AllowRearm) then
{
[_unit,_magsneeded] spawn UPSMON_Rearm;
};
};
};
};
};
} foreach _units;
_result

View File

@ -0,0 +1,34 @@
/****************************************************************
File: UPSMON_checksizetargetgrp.sqf
Author: Azroul13
Description:
Check how many suplementary targets are near the revealed target
Use for Artillery fire condition: if (count([_attackpos,50,EAST] call UPSMON_checksizetargetgrp) >= 4) then {_artillery=true}
Parameter(s):
<--- unit
<--- Searching radius
<--- Unit Side
Returns:
Array of units
****************************************************************/
private ["_mennear","_result","_pos","_radius"];
_pos = _this select 0;
_radius = _this select 1;
_side = _this select 2;
_mennear = _pos nearentities [["CAManBase"],_radius];
_enemySides = _side call BIS_fnc_enemySides;
_result = false;
_allied = [];
_eny = [];
{
If ((side _x in _enemySides) && _npc knowsabout _x >= UPSMON_knowsAboutEnemy) then {_eny = _eny + [_x];}
} foreach _mennear;
_result = [_eny];
_result

View File

@ -0,0 +1,173 @@
/****************************************************************
File: UPSMON_composeteam.sqf
Author: Azroul13
Description:
Each units of the group is assigned to a team
Parameter(s):
<--- group
Returns:
----> Support Team (array of units)
----> Assault Team (array of units)
----> ATteam (array of units)
----> AAteam (array of units)
****************************************************************/
private ["_grp","_units","_Assltteam","_Supportteam","_Atteam","_result","_units","_at","_unit","_weapon","_sweapon","_typeweapon"];
_grp = _this select 0;
_Assltteam = [];
_Supportteam = [];
_Atteam = [];
_AAteam = [];
_snpteam = [];
_mgteam = [];
_result = [];
if (({alive _x} count units _grp) == 0) exitwith {_result = [];_result;};
// add leader and people to team 1
_Supportteam pushback (vehicle (leader _grp));
_unitsleft = units _grp;
_unitsleft = _unitsleft - [leader _grp];
_unitsinvalid = [];
_vehiclesnbr = 0;
//Add vehicles with gunner in the support team
{
If (alive _x) then
{
If (vehicle _x != _x) then
{
If (!(_x in (assignedCargo assignedVehicle _x))) then
{
If (!IsNull (gunner vehicle _x)) then
{
If (!(vehicle _x in _Supportteam)) then
{
_Supportteam pushback (vehicle _x);
_vehiclesnbr = _vehiclesnbr + 1;
};
_unitsinvalid pushback _x;
};
};
};
}
else
{
_unitsinvalid pushback _x;
};
} foreach _unitsleft;
_unitsleft = _unitsleft - _Supportteam;
_unitsleft = _unitsleft - _unitsinvalid;
{
If (alive _x) then
{
If (canmove _x) then
{
If (_x == vehicle _x) then
{
_weapon = currentweapon _x;
_sweapon = secondaryWeapon _x;
_typeweapon = tolower gettext (configFile / "CfgWeapons" / _weapon / "cursor");
if (_sweapon != "") then
{
_smagazineclass = (getArray (configFile / "CfgWeapons" / _sweapon / "magazines")) select 0;
_ammo = tolower gettext (configFile >> "CfgMagazines" >> _smagazineclass >> "ammo");
_irlock = getNumber (configfile >> "CfgAmmo" >> _ammo >> "irLock");
_laserlock = getNumber (configfile >> "CfgAmmo" >> _ammo >> "laserLock");
_airlock = getNumber (configfile >> "CfgAmmo" >> _ammo >> "airLock");
if (_airlock==2 && !(_ammo iskindof "BulletBase") && !(_x in _AAteam)) then
{_AAteam pushback _x};
if ((_irlock==0 || _laserlock==0) &&
((_ammo iskindof "RocketBase") || (_ammo iskindof "MissileBase") || (_ammo iskindof "RocketBase") || (_ammo iskindof "MissileBase")) && !(_x in _ATteam)) then
{_Atteam pushback _x};
};
if (!(_x in _Supportteam) && (_typeweapon in ["mg","srifle"] || _sweapon != "")) then
{
_Supportteam pushback _x;
If (_typeweapon == "mg") then {_mgteam pushback _x;};
If (_typeweapon == "srifle") then {_snpteam pushback _x;};
};
};
}
else
{
_unitsinvalid pushback _x;
};
}
else
{
_unitsinvalid pushback _x;
};
} foreach _unitsleft;
//Add the rest to the Assltteam
_unitsleft = _unitsleft - _unitsinvalid;
_Assltteam = _unitsleft - _Supportteam;
If ({alive _x && vehicle _x == _x} count units _grp <= 4) then
{
If (_vehiclesnbr == 0) then
{
_Assltteam = units _grp;
}
else
{
if (count _Assltteam <= 1 && count _Supportteam > 1) then
{
_arr2 = _Supportteam;
{
If (_x != vehicle (leader _grp)) then
{
If (count _arr2 > count _Assltteam) then
{
_Assltteam pushback _x;
_arr2 = _arr2 - [_x];
};
};
} foreach _Supportteam;
_Supportteam = _arr2;
};
};
}
else
{
if (count _Assltteam <= 1 && count _Supportteam > 4) then
{
_arr2 = _Supportteam;
{
If (_x != vehicle (leader _grp)) then
{
If (vehicle _x == _x) then
{
If (count _arr2 > count _Assltteam) then
{
_Assltteam pushback _x;
_arr2 = _arr2 - [_x];
};
};
};
} foreach _Supportteam;
_Supportteam = _arr2;
};
};
{_x assignTeam "RED"} foreach _Assltteam;
{_x assignTeam "BLUE"} foreach _Supportteam;
_result = [_Supportteam,_Assltteam,_Atteam,_AAteam];
_result;

View File

@ -0,0 +1,22 @@
/****************************************************************
File: UPSMON_getNearestSoldier.sqf
Author: Monsada
Description:
Parameter(s):
Returns:
****************************************************************/
private["_units","_position","_near"];
_position = _this select 0;
_units = _this select 1;
_near = [_units, [], {_position distance _x}, "ASCEND"] call BIS_fnc_sortBy;;
_near = _near select 0;
_near

View File

@ -0,0 +1,112 @@
/****************************************************************
File: UPSMON_getleader.sqf
Author: Monsada
Description:
Check if leader is alive and if not search for a replacement in the group
Parameter(s):
<--- leader
<--- group
Returns:
leader
****************************************************************/
private ["_npc","_grp","_members","_list"];
_npc = _this select 0;
_grp = _this select 1;
_members = units _grp;
//sleep 0.05;
if (!alive _npc) then
{
//soldier not in vehicle takes the lead or not in tank vehicle
_list = [];
{
if (alive _x) then
{
If (!isPlayer _x) then
{
if (canmove _x) then
{
_points = 0;
If (_x == vehicle _x) then
{
switch (rank _x) do
{
case "CORPORAL":
{
_points = _points + 20;
};
case "SERGEANT":
{
_points = _points + 30;
};
case "LIEUTENANT":
{
_points = _points + 40;
};
case "MAJOR":
{
_points = _points + 50;
};
case "COLONEL":
{
_points = _points + 60;
};
case "PRIVATE":
{
_points = _points + 10;
};
};
}
else
{
If (vehicle _x iskindof "TANK" || vehicle _x iskindof "Wheeled_APC") then
{
If ((assignedVehicleRole _x) select 0 == "Commander") then
{
_points = _points + 80;
};
If ((assignedVehicleRole _x) select 0 == "Gunner") then
{
_points = _points + 40;
};
};
};
_list pushback [_x,_points];
};
};
};
} foreach _members;
If (count _list > 0) then
{
_list = [_list, [], {(_x select 1)}, "DESCEND"] call BIS_fnc_sortBy;
_npc = (_list select 0) select 0;
};
//if no soldier out of vehicle takes any
if (!alive _npc ) then
{
{
if (alive _x && canmove _x) exitwith {_npc = _x;};
} foreach _members;
};
//If not alive or already leader or is player exits
{
{
if (alive _x && !isPlayer _x) exitwith {_npc = [_npc,_grp] call UPSMON_getleader;};
} foreach _members;
};
if (leader _grp == _npc) exitwith {_npc};
//Set new _npc as leader
_grp selectLeader _npc;
};
_npc // return

View File

@ -0,0 +1,41 @@
/****************************************************************
File: UPSMON_getunits.sqf
Author: Azroul13
Description:
Parameter(s):
<--- Array of units
Returns:
Array of units
****************************************************************/
private ["_units","_validunits"];
_units = _this select 0;
_validunits = [];
{
if (alive _x) then
{
If (vehicle _x == _x) then
{
If (_x getvariable ["UPSMON_Supstatus",""] != "SUPRESSED") then
{
If (canmove _x) then
{
If (canstand _x) then
{
If (!([_x] call UPSMON_Inbuilding)) then
{
_validunits pushback _x;
};
};
};
};
};
};
}foreach _units;
_validunits

View File

@ -0,0 +1,23 @@
/****************************************************************
File: UPSMON_grptype.sqf
Author: Azroul13
Description:
get the type of the group
Parameter(s):
<--- leader
Returns:
----> Group type ("Isman"/"Iscar"/"IsAir"/"Isboat"/"Isdiver")
****************************************************************/
private [];
_npc = _this select 0;
_type = "";
If ("LandVehicle" countType [vehicle _npc]>0) then {_type = "Iscar"};
If ("Ship" countType [vehicle _npc]>0) then {_type = "Isboat"};
If ("Air" countType [vehicle _npc]>0) then {_type = "IsAir"};
If (["diver", (typeOf (leader _npc))] call BIS_fnc_inString) then {_type = "Isdiver"};
If (_type == "") then {_type = "Isman"};
_type

View File

@ -0,0 +1,99 @@
/****************************************************************
File: UPSMON_supstatestatus.sqf
Author: Azroul13
Description:
Check if the group is under fire
Activated only when TPWCAS script is present
Parameter(s):
<--- unit
Returns:
Boolean
****************************************************************/
//Check if the group is under fire
private ["_grp","_supstatus","_unitsnbr","_tpwcas_running","_statuslist"];
_grp = _this select 0;
_supstatus = "";
_unitsnbr = count (units _grp);
_tpwcas_running = if (!isNil "tpwcas_running") then {true} else {false};
_statuslist = [];
{
If (alive _x) then
{
_x setvariable ["UPSMON_SUPSTATUS",""];
If (_x in UPSMON_GOTHIT_ARRAY) then
{
UPSMON_GOTHIT_ARRAY = UPSMON_GOTHIT_ARRAY - [_x];
If (damage _x < 0.3) then
{
_statuslist pushback "hit";
}
else
{
_statuslist pushback "wounded";
};
_x setvariable ["UPSMON_SUPSTATUS","UNDERFIRE"];
};
if (_tpwcas_running) then
{
If (_x getvariable "tpwcas_supstate" == 3) then
{
_statuslist pushback "supressed";
_x setvariable ["UPSMON_SUPSTATUS","SUPRESSED"];
};
If (_x getvariable "tpwcas_supstate" == 2) then
{
_statuslist pushback "hit";
_x setvariable ["UPSMON_SUPSTATUS","UNDERFIRE"];
};
};
If (isNil "bdetect_enable") then
{
If (_x getVariable ["bcombat_suppression_level", 0] >= 20 && _x getVariable ["bcombat_suppression_level", 0] < 75) then
{
_statuslist pushback "hit";
_x setvariable ["UPSMON_SUPSTATUS","UNDERFIRE"];
};
If (_x getVariable ["bcombat_suppression_level", 0] >= 75) then
{
_statuslist pushback "supressed";
_x setvariable ["UPSMON_SUPSTATUS","SUPRESSED"];
};
};
}
else
{
if (_x in UPSMON_GOTKILL_ARRAY) then
{
UPSMON_GOTKILL_ARRAY = UPSMON_GOTKILL_ARRAY - [_x];
_statuslist pushback "dead";
};
};
} foreach units _grp;
If ({_x == "supressed" || _x == "wounded" || _x == "dead"} count _statuslist >= _unitsnbr) then
{
If ({_x == "supressed"} count _statuslist < {_x == "wounded" || _x == "dead"} count _statuslist) then
{
_supstatus = "INCAPACITED"
}
else
{
_supstatus = "SUPRESSED"
};
};
If (_supstatus == "") then
{
If ("hit" in _statuslist || "wounded" in _statuslist || "dead" in _statuslist || "supressed" in _statuslist) then
{
_supstatus = "UNDERFIRE"
};
};
_supstatus

View File

@ -0,0 +1,8 @@
//Group
UPSMON_SetLeaderGrp = call compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\UPSMON_SetLeaderGrp.sqf";
UPSMON_GetParams = call compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\Params\UPSMON_GetParams.sqf";
UPSMON_GetGroupbehaviour = call compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\Params\UPSMON_GetGroupbehaviour.sqf";
UPSMON_GetGroupformation = call compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\Params\UPSMON_GetGroupformation.sqf";
UPSMON_GetGroupspeed = call compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\Params\UPSMON_GetGroupspeed.sqf";
UPSMON_SetEventhandlers = call compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Group\Params\UPSMON_SetEventhandlers.sqf";

View File

@ -0,0 +1,26 @@
/****************************************************************
File: UPSMON_GetIn_NearestCombat.sqf
Author: Ollem
Description:
Replacement of "setvehicleinit" command. Add init line to a spawned AI.
Parameter(s):
<--- netid object
<--- unit init
Returns:
Nothing
****************************************************************/
private ["_netID","_unit","_unitinit"];
_netID = _this select 0;
_unit = objectFromNetID _netID;
_unitinit = _this select 1;
_unitstr = "_unit";
_index=[_unitinit,"this",_unitstr] call UPSMON_Replace;
call compile format ["%1",_index];
if (UPSMON_Debug>0) then { diag_log format ["UPSMON 'UPSMON_fnc_setVehicleInit': %1 %2 %3",_unitinit,_index,_unit]; };

View File

@ -0,0 +1,23 @@
/****************************************************************
File: UPSMON_fnc_setVehicleVarName.sqf
Author: Ollem
Description:
Replacement of "setvehicleinit" command.
Parameter(s):
<--- netid object
<--- unit name
Returns:
Nothing
****************************************************************/
private ["_netID","_unit","_unitname"];
_netID = _this select 0;
_unit = objectFromNetID _netID;
_unitname = _this select 1;
_unit setVehicleVarName _unitname;
_unit call compile format ["%1=_This; PublicVariable ""%1""",_unitname];
if (UPSMON_Debug>0) then { diag_log format ["UPSMON 'UPSMON_fnc_setVehicleVarName': %1=_This; PublicVariable ""%1""",_unitname]; };

View File

@ -0,0 +1,3 @@
UPSMON_fnc_setVehicleInit = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\MP\fnc\UPSMON_fnc_setVehicleInit.sqf";
UPSMON_fnc_setVehicleVarName = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\MP\fnc\UPSMON_fnc_setVehicleVarName.sqf";

View File

@ -0,0 +1,21 @@
UPSMON_GetParams = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_GetParams.sqf";
UPSMON_GetGroupbehaviour = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_GetGroupbehaviour.sqf";
UPSMON_GetGroupformation = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_GetGroupformation.sqf";
UPSMON_GetGroupspeed = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_GetGroupspeed.sqf";
UPSMON_SetEventhandlers = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_SetEventhandlers.sqf";
UPSMON_GetRespawndelay = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_GetRespawndelay.sqf";
UPSMON_GetRespawnpos = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_GetRespawnpos.sqf";
UPSMON_GetRespawntime = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_GetRespawntime.sqf";
UPSMON_SetClones = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_SetClones.sqf";
UPSMON_Settemplate = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_Settemplate.sqf";
UPSMON_SetmarkerArea = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_SetmarkerArea.sqf";
UPSMON_SetRenfParam = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_SetRenfParam.sqf";
UPSMON_NOSMOKE = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_NOSMOKE.sqf";
UPSMON_BacktoNormal = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\Params\fnc\UPSMON_BacktoNormal.sqf";

View File

@ -0,0 +1,29 @@
/****************************************************************
File: UPSMON_BackToNormal.sqf
Author: Azroul13
Description:
Parameter(s):
<--- group
Returns:
Nothing
****************************************************************/
private["_npc","_Ucthis","_behaviour"];
_grp = _this select 0;
_grp setvariable ["UPSMON_Grpstatus","GREEN"];
If (_grp getvariable ["UPSMON_NOWP",0] > 0) then
{
[_grp,((_grp getvariable "UPSMON_Origin") select 0),"MOVE",((_grp getvariable "UPSMON_Origin") select 1),((_grp getvariable "UPSMON_Origin") select 2),((_grp getvariable "UPSMON_Origin") select 3),"YELLOW",1] spawn UPSMON_DocreateWP;
}
else
{
_grp setbehaviour ((_grp getvariable "UPSMON_Origin") select 1);
_grp setspeedmode ((_grp getvariable "UPSMON_Origin") select 2);
_grp setformation ((_grp getvariable "UPSMON_Origin") select 3);
};
_grp setvariable ["UPSMON_Grpmission",_grp getvariable "UPSMON_OrgGrpmission"];

View File

@ -0,0 +1,29 @@
/****************************************************************
File: UPSMON_GetGroupbehaviour.sqf
Author: Azroul13
Description:
Get unit behaviour
Parameter(s):
<--- leader
<--- UPSMON parameters
Returns:
---> behaviour of the group
****************************************************************/
private["_npc","_Ucthis","_behaviour"];
_npc = _this select 0;
_Ucthis = _this select 1;
_behaviour = Behaviour _npc;
// set behaviour modes (or not)
if ("CARELESS" in _UCthis) then {_behaviour = "CARELESS"};
if ("SAFE" in _UCthis) then {_behaviour = "SAFE"};
if ("AWARE" in _UCthis) then {_behaviour = "AWARE"};
if ("COMBAT" in _UCthis) then {_behaviour = "COMBAT"};
if ("STEALTH" in _UCthis) then {_behaviour = "STEALTH"};
_behaviour

View File

@ -0,0 +1,28 @@
/****************************************************************
File: UPSMON_GetGroupformation.sqf
Author: Azroul13
Description:
Get unit behaviour
Parameter(s):
<--- leader
<--- UPSMON parameters
Returns:
---> formation
****************************************************************/
private["_npc","_Ucthis","_formation"];
_npc = _this select 0;
_Ucthis = _this select 1;
_formation = Formation _npc;
// set formation modes (or not)
If ("COLUMN" in _UCthis) then {_formation = "COLUMN";};
If ("STAG COLUMN" in _UCthis) then {_formation = "STAG COLUMN";};
If ("WEDGE" in _UCthis) then {_formation = "WEDGE";};
If ("VEE" in _UCthis) then {_formation = "VEE";};
If ("LINE" in _UCthis) then {_formation = "LINE";};
If ("FILE" in _UCthis) then {_formation = "FILE";};
_formation

View File

@ -0,0 +1,26 @@
/****************************************************************
File: UPSMON_GetGroupspeed.sqf
Author: Azroul13
Description:
Get unit speed mode
Parameter(s):
<--- leader
<--- UPSMON parameters
Returns:
---> speed mode
****************************************************************/
private["_npc","_Ucthis","_speed"];
_npc = _this select 0;
_Ucthis = _this select 1;
_speed = Speedmode _npc;
// set initial speed
_noslow = if ("NOSLOW" in _UCthis) then {"NOSLOW"} else {"SLOW"};
if ("LIMITED" in _UCthis) then {_speed = "LIMITED"};
if ("NORMAL" in _UCthis) then {_speed = "NORMAL"};
if ("FULL" in _UCthis || _noslow == "NOSLOW") then {_speed = "FULL"};
_speed

View File

@ -0,0 +1,25 @@
/****************************************************************
File: UPSMON_GetParams.sqf
Author: Azroul13
Description:
Convert argument list to uppercase
Parameter(s):
<--- Parameters
Returns:
---> Parameters
****************************************************************/
private["_Params","_UCthis","_i","_e"];
_Params = _this select 0;
_UCthis = [];
for [{_i=0},{_i<count _Params},{_i=_i+1}] do
{
_e=_Params select _i;
if (typeName _e=="STRING") then {_e=toUpper(_e)};
_UCthis set [_i,_e]
};
_UCthis

View File

@ -0,0 +1,20 @@
/****************************************************************
File: UPSMON_GetRespawndelay.sqf
Author: Azroul13
Description:
Parameter(s):
<--- UPSMON parameters
Returns:
Number
****************************************************************/
private["_Ucthis","_respawndelay"];
_Ucthis = _this select 0;
_respawndelay = 0;
If ("RESPAWNDELAY:" in _Ucthis) then {_respawndelay = ["RESPAWNDELAY:",_respawndelay,_UCthis] call UPSMON_getArg};
_respawndelay

View File

@ -0,0 +1,22 @@
/****************************************************************
File: UPSMON_GetRespawnpos.sqf
Author: Azroul13
Description:
Parameter(s):
<--- UPSMON parameters
Returns:
Array of position
****************************************************************/
private["_Ucthis","_respawnpos","_npc"];
_Ucthis = _this select 0;
_npc = _this select 1;
_respawnpos = getposATL _npc;
If ("RESPAWNPOS:" in _Ucthis) then {_respawnpos = ["RESPAWNPOS:",_respawnpos,_UCthis] call UPSMON_getArg};
If (typename (_respawnpos select 0) == "ARRAY") then {_respawnpos = _respawnpos select (floor (random (count _respawnpos)))};
_respawnpos

View File

@ -0,0 +1,21 @@
/****************************************************************
File: UPSMON_GetRespawntime.sqf
Author: Azroul13
Description:
Parameter(s):
<--- UPSMON parameters
Returns:
Number
****************************************************************/
private["_Ucthis","_respawn","_respawntime"];
_Ucthis = _this select 0;
_respawntime = 0;
if ("RESPAWN" in _UCthis) then {_respawntime = 1;};
If ("RESPAWN:" in _UCthis) then {_respawntime = ["RESPAWN:",_respawntime,_UCthis] call UPSMON_getArg};
_respawntime

View File

@ -0,0 +1,28 @@
/****************************************************************
File: UPSMON_BackToNormal.sqf
Author: Azroul13
Description:
Parameter(s):
<--- group
Returns:
Nothing
****************************************************************/
private["_grp","_nosmoke"];
_grp = _this select 0;
_nosmoke = true;
If (random 100 > UPSMON_USE_SMOKE) then
{
If (_grp getvariable ["UPSMON_SmokeTime",0] < time) then
{
If (!(_grp getvariable ["UPSMON_NOSMOKE",false])) then
{
_nosmoke = false;
};
};
};
_nosmoke

View File

@ -0,0 +1,27 @@
/****************************************************************
File: UPSMON_SetClones.sqf
Author: Azroul
Description:
Parameter(s):
<--- Parameters of UPSMON
Returns:
nothing
****************************************************************/
private ["_Ucthis","_mincopies","_maxcopies","_membertypes"];
_Ucthis = _this select 0;
_membertypes = _this select 1;
_mincopies = ["MIN:",0,_UCthis] call UPSMON_getArg;
_maxcopies = ["MAX:",0,_UCthis] call UPSMON_getArg;
if (_mincopies>_maxcopies) then {_maxcopies=_mincopies};
if (_maxcopies>140) exitWith {hint "Cannot create more than 140 groups!"};
if (_maxcopies>0) then
{
_Ucthis = ["MIN:",0,_UCthis] call UPSMON_setArg;
_Ucthis = ["MAX:",0,_Ucthis] call UPSMON_setArg;
[_Ucthis,_mincopies,_maxcopies,_membertypes] call UPSMON_Clones;
};

View File

@ -0,0 +1,51 @@
/****************************************************************
File: UPSMON_SetEventhandlers.sqf
Author: Azroul13
Description:
Convert argument list to uppercase
Parameter(s):
<--- Members of the group
<--- Parameters
Returns:
Nothing
****************************************************************/
private["_members","_UCthis","_grpid","_deletedead"];
_members = _this select 0;
_UCthis = _this select 1;
_grpid = _this select 2;
_deletedead = ["DELETE:",0,_UCthis] call UPSMON_getArg;
{
_x setVariable ["UPSMON_grpid", _grpid, false];
If (_x != vehicle _x && (vehicle _x) getVariable ["UPSMON_grpid",0] != _grpid) then {(vehicle _x) setVariable ["UPSMON_grpid", _grpid, false];};
sleep 0.05;
if (side _x != civilian) then
{//soldiers
_x AddEventHandler ["hit", {nul = _this spawn UPSMON_SN_EHHIT}];
sleep 0.05;
_x AddEventHandler ["killed", {nul = _this spawn UPSMON_SN_EHKILLED}];
//_x AddEventHandler ["fired", {nul = _this spawn UPSMON_SN_EHFIRED}];
}
else
{//civ
if (!isnil "_x") then
{
sleep 0.05;
_x AddEventHandler ["firedNear", {nul = _this spawn UPSMON_SN_EHFIREDNEAR}];
sleep 0.05;
_x AddEventHandler ["killed", {nul = _this spawn UPSMON_SN_EHKILLEDCIV}];
sleep 0.05;
};
};
if (_deletedead>0) then
{
_x addEventHandler['killed',format["[_this select 0,%1] spawn UPSMON_deleteDead",_deletedead]];
sleep 0.01;
};
} foreach _members;

View File

@ -0,0 +1,69 @@
/****************************************************************
File: UPSMON_SetMarkerArea.sqf
Author: Azroul13
Description:
Get unit behaviour
Parameter(s):
<--- group
<--- Marker Area of the group
<--- UPSMON parameters
Returns:
****************************************************************/
private["_grp","_areamarker","_Ucthis","_showmarker","_groups","_marker","_in","_id"];
_grp = _this select 0;
_areamarker = _this select 1;
_Ucthis = _this select 2;
_showmarker = "HIDEMARKER";
_in = false;
_groups = [];
_id = - 1;
{
_id = _id + 1;
_marker = _x select 0;
if (UPSMON_Debug > 0) then
{
Hint format ["AreaMarker:%1 marker:%2 array:%3",_areamarker,_marker,_x];
diag_log format ["AreaMarker:%1 marker:%2 array:%3",_areamarker,_marker,_x];
};
If (_areamarker == _marker) exitwith
{
_in = true;
_groups = _x select 1;
};
} foreach UPSMON_Markers;
_groups set [count _groups,_grp];
_markerarray = [_areamarker,_groups];
If (_in) then
{
UPSMON_Markers set [_id,_markerarray];
}
else
{
UPSMON_Markers set [count UPSMON_Markers,_markerarray];
};
{
_group = _x;
If (({alive _x && !(captive _x)} count units _group) > 0) then
{
_UCthis = _group getvariable ["UPSMON_Ucthis",[]];
If ("SHOWMARKER" in _UCthis) exitwith {_showmarker = "SHOWMARKER";};
};
} foreach _groups;
if (_showmarker=="HIDEMARKER") then
{
_areamarker setmarkerAlpha 0;
}
else
{
If (MarkerAlpha _areamarker == 0) then
{
_areamarker setmarkerAlpha 1;
};
};

View File

@ -0,0 +1,53 @@
/****************************************************************
File: UPSMON_SetRenfParam.sqf
Author: Azroul13
Description:
Parameter(s):
<--- _grp
<--- UPSMON parameters
Returns:
****************************************************************/
private[];
_grp = _this select 0;
_Ucthis = _this select 1;
// set If enemy detected reinforcements will be sent REIN1
_rfid = ["REINFORCEMENT:",0,_UCthis] call UPSMON_getArg; // rein_#
_reinforcement= if ("REINFORCEMENT" in _UCthis) then {"REINFORCEMENT"} else {"NOREINFORCEMENT"}; //rein_yes
If (_rfid > 0 || "REINFORCEMENT" in _UCthis) then
{
_grp setvariable ["UPSMON_Reinforcement",true];
_grp setvariable ["UPSMON_ReinforcementSent",false];
If ("REINFORCEMENT" in _UCthis) then
{
switch (side _grp) do
{
case West:
{
UPSMON_REINFORCEMENT_WEST_UNITS pushback _grp;
PublicVariable "UPSMON_REINFORCEMENT_WEST_UNITS";
};
case EAST:
{
UPSMON_REINFORCEMENT_EAST_UNITS pushback _grp;
PublicVariable "UPSMON_REINFORCEMENT_EAST_UNITS";
};
case RESISTANCE:
{
UPSMON_REINFORCEMENT_GUER_UNITS pushback _grp;
PublicVariable "UPSMON_REINFORCEMENT_GUER_UNITS";
};
};
}
else
{
_grp setvariable ["UPSMON_Rfid",_rfid];
};
};

View File

@ -0,0 +1,29 @@
/****************************************************************
File: UPSMON_SetTemplate.sqf
Author: Azroul13
Description:
Parameter(s):
<--- Spawned parameter
<--- template number
<--- Side of the group
Returns:
****************************************************************/
private["_spawned","_template","_side","_unitstypes"];
_spawned= _this select 0;
_template = _this select 1;
_side = _this select 2;
_unitstypes = _this select 3;
//Fills template array for spawn
if (_template > 0 && !_spawned) then
{
UPSMON_TEMPLATES = UPSMON_TEMPLATES + ( [[_template]+[_side]+_unitstypes select 0+_unitstypes select 1] );
if (UPSMON_Debug>0) then
{
diag_log format["Adding TEMPLATE %1 _spawned %2",_template,_spawned];
};
};

View File

@ -0,0 +1,10 @@
private ["_bld"];
_bld = _this select 0;
_nbrdoors = round (count ((configfile >> "cfgVehicles" >> (typeOf _bld) >> "UserActions") call bis_fnc_returnchildren))/2;
sleep 20;
for "_i" from 0 to _nbrdoors do
{
[_bld, "door_" + str _i + "_rot", "Door_Handle_" + str _i + "_rot_1", "Door_Handle_" + str _i + "_rot_2"] execVM "\A3\Structures_F\scripts\Door_close.sqf";
};

View File

@ -0,0 +1,15 @@
UPSMON_GetNearestBuildings = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_GetNearestBuildings.sqf";
UPSMON_GetNearestBuilding = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_GetNearestBuilding.sqf";
UPSMON_filterbuilding = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_filterbuilding.sqf";
UPSMON_checkdoorposition = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_checkdoorposition.sqf";
UPSMON_Checkfreebldpos = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_Checkfreebldpos.sqf";
UPSMON_Checkfreebldpos2 = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_Checkfreebldpos2.sqf";
UPSMON_checkwindowposition = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_checkwindowposition.sqf";
UPSMON_gethighestbldpos = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_gethighestbldpos.sqf";
UPSMON_Isroof = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_Isroof.sqf";
UPSMON_Inbuilding = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_Inbuilding.sqf";
UPSMON_SortOutBldpos = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_SortOutBldpos.sqf";
UPSMON_UnitWatchDir = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_UnitWatchDir.sqf";
UPSMON_WillSee = compile preProcessFileLineNumbers "\addons\sarge\UPSMON\COMMON\buildings\fnc\UPSMON_WillSee.sqf";

View File

@ -0,0 +1,35 @@
/****************************************************************
File: UPSMON_Checkfreebldpos.sqf
Author: Azroul13
Description:
Filter the building position and check if there're no unit near the position.
Parameter(s):
<--- Building positions
Returns:
Building position
****************************************************************/
private ["_bldpos","_altura","_unitnear","_id"];
_bldpos = _this select 0;
_unitnear = [];
_altura = [];
_id = -1;
{
_id = _id + 1;
If (typename _x == "ARRAY") then
{
If (count _x > 0) then
{
_unitnear = _x nearEntities [["CAManBase","STATICWEAPON"],0.5];
If (count _unitnear == 0) exitwith
{
_altura = [_x,_id]
};
};
};
} foreach _bldpos;
_altura;

View File

@ -0,0 +1,37 @@
/****************************************************************
File: UPSMON_Checkfreebldpos2.sqf
Author: Azroul13
Description:
Filter the building position and check if there're no unit near the position.
Parameter(s):
<--- Building positions
Returns:
Building positions
****************************************************************/
private ["_bldpos","_bldpostemp","_id","_altura","_unitnear"];
_bldpos = _this select 0;
_bldpostemp = _bldpos;
_id = -1;
_unitnear = [];
{
_id = _id + 1;
If (typename _x == "ARRAY") then
{
_altura = _x;
If (count _altura > 0) then
{
_unitnear = _altura nearEntities [["CAManBase","STATICWEAPON"],0.5];
If (count _unitnear > 0) then
{
_bldpostemp set [_id,"deletethis"];
_bldpostemp = _bldpostemp - ["deletethis"];
};
};
};
} foreach _bldpos;
_bldpostemp;

View File

@ -0,0 +1,40 @@
/****************************************************************
File: UPSMON_GetNearestBuildings.sqf
Author: Monsada
Description:
Get all nearest buildings and theirs positions.
Parameter(s):
<--- soldier to get near buildings
<--- distance to search buildings (optional, 25 by default)
<--- min floors of building (optional) if not especified min floors
Returns:
[_bld,_bldpos]
****************************************************************/
private ["_distance","_minfloors","_marker","_shuffle","_position","_bldaltura","_nbbldpos","_bldpositions","_OCercanos","_allpos"];
_distance = 25;
_minfloors = 2;
_marker = "";
_shuffle = false;
_position = _this select 0;
_bldaltura = _this select 1;
if ((count _this) > 2) then {_distance = _this select 2;};
if ((count _this) > 3) then {_marker = _this select 3;};
if ((count _this) > 4) then {_shuffle = _this select 4;};
_bldposition = [];
_OCercanos = [ (nearestObjects [_position, ["house","building"], _distance]), { [_x,_marker] call UPSMON_filterbuilding } ] call BIS_fnc_conditionalSelect;
if (_shuffle && count _OCercanos > 0) then {_OCercanos = _OCercanos call UPSMON_arrayShufflePlus;};
{
_allpos = [_x,_bldaltura] call UPSMON_SortOutBldpos;
_nbbldpos = count (_allpos select 0);
if (damage _x == 0 && _nbbldpos > 0) exitwith {_bldposition = [_x,_allpos];};
} foreach _OCercanos;
_bldposition;

View File

@ -0,0 +1,40 @@
/****************************************************************
File: UPSMON_GetNearestBuildings.sqf
Author: Monsada
Description:
Get all nearest buildings and theirs positions.
Parameter(s):
<--- soldier to get near buildings
<--- distance to search buildings (optional, 25 by default)
<--- min floors of building (optional) if not especified min floors
Returns:
[_bld,_bldpos]
****************************************************************/
private ["_distance","_minfloors","_marker","_shuffle","_position","_bldaltura","_nbbldpos","_bldpositions","_OCercanos","_allpos"];
_distance = 25;
_minfloors = 2;
_marker = "";
_shuffle = false;
_position = _this select 0;
_bldaltura = _this select 1;
if ((count _this) > 2) then {_distance = _this select 2;};
if ((count _this) > 3) then {_marker = _this select 3;};
if ((count _this) > 4) then {_shuffle = _this select 4;};
_bldpositions = [];
_OCercanos = [ (nearestObjects [_position, ["house","building"], _distance]), { [_x,_marker] call UPSMON_filterbuilding } ] call BIS_fnc_conditionalSelect;
if (_shuffle && count _OCercanos > 1) then {_OCercanos = _OCercanos call UPSMON_arrayShufflePlus;};
{
_allpos = [_x,_bldaltura] call UPSMON_SortOutBldpos;
{[_x] call UPSMON_Checkfreebldpos2} foreach _allpos;
_nbbldpos = (count (_allpos select 0)) + (count (_allpos select 1));
if (damage _x == 0 && _nbbldpos > 0) then {_bldpositions pushback [_x,_allpos];};
} foreach _OCercanos;
_bldpositions;

View File

@ -0,0 +1,34 @@
/****************************************************************
File: UPSMON_Inbuilding.sqf
Author: Azroul13
Description:
Check if the AI is in a building.
Parameter(s):
<--- Unit
Returns:
boolean
****************************************************************/
private ["_Inbuilding","_Roof","_unit","_Down"];
_unit = _this select 0;
_Inbuilding = false;
_Roof = lineIntersectsWith [getposASL _unit, [((getposASL _unit) select 0), ((getposASL _unit) select 1), ((getposASL _unit) select 2) + 20]];
If (count _Roof > 0) then
{
_Inbuilding = (_Roof select 0) isKindOf "BUILDING";
};
If (!_Inbuilding) then
{
_Down = lineIntersectsWith [getposASL _unit, [((getposASL _unit) select 0), ((getposASL _unit) select 1), ((getposASL _unit) select 2) - 20]];
if (count _Down > 0) then
{
_Inbuilding = (_Down select 0) isKindOf "BUILDING";
};
};
_Inbuilding

View File

@ -0,0 +1,26 @@
/****************************************************************
File: UPSMON_Isroof.sqf
Author: Azroul13
Description:
Check if the AI is under a roof.
Parameter(s):
<--- Unit
Returns:
boolean
****************************************************************/
private ["_Inbuilding","_Roof","_unit"];
_unit = _this select 0;
_Inbuilding = false;
_Roof = lineIntersectsWith [getposASL _unit, [((getposASL _unit) select 0), ((getposASL _unit) select 1), ((getposASL _unit) select 2) + 20]];
If (count _Roof > 0) then
{
_Inbuilding = (_Roof select 0) isKindOf "BUILDING";
};
_Inbuilding

View File

@ -0,0 +1,77 @@
/****************************************************************
File: UPSMON_SortOutBldpos.sqf
Author: Azroul13
Description:
Get All position from a building
Parameter(s):
<--- building
<--- Search parameters: get only 1st floor position or upstairs position or both ("RANDOMUP"/"RANDOMDN"/"RANDOMA")
Returns:
Array of bldpos
****************************************************************/
private ["_bld","_initpos","_height","_bldpos","_checkheight","_downpos","_roofpos","_allpos","_bldpos1","_posz"];
_bld = _this select 0;
_initpos = _this select 1;
_height = 2;
_bldpos = [_bld, 70] call BIS_fnc_buildingPositions;
_checkheight = [_bldpos] call UPSMON_gethighestbldpos;
If (_checkheight > _height) then {If (_checkheight >= 4) then {_height = _checkheight - 1.5;} else {_height = _checkheight - 0.5;};};
_downpos = [];
_roofpos = [];
_allpos = [];
{
_bldpos1 = _x;
_posz = _bldpos1 select 2;
If (_posz >= _height) then {_roofpos pushback _bldpos1;};
If (_posz < _height) then {_downpos pushback _bldpos1;};
} foreach _bldpos;
If (count _downpos > 1) then
{
_downpos = _downpos call UPSMON_arrayShufflePlus;
};
If (count _roofpos > 1) then
{
_roofpos = _roofpos call UPSMON_arrayShufflePlus;
};
If (_initpos == "RANDOMUP") then {_allpos pushback _roofpos; _allpos pushback _downpos;};
If (_initpos == "RANDOMDN") then {_allpos pushback _downpos; _allpos pushback _roofpos;};
If (_initpos == "RANDOMA") then {_allpostemp = [_downpos,_roofpos] call BIS_fnc_arrayPushStack;_allpos pushback _allpostemp;_allpos pushback [];};
if (_initpos == "RANDOMA") then
{
If (count (_allpos select 0) > 1) then
{
_allpostemp = (_allpos select 0) call UPSMON_arrayShufflePlus;
_allpos set [0,_allpostemp];
};
};
if (count _allpos > 0) then
{
if (UPSMON_Debug > 0) then
{ {
If (count _x > 0) then
{
{
_ballCover = "Sign_Arrow_Large_GREEN_F" createvehicle [0,0,0];
_ballCover setpos _x;
} foreach _x;
};
} foreach _allpos;
};
};
_allpos;

View File

@ -0,0 +1,33 @@
/****************************************************************
File: UPSMON_SortOutBldpos.sqf
Author: Azroul13
Description:
Get All position from a building
Parameter(s):
<--- building
<--- Search parameters: get only 1st floor position or upstairs position or both ("RANDOMUP"/"RANDOMDN"/"RANDOMA")
Returns:
Array of bldpos
****************************************************************/
private ["_bld","_initpos","_height","_bldpos","_checkheight","_downpos","_roofpos","_allpos","_bldpos1","_posz"];
_bld = _this select 0;
_targetpos = _this select 1;
_bldpos = [_bld, 70] call BIS_fnc_buildingPositions;
_allpos = [];
{
If ([_x,_targetpos] call UPSMON_LOS) then {_allpos pushback _x;};
} foreach _bldpos;
If (count _allpos > 1) then
{
_allpos = _roofpos call UPSMON_arrayShufflePlus;
};
_allpos;

View File

@ -0,0 +1,118 @@
/****************************************************************
File: UPSMON_UnitWatchDir.sqf
Author: Azroul13
Description:
make unit watch doors or windows.
Parameter(s):
<--- Unit
<--- Direction of the unit
<--- Building where is the unit
Returns:
nothing
****************************************************************/
private ["_see","_infront","_uposASL","_opp","_adj","_hyp","_eyes","_obstruction","_angle","_isroof"];
_unit = _this select 0;
_angle = _this select 1;
_bld = _this select 2;
_essai = 0;
_see = false;
_ouverture = false;
_findoor = false;
_wpos = [];
_dpos = [];
_watch = [];
dostop _unit;
_windowpositions = [];
_doorpositions = [];
_watchdir = [getposATL _unit,_bld modeltoworld [0,0,0]] call BIS_fnc_DirTo;
_watchdir = _watchdir + 180;
_unit setdir 0;
_unit setdir _watchdir;
sleep 0.7;
_sight = [_unit,getdir _unit, 20] call UPSMON_CanSee;
_isroof = [_unit] call UPSMON_Isroof;
If (_isroof) then
{
if (!_sight) then
{
// check window
_windowpositions = [_bld] call UPSMON_checkwindowposition;
If (count _windowpositions > 0) then
{
{
If (UPSMON_Debug > 0) then {diag_log format ["%1 %2 window %3 result %4",_unit,(ASLtoATL(eyePos _unit)),_x select 0,(ASLtoATL(eyePos _unit)) distance _x]};
If (((ASLtoATL(eyePos _unit)) vectorDistance _x) <= 2.5) exitwith {_watch = _x;};
} forEach _windowpositions;
if (count _watch > 0) then
{
_wpos = _watch;
};
};
// check for door
_doorpositions = [_bld] call UPSMON_checkdoorposition;
if (count _doorpositions == 0) then
{
_exitpos = _bld buildingExit 0;
If (count _exitpos > 0) then {_doorpositions pushback (_bld modelToWorld _exitpos)};
};
If (count _doorpositions > 0) then
{
{
//diag_log format ["%1 %2 door %3 result %4",_unit,(ASLtoATL(eyePos _unit)),_x,(ASLtoATL(eyePos _unit)) distance _x];
If (((ASLtoATL(eyePos _unit)) vectorDistance _x) <= 3) exitwith {_watch = _x;};
} forEach _doorpositions;
if (count _watch > 0) then
{
_dpos = _watch;
};
};
};
};
_unit setvariable ["UPSMON_unitdir",[_wpos,_dpos]];
If (count _dpos > 0) then {_watch = _dpos;_ouverture = true; _findoor = true;};
If (count _wpos > 0) then {_watch = _wpos;_ouverture = true;_findoor = false;};
sleep 0.1;
If (count _watch > 0) then
{
_posATL = getPosATL _unit;
_abx = (_watch select 0) - (_posATL select 0);
_aby = (_watch select 1) - (_posATL select 1);
_abz = (_watch select 2) - (_posATL select 2);
_vec = [_abx, _aby, _abz];
// Main body of the function;
_unit setdir 0;
_unit setVectorDir _vec;
_unit dowatch ObjNull;
_unit dowatch _watch;
If(UPSMON_DEBUG > 0) then
{
_ballCover2 = "Sign_Sphere25cm_F" createvehicle [0,0,0];
_ballCover2 setposATL _watch;
};
};
Sleep 0.5;
// Check if window blocking view or search direction for AI if he doesn't watch window or door.
If (!(_findoor) && !_sight) then
{
[_unit,getdir _unit,_ouverture] spawn UPSMON_WillSee;
};

Some files were not shown because too many files have changed in this diff Show More