Skip to content

Commit ef29cc5

Browse files
NLAW - Improve missile behaviour (#11172)
* NLAW ammunition rework NLAW now uses a submunition penetrator * Fix AI inaccuracy * Further ammo balance * Seeker changes Seeker looks at fire LOD, explosion delayed * DA changes Direct Attack no longer shoots the penetrator (it is always downwards), but deals more damage * revert to submunitions, remove damage balancing * Remove old comment
1 parent 187db7a commit ef29cc5

File tree

3 files changed

+19
-30
lines changed

3 files changed

+19
-30
lines changed

addons/nlaw/CfgAmmo.hpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@ class ace_missileguidance_type_Nlaw;
22
class CfgAmmo {
33
class M_NLAW_AT_F;
44
class ACE_NLAW: M_NLAW_AT_F {
5-
hit = 400; // Default was 500
6-
indirectHit = 20; // Default was 15
5+
submunitionAmmo = "ACE_NLAW_Penetrator";
6+
triggerOnImpact = 0; // The shaped charge only points downwards, so don't fire it in DA mode
7+
maxSpeed = 200;
8+
typicalSpeed = 185;
9+
thrust = 400; // 400 * 0.5 == 200 - swift acceleration to expected speed
10+
thrustTime = 0.5;
11+
timeToLive = 5.6; // Time until self-destruction (1000 meters @ 200m/s when accounting for air friction)
12+
warheadName = "HEAT";
713
class ace_missileguidance: ace_missileguidance_type_Nlaw {
814
enabled = 1;
915
};
1016
};
1117

12-
// Sub ammos used in OTA mode (see fnc_seeker.sqf)
13-
class ACE_NLAW_Explosion: ACE_NLAW { // Based on FCS-Airburst, will explode right away
14-
timeToLive = 0;
15-
model = "\A3\weapons_f\empty";
16-
};
17-
class ACE_NLAW_ShapedCharge: ACE_NLAW { // Shaped charge from rocket explosion, no effects
18-
timeToLive = 1;
19-
model = "\A3\weapons_f\empty";
20-
hit = 750;
21-
indirectHit = 0;
22-
indirectHitRange = 0;
23-
explosionSoundEffect = "";
24-
explosionEffects = "";
25-
CraterEffects = "";
26-
muzzleEffect = "";
18+
class ammo_Penetrator_NLAW;
19+
class ACE_NLAW_Penetrator: ammo_Penetrator_NLAW {
20+
// 500mm of RHA pen (manufacturer claim) - vanilla has 400mm of RHA pen (caliber 26.67)
21+
// formula: typicalSpeed * caliber * 15 / 1000
22+
// -> 1000 * 33.333 * 15 / 1000 = ~500
23+
caliber = 33.333;
24+
warheadName = "HEAT";
2725
};
2826
};

addons/nlaw/functions/fnc_navigation_onFired.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if (_shooter == ACE_player) then {
5656
//_pitchChange = -10 max _pitchChange min 10;
5757

5858
((velocity _projectile) call CBA_fnc_vect2polar) params ["", "_currentYaw", "_currentPitch"];
59-
((ACE_player weaponDirection (currentWeapon ACE_player)) call CBA_fnc_vect2Polar) params ["", "_yaw", "_pitch"];
59+
((_shooter weaponDirection (currentWeapon _shooter)) call CBA_fnc_vect2Polar) params ["", "_yaw", "_pitch"];
6060

6161
TRACE_5("attackProfileStateParams",_firedLOS,_yawChange,_pitchChange,_currentPitch,_currentYaw);
6262
_navigationParams set [0, _yawChange];

addons/nlaw/functions/fnc_seeker.sqf

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,16 @@ if ((_projPos distance _launchPos) >= 20) then {
6666
#endif
6767

6868
// Limit scan to 5 meters directly down (shaped charge jet has a very limited range)
69-
private _res = lineIntersectsSurfaces [_virtualPos, (_virtualPos vectorAdd [0,0,-5]), _projectile];
69+
private _res = lineIntersectsSurfaces [_virtualPos, (_virtualPos vectorAdd [0,0,-5]), _projectile, objNull, true, 1, "FIRE", "VIEW"];
7070
if (_res isNotEqualTo []) then {
7171
(_res select 0) params ["_targetPos", "", "_target"];
7272
if ((_target isKindOf "Tank") || {_target isKindOf "Car"} || {_target isKindOf "Air"}) exitWith {
7373
TRACE_3("Firing shaped charge down",_target,_targetPos distance _virtualPos,_frameDistance);
7474
TRACE_2("",_target worldToModel (ASLToAGL _virtualPos),boundingBoxReal _target);
7575
_virtualPos = _virtualPos vectorAdd (_vectorDir vectorMultiply 1.25);
7676

77-
deleteVehicle _projectile;
78-
79-
// Damage and effects of missile exploding (timeToLive is 0 so should happen next frame)
80-
private _explosion = "ACE_NLAW_Explosion" createVehicle _virtualPos;
81-
_explosion setPosASL _virtualPos;
82-
83-
// Just damage from shaped charge
84-
private _shapedCharage = "ACE_NLAW_ShapedCharge" createVehicle _virtualPos;
85-
_shapedCharage setPosASL _virtualPos;
86-
_shapedCharage setVectorDirAndUp [[0,0,-1], [1,0,0]];
87-
_shapedCharage setVelocity [0,0,-300];
77+
_projectile setMissileTarget [_target, true];
78+
triggerAmmo _projectile;
8879

8980
_seekerStateParams set [1, true];
9081

0 commit comments

Comments
 (0)