命令百科

effect · damage_units

Definition

  • Supported scope:any
  • Supported target:any

Description

damages units for given conditions. no tooltip generated
damage_units = {
  #specify a location
  province = 42
  state = 5
  region = 5
  limit = { always = yes } #you can add a trigger for country check
  damage = 0.5 #if defined will damage both org & str damage with this amount
  org_damage = 0.5
  str_damage = 0.5
  ratio = yes #will damage a ratio damage to total org/str of unit if set
  template = "template_name" #you can limit army templates to damage  army = yes #will damage armies
  navy = yes #will damage navies
}

实战 · 配合 · 坑

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

实战用法

damage_units 常用于事件、决议或剧本触发器中模拟战场损耗、灾难或特殊战斗效果,例如流行病导致驻扎部队战斗力下降、轰炸事件造成省份内部队受损。它不生成任何工具提示,因此通常包裹在 hidden_effect 中,再搭配 custom_effect_tooltip 手动向玩家显示说明文字。

# 事件效果:某省爆发疾病,削弱当地驻军组织度与兵力
hidden_effect = {
    damage_units = {
        province = 1234
        org_damage = 0.3
        str_damage = 0.1
    }
}
custom_effect_tooltip = disease_weakens_garrison_tt

配合关系

  • [hidden_effect](/wiki/effect/hidden_effect):由于 damage_units 不生成原生提示,几乎必须嵌套在 hidden_effect 内,再另行提供说明。
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip):配合 hidden_effect 使用,向玩家展示可读的伤害说明,弥补无提示的缺陷。
  • [if](/wiki/effect/if):在造成伤害前先通过条件分支判断目标省份或地区是否满足特定情况(如是否有驻军),避免空操作或逻辑错误。
  • [any_state](/wiki/trigger/any_state):在触发条件层面确认某个 state 内存在部队后,再决定是否执行伤害,提高脚本健壮性。

常见坑

  1. 忘记 damageorg_damage/str_damage 同时存在时的覆盖关系:若同时写了 damageorg_damage/str_damage,各字段会各自独立生效,容易导致伤害叠加超出预期;建议只选一种方式填写,不要混用。
  2. 误以为会自动生成提示:新手常直接把 damage_units 写在 option 块中却发现玩家界面毫无反馈,原因正是该 effect 明确说明"no tooltip generated",必须手动配合 custom_effect_tooltip 补充说明,否则玩家完全看不到任何伤害提示。