DeathWeapon
As a concept
When some units are destroyed they explode, potentially damaging surrounding objects. This effect is achieved in-game by setting Explodes=yes on the unit - this tells the game to fire a weapon at the cell previously occupied by the destroyed unit. See the flags below for how that 'death weapon' is determined.
As a flag
| Flag: | DeathWeapon |
| File(s): | rules(md).ini |
| Values: | Strings: Normal text. (Limited to: Weapons) |
| Default: | none for [CombatDamage],
First is the current primary weapon; if it does not exist, then use [CombatDamage]→DeathWeapon for TechnoType. |
| Applicable to: | CombatDamage, TechnoTypes:
AircraftTypes, BuildingTypes, InfantryTypes and VehicleTypes |
Specifies the death weapon↑ to use when a unit with Explodes=yes set or with a current primary weapon with Suicide=yes is destroyed.
DeathWeapon on the unit overrides any other method for determing the death weapon to use.
Notes
In fact, this weapon is also used when air units crash[1] and hit the ground. This replaces the behavior of playing the Explosion animation for the second time upon hitting the ground.
- For units with Locomotor={92612C46-F71F-11d1-AC9F-006008055BB5} (Jumpjet), this also requires them to have BalloonHover=yes.
- Because aircraft using Locomotor=Jumpjet will fall to the ground and get stuck in an abnormal state and never die, thus not triggering the weapon.
- Regardless of whether the Locomotor is Jumpjet or Fly, and whether this locomotive is the unit's own Locomotor attribute or temporarily granted by a warhead with IsLocomotor=yes, if the unit is destroyed on the ground rather than in the air, then this death weapon will not be triggered.
The death weapon triggered by the above method does not conflict with Explodes=yes; they work together.
Bugs/Side-Effects/Unexpected Limitations
Because in vanilla, units with a death process can die again during the death process, for units with Explodes=yes that can trigger the weapon by crashing, they will explode once immediately after dying in the air, and may explode again immediately upon landing with probability; if they land on large buildings, they may die several more times, introducing multiple full death explosions, and then explode once more when the entity is actually removed upon landing.
- After the fix in Phobos Build 12, Explodes=yes will only explode once when dying in the air, and units that can trigger the weapon by crashing will explode once more additionally upon landing.
Footnotes
- ↑ The fact that units can have a crash process and collide with the ground indicates that they were originally in the air and can crash.
- Even if by using a warhead with IsLocomotor=yes to tow a unit, it can have a landing process and collide with the firer, destroying both, yet this situation cannot trigger death weapon; you need to explicitly set Crashable=yes.