Wiki

effect · raid_damage_units

Definition

  • Supported scope:RAID_INSTANCE
  • Supported target:none

Description

Damage the units performing the raid in scope (the attackers inflict losses).

Damage is applied to ground units while damage to plane is defined as the amount of planes lost.
If 'ratio = yes', then all damage / losses are applied as a fraction of the current amount.
For units, damage can be defined through one value 'damage' or separately through 'org_damage' and 'str_damage'

ex:

# Apply 50% damage to units
raid_damage_units = {
	damage = 0.5
	ratio = yes
}

# Apply 10 strength loss and 20 organization loss to units
raid_damage_units = {
	org_damage = 20
	str_damage = 10
}

# Lose 40% of all planes
raid_damage_units = {
	plane_loss = 0.4
	ratio = yes
}

# Lose 5 planes
raid_damage_units = {
	plane_loss = 5
}

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

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

  1. 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.
  2. 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.