/*
huntunit.sqf
Parameters:
Group of the hunters
Victim to kill
If group is closer than that to the victim, the script will not send move commands to the hunting group
Minimum number of alive units in the hunting group to keep hunting the victim
Example:
[group hunter1, pilot, 200, 2]execVM"huntunit.sqf"
*/
_huntgroup = _this select 0;
_victim = _this select 1;
_engangedist = _this select 2;
_minunits = _this select 3;
_huntgroup setBehaviour "AWARE";
_huntgroup SetCombatmode "RED";
_keephunting = true;
_letsflee = false;
_leaderhunters = objNull;
while {_keephunding} do
{
_leaderhunters = leader _huntgroup;
if ((_leaderhunters distance _victim) > _engangedist) then
{
_huntgroup move getPos _victim;
};
Sleep 10;
if (!alive _victim) then {_keephunting = false};
if (({alive _x} count units _huntgroup)< _minunits) then {_keephunting = false;_letsflee = true};
};
if (_letsflee) then
{
// Add code here so that hunting group flees away, the hunting group has less units than minimum to keep hunting
};