Hands-On Usage
raid_damage_units is suited for custom raid event chains, inflicting casualties on attacking forces based on the defender's resistance level or random outcomes. For example, in pirate/raid mods, it can simulate counterattacks by garrison troops, ambushes, or anti-aircraft fire. Within the option block of a raid resolution event, you can apply varying degrees of casualties according to different branching outcomes.
Raid encounters strong resistance; ground units suffer fixed org and strength losses
raid_instance_event = {
id = my_raid.10
hidden = yes
immediate = {
raid_damage_units = {
org_damage = 30
str_damage = 15
}
}
}
Anti-aircraft fire downs a portion of aircraft (ratio mode)
raid_damage_units = {
plane_loss = 0.2
ratio = yes
}
Synergy
[add_raid_history_entry](/wiki/effect/add_raid_history_entry): Records a history entry for the raid after casualties are applied, allowing battle reports or the UI to reflect actual losses. Both are typically written consecutively in the same execution block.
[raid_add_unit_experience](/wiki/effect/raid_add_unit_experience): First use raid_damage_units to deduct losses, then apply this command to grant surviving units experience, embodying the design logic of "hardship breeds experience."
[hidden_trigger](/wiki/trigger/hidden_trigger): Before deciding whether to trigger losses, use hidden triggers to check the current state of the raid instance (such as remaining forces), preventing duplicate reductions on units that are already nearly wiped out.
Common Pitfalls
- Mixing ratio and absolute values: Forgetting to write
ratio = yes and then entering decimals like 0.3 causes the game to parse them as extremely small absolute values (near 0 damage), rendering the losses nearly ineffective. Always explicitly add ratio = yes when percentage effects are needed.
- Calling in the wrong scope: This effect only works within
RAID_INSTANCE scope. If mistakenly placed in an event under normal country or province scope, the game will silently ignore it or throw an error. Beginners often spend considerable time troubleshooting because no error message is displayed.