Wiki

effect · add_state_resistance_compliance_modifier

Definition

  • Supported scope:any
  • Supported target:none

Description

Adds either a resistance or compliance modifier to a state.
Can only use modifiers from the resistance_modifiers.txt/compliance_modifiers.txt that are marked as is_dynamic = yes

#### Example

add_state_resistance_compliance_modifier = { modifier = dynamic_modifier_name state = 738 }

实战 · 配合 · 坑

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

实战用法

此 effect 常用于占领系统相关 mod,例如在傀儡政权建立或特定事件触发后,动态调整某占领州的抵抗或合规度修正,从而在游戏中模拟"镇压行动成效"或"民心归附"等叙事效果。需要注意的是,所引用的 modifier 必须事先在 resistance_modifiers.txtcompliance_modifiers.txt 中定义,并标记 is_dynamic = yes,否则效果不会生效。

# 在某事件 option 中,对指定州施加动态合规度修正
option = {
    name = pacification_event.1.a
    add_state_resistance_compliance_modifier = {
        modifier = pacification_boost_modifier
        state = 42
    }
}

配合关系

  • [remove_state_resistance_compliance_modifier](/wiki/effect/remove_state_resistance_compliance_modifier):与本命令成对使用,在修正不再需要时将其移除,避免动态修正永久堆叠导致数值异常。
  • [if](/wiki/effect/if):包裹本命令,根据当前局势(如抵抗强度、人口忠诚度变量)有条件地决定是否施加修正,提升逻辑精确性。
  • [set_variable](/wiki/effect/set_variable) / [check_variable](/wiki/trigger/check_variable):通过变量记录修正是否已被添加,配合条件判断防止重复叠加同一动态修正。
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip):在 UI 中为玩家展示该修正被添加的可读说明,因为动态修正名称本身对玩家并不直观。

常见坑

  1. modifier 未标记 is_dynamic = yes:新手常直接引用普通的抵抗/合规修正器,但此命令仅支持在对应 txt 文件中被明确标注为 is_dynamic = yes 的修正器,未标记时效果静默失败且不报错,极难排查。
  2. state 字段填写错误或遗漏state 字段必须指定一个合法的州 ID,若当前 scope 已经是某个州 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

This effect is commonly used in occupation system mods. For example, after establishing a puppet state or triggering specific events, you can dynamically adjust the resistance or compliance modifier of an occupied state, thereby simulating narrative effects such as "successful suppression operations" or "winning hearts and minds" in-game. Note that the modifier being referenced must be pre-defined in resistance_modifiers.txt or compliance_modifiers.txt and marked with is_dynamic = yes, otherwise the effect will not take effect.

# In an event option, apply a dynamic compliance modifier to a specified state
option = {
    name = pacification_event.1.a
    add_state_resistance_compliance_modifier = {
        modifier = pacification_boost_modifier
        state = 42
    }
}

Synergy

  • [remove_state_resistance_compliance_modifier](/wiki/effect/remove_state_resistance_compliance_modifier): Used in tandem with this command to remove the modifier when it is no longer needed, preventing dynamic modifiers from stacking permanently and causing numerical anomalies.
  • [if](/wiki/effect/if): Wraps this command to conditionally apply the modifier based on the current situation (such as resistance strength or population loyalty variables), improving logical precision.
  • [set_variable](/wiki/effect/set_variable) / [check_variable](/wiki/trigger/check_variable): Track whether a modifier has already been added via variables, combined with conditional checks to prevent duplicate stacking of the same dynamic modifier.
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): Display a human-readable explanation in the UI to players when this modifier is added, since the dynamic modifier name itself is not intuitive to players.

Common Pitfalls

  1. Modifier not marked with is_dynamic = yes: Newcomers often directly reference standard resistance/compliance modifiers, but this command only supports modifiers explicitly marked as is_dynamic = yes in the corresponding txt files. Without the marking, the effect fails silently without error messages, making it extremely difficult to debug.
  2. Incorrect or missing state field: The state field must specify a valid state ID. Even if the current scope is already a state scope, you still cannot omit this field—the command will not automatically inherit the current scope as the target state.