RIM-116 & Phalanx
Chaff and flares
Vanilla Arma Reforger has no infrared system at all – no heat signature, no seeker, no countermeasures. Reacting to another mod's flares without depending on it takes a name filter and two checks that are easy to miss.
There is nothing to hook into
A search across all vanilla scripts for infrared, IRSeeker,
heatSignature and ThermalSignature returns nothing. The only “flare” in vanilla
is illumination – a light source with a trajectory, not a countermeasure.
So detection checks found entities by their prefab name instead of by class. Without the other mod loaded those entities do not exist and the logic simply runs empty rather than failing to compile. The price: the emitters' heat values cannot be read this way.
Which name you match on is the whole problem
Matching "flare" is wrong. Vanilla has dozens of prefabs with “flare” in the name and
none of them is a countermeasure: hand signal flares, grenade-launcher illumination, mortar illumination, parachute
flares. With that filter, lighting up the battlefield decoyed the seeker.
| Fragment (example) | Matches | A real countermeasure? |
|---|---|---|
armament_ammo_flare | the flying decoy of an armament mod | yes |
countermeasure | a Weapons/Countermeasures/ folder, and one mod's particle-only effect | the particle is not – no physics, no heat |
flare alone | dozens of vanilla illumination prefabs | no – never use this |
Keep the fragments in an attribute, so a mod that names its countermeasures differently needs no code change.
Two checks beyond the name
A name filter alone is never enough, and both failures were silent.
The dispenser is not a decoy
A dispenser sits in the same folder as its ammunition and carries the same name fragments. Without a class check a
missile homed on the dispenser – away from the helicopter, onto a part of the same helicopter – and flares
were useless. Telling them apart by name is hopeless, because every mod names its dispenser differently. By class it is
unambiguous: a released decoy is a Projectile, a mounted dispenser never is.
bool MyAD_Seeker_OnCandidate(IEntity ent)
{
if (!Projectile.Cast(ent)) // a flying decoy is a projectile, its dispenser is not
return true;
string name = ent.GetPrefabData().GetPrefabName();
// ToLower() changes the string IN PLACE and returns nothing - copy first
string lower = name;
lower.ToLower();
if (MatchesHint(lower) && InSeekerCone(ent.GetOrigin()))
m_Found = ent;
return true;
}
Loaded ammunition is not a decoy either
The subtle one. In Reforger, ammunition is a Projectile, so a chaff bundle still sitting in its
dispenser passes the class test exactly like one in the air – but it hangs on its carrier and is therefore always
nearby. In testing, a mount followed a helicopter with its tubes for minutes and never fired, with “chaff
jamming” in the log the whole time, while the pilot had thrown nothing. Without the check, every so-equipped
aircraft would be permanently immune to radar-guided mounts.
bool MyAD_Radar_OnChaffCandidate(IEntity ent)
{
if (!Projectile.Cast(ent))
return true;
// an ejected body stands free in the world; a loaded one hangs as a child on its carrier
if (ent.GetParent())
return true;
...
}
The search radius decides whether flares are worth anything
A radius that is too small makes flares useless. At missile speed a few hundred metres pass in well under a second – between “decoyed the seeker” in the log and detonation there were tens of milliseconds. The seeker noticed the decoy and hit the target anyway. A radius that leaves the missile about a second to turn away gives the intended shape: late flares are useless, early ones work.
// Not every flare works - the susceptibility keeps the countermeasure a chance, not a guarantee.
// Graded by seeker quality: a good seeker tells target and decoy apart better.
float susceptible = Math.Clamp(m_fSusceptibility * (2.0 - m_fSeekerQuality), 0.0, 1.0);
if (Math.RandomFloat01() > susceptible)
return;
Following the decoy down
Sample the decoy position once on lock and hold it, and the seeker aims at a point in empty air at the helicopter's altitude – because a flare falls, and fast. Follow the burning flare instead. It pulls the missile down and away, which is both the point and what a real infrared seeker does: it follows the brightest source, and that source is sinking. When the flare burns out, the lock falls back onto the real target.
| Countermeasure | Effect |
|---|---|
| Flare | pulls the seeker away, by chance, scaled by seeker quality |
| Chaff | breaks the radar lock for a limited time within a radius around the target |