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
}

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

raid_damage_units 适用于自定义突袭事件链中,根据防守方的抵抗力度或随机结果对攻击部队施加损失,例如在海盗/突袭 mod 里模拟守军还击、埋伏或防空炮火。可以在突袭结果事件的 option 块中,依据不同结果分支给予轻重不等的伤亡惩罚。

# 突袭遭遇顽强抵抗,地面部队受到固定组织度与强度损失
raid_instance_event = {
    id = my_raid.10
    hidden = yes
    immediate = {
        raid_damage_units = {
            org_damage = 30
            str_damage = 15
        }
    }
}

# 防空火力击落部分飞机(比例模式)
raid_damage_units = {
    plane_loss = 0.2
    ratio = yes
}

配合关系

  • [add_raid_history_entry](/wiki/effect/add_raid_history_entry):在施加损失后记录该次突袭的历史条目,使战报或 UI 能够反映实际伤亡情况,二者通常紧接着写在同一执行块内。
  • [raid_add_unit_experience](/wiki/effect/raid_add_unit_experience):先用 raid_damage_units 扣除损失,再用此命令给幸存部队补充经验,体现"血战得历练"的设计逻辑。
  • [hidden_trigger](/wiki/trigger/hidden_trigger):在决定是否触发损失之前,用隐藏触发器检查突袭实例的当前状态(如剩余兵力),避免对已近乎全灭的部队重复扣减。

常见坑

  1. 比例与绝对值混用:忘记写 ratio = yes 时填入 0.3 这类小数,游戏会将其解析为极小的绝对值(接近 0 点伤害),导致损失几乎不生效;需要百分比效果时务必显式加上 ratio = yes
  2. 在错误 scope 下调用:此 effect 仅在 RAID_INSTANCE scope 内有效,若误放在普通国家或省份 scope 的事件里,游戏会静默忽略或报错,新手容易因为没有错误提示而长时间找不到原因。

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.