Dynamic range for building defence ai
This commit is contained in:
parent
ccb01edcc2
commit
88676234d1
|
@ -3,27 +3,30 @@ params ["_unit", ["_sector", ""]];
|
|||
_unit setUnitPos "UP";
|
||||
_unit disableAI "MOVE";
|
||||
private _move_is_disabled = true;
|
||||
private _resume_movement = false;
|
||||
private _hostiles = 0;
|
||||
private _ratio = 0.4;
|
||||
private _range = 40;
|
||||
|
||||
while {_move_is_disabled && local _unit && alive _unit && !(captive _unit)} do {
|
||||
private _hostilecount = {alive _x && side _x == GRLIB_side_friendly} count ((getpos _unit) nearEntities [["Man"], 40]);
|
||||
|
||||
if ((_hostilecount > 0) || (damage _unit > 0.25)) then {
|
||||
_resume_movement = true;
|
||||
if !(_sector isEqualTo "") then {
|
||||
_ratio = [_sector] call F_getForceRatio;
|
||||
};
|
||||
|
||||
if (_sector != "") then {
|
||||
if (_sector in blufor_sectors) then {
|
||||
_resume_movement = true;
|
||||
};
|
||||
};
|
||||
_range = floor (linearConversion [0, 1, _ratio, 0, GRLIB_capture_size / 3 * 2, true]);
|
||||
|
||||
if (_resume_movement) then {
|
||||
if (_move_is_disabled) then {
|
||||
_move_is_disabled = false;
|
||||
_unit enableAI "MOVE";
|
||||
_unit setUnitPos "AUTO";
|
||||
};
|
||||
_hostiles = ((getPos _unit) nearEntities [["Man"], _range]) select {side _x == GRLIB_side_friendly};
|
||||
|
||||
if (_move_is_disabled &&
|
||||
{
|
||||
(_sector in blufor_sectors) ||
|
||||
{!(_hostiles isEqualTo [])} ||
|
||||
{damage _unit > 0.25}
|
||||
}
|
||||
) then {
|
||||
_move_is_disabled = false;
|
||||
_unit enableAI "MOVE";
|
||||
_unit setUnitPos "AUTO";
|
||||
};
|
||||
|
||||
if (_move_is_disabled) then {
|
||||
|
|
|
@ -196,6 +196,7 @@ class Missions
|
|||
* Tweaked: Initial FOB box doesn't have equipment in the inventory anmore.
|
||||
* Tweaked: Height check for mobile respawn now relies on `isTouchingGround` instead of z value of position.
|
||||
* Tweaked: Transport config heights on M977 vehicles. Thanks to [FishAI](https://github.com/FishAI)
|
||||
* Tweaked: AI in building now has a dynamic radius to look for enemies until they start moving again depending on blufor/opfor ratio in sector.
|
||||
* Fixed: Potato 01 was created after server restart, even if there was one saved.
|
||||
* Fixed: Missing variable `stats_blufor_teamkills_by_players`. Also no separation between by players or not by players for teamkills anymore.
|
||||
* Fixed: Factory storages could disappear randomly on save load.
|
||||
|
|
Loading…
Reference in New Issue