version 3.0
This commit is contained in:
@@ -9,30 +9,30 @@ params [
|
||||
["_distanceDispersion", 30, [0]]
|
||||
];
|
||||
|
||||
// diag_log("flakEH running");
|
||||
// diag_log(_event);
|
||||
// diag_log "[MILSIM] (ambience) flakEH running";
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH event: %1", _event];
|
||||
|
||||
_unit = _event select 0;
|
||||
// diag_log(format["i have a unit: %1", _unit]);
|
||||
// diag_log text format["[MILSIM] (ambience) flahEH vehicle: %1", _unit];
|
||||
|
||||
_projectile = _event select 6;
|
||||
// diag_log(format["i have a projectile in flight: %1", _projectile]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH projectile in flight: %1", _projectile];
|
||||
|
||||
deleteVehicle _projectile;
|
||||
// diag_log("i have deleted the projectile");
|
||||
// diag_log text "[MILSIM] (ambience) flakEH projectile deleted");
|
||||
|
||||
// diag_log(_unit weaponsTurret [0] select _primaryTurret);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH primary turret: %1", _unit weaponsTurret [0] select _primaryTurret];
|
||||
|
||||
_weapon = _unit weaponsTurret [0] select _primaryTurret;
|
||||
|
||||
_munitionConversionRate = _fullAmmoCount - _flakRoundsEvery;
|
||||
|
||||
// diag_log(format["munition count: %1", _unit ammo _weapon]);
|
||||
// diag_log(format["munition replacement at: %1", _munitionConversionRate]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH munition count: %1", _unit ammo _weapon];
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH munition replacement at: %1", _munitionConversionRate];
|
||||
|
||||
if (_unit ammo _weapon < _munitionConversionRate) then {
|
||||
_unit setAmmo [_weapon, _fullAmmoCount];
|
||||
// diag_log(format["replacing ammo count to: %1", _fullAmmoCount]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH replacing ammo count to: %1", _fullAmmoCount];
|
||||
|
||||
_targetPosition = [];
|
||||
|
||||
@@ -48,7 +48,7 @@ if (_unit ammo _weapon < _munitionConversionRate) then {
|
||||
|
||||
} else {
|
||||
_possibleTargets = _unit nearTargets _maximumDistance;
|
||||
diag_log(format["ai has %1 possible targetting solutions", count _possibleTargets]);
|
||||
diag_log text format["ai has %1 possible targetting solutions", count _possibleTargets];
|
||||
|
||||
if ((count _possibleTargets) > 0) then {
|
||||
|
||||
@@ -59,7 +59,7 @@ if (_unit ammo _weapon < _munitionConversionRate) then {
|
||||
_i = _unit aimedAtTarget [_x select 4, _weapon];
|
||||
if (_i > _hold && (_x select 3) > 0) then {
|
||||
_target = _x select 4;
|
||||
diag_log(format["setting target to %1", _target]);
|
||||
diag_log text format["setting target to %1", _target];
|
||||
_targetPosition = _x select 0;
|
||||
_hold = _i;
|
||||
};
|
||||
@@ -69,30 +69,30 @@ if (_unit ammo _weapon < _munitionConversionRate) then {
|
||||
|
||||
};
|
||||
|
||||
// diag_log(format["i have found target coordinates: %1", _targetPosition]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH target coordinates: %1", _targetPosition];
|
||||
|
||||
if ((count _targetPosition) > 0) then {
|
||||
// diag_log("calculating new projectile placement");
|
||||
// diag_log text "[MILSIM] (ambience) flakEH calculating new projectile placement";
|
||||
|
||||
_targetX = _targetPosition select 0;
|
||||
_targetY = _targetPosition select 1;
|
||||
_targetZ = _targetPosition select 2;
|
||||
|
||||
// diag_log(format["checking target altitude: %1", _targetZ]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH checking target altitude: %1", _targetZ];
|
||||
|
||||
if (_targetZ > _minimumAltitude) then {
|
||||
// diag_log("target is above minimum height, proceeding");
|
||||
// diag_log text "[MILSIM] (ambience) flakEH target is above minimum height, proceeding";
|
||||
|
||||
if !(lineIntersects [getPos _unit, _targetPosition, _unit, _target]) then {
|
||||
|
||||
// diag_log("intersection calculated");
|
||||
// diag_log text "[MILSIM] (ambience) flakEH intersection calculated";
|
||||
|
||||
_flakDistance = ((speed _target * 0.8) * (_speedDispersion / 100)) + ((_unit distance _target) * (_distanceDispersion / 500));
|
||||
|
||||
_distanceX = ((random (_flakDistance * 2)) - _flakDistance) + _targetX;
|
||||
_distanceY = ((random (_flakDistance * 2)) - _flakDistance) + _targetY;
|
||||
_distanceZ = ((random (_flakDistance * 2)) - _flakDistance) + _targetZ;
|
||||
// diag_log( format["target is distance: %1 / distance2D %2 from me, creating munition distance %3, distance2D %4 from me", _unit distance _targetPosition, _unit distance2D _targetPosition, _unit distance [_distanceX, _distanceY, _distanceZ], _unit distance2D [_distanceX, _distanceY, _distanceZ]]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH target is distance: %1 / distance2D %2 from me, creating munition distance %3, distance2D %4 from me", _unit distance _targetPosition, _unit distance2D _targetPosition, _unit distance [_distanceX, _distanceY, _distanceZ], _unit distance2D [_distanceX, _distanceY, _distanceZ]];
|
||||
_flak = createVehicle ["SmallSecondary", [_distanceX, _distanceY, _distanceZ], [], 0, "CAN_COLLIDE"];
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user