Files
Sarge-AI/Sarge AI Files/scripts/UPSMON/COMMON/Group/fnc/UPSMON_IsSurrending.sqf
Teh Dango 1218f04f15 2.1.1
Pushing this due to the greatly improved HC logic compared to the
current logic. This minor update includes a new variable to control kill
messages and track AI kills.
2016-04-02 12:18:10 -04:00

38 lines
914 B
Plaintext

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";
};
};
};
};
};
};
};
};