Wiki

effect · set_resistance

Definition

  • Supported scope:STATE
  • Supported target:any

Description

set resistance of a state. Example: set_resistance = 30

实战 · 配合 · 坑

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

实战用法

set_resistance 常用于事件或决议中将某占领州的抵抗值强制设定到特定水平,例如玩家推行怀柔政策后立即将抵抗值压低,或触发叛乱事件后将其拉高以模拟民心激变。与动态修正、占领法配合时尤为有用——在切换占领法的同时一次性将抵抗值重置到目标数值,避免过渡期数值异常。

# 在一个占领政策事件的 option 中,强制将该州抵抗值设为 30
123 = {  # 目标 STATE scope
    set_resistance = 30
}

配合关系

  • [set_occupation_law](/wiki/effect/set_occupation_law):切换占领法时往往需要同步重置抵抗值,两者组合可确保新占领法的效果从一个干净的基准值开始生效。
  • [add_compliance](/wiki/effect/add_compliance):顺从度与抵抗值互为反向指标,先用 set_resistance 锁定抵抗水平,再用 add_compliance 调整顺从度,可精确构造初始占领状态。
  • [resistance](/wiki/trigger/resistance):用作条件检查,只有当前抵抗值超过/低于阈值时才触发 set_resistance,避免在不必要的情况下反复覆盖数值。
  • [set_compliance](/wiki/effect/set_compliance):与 set_resistance 同为"强制设值"指令,在需要同时初始化顺从度与抵抗值的场景(如 mod 初始化或重大剧情节点)中成对出现。

常见坑

  1. 忽略 scope 必须是 STATE:新手容易在 COUNTRY scope 的 if 块内直接写 set_resistance = 30,导致游戏静默报错或无效执行——必须先用 123 = { … }every_controlled_state / any_state 等方式切换到对应的州 scope 后再调用。
  2. add_resistance 混淆语义set_resistance直接赋值,不论当前数值如何都会覆盖;add_resistance相对增减。在希望"压低但不低于某值"的逻辑里若错用 set_resistance,会无条件覆盖,产生意料之外的数值跳变。

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

set_resistance is commonly used in events or decisions to force the resistance level of an occupied state to a specific value. For example, you might immediately lower the resistance after implementing a conciliatory policy, or raise it after triggering a revolt event to simulate a shift in public sentiment. It's particularly useful when combined with dynamic modifiers and occupation laws—resetting the resistance to a target value when switching occupation laws allows the new policy to take effect from a clean baseline, avoiding anomalous values during transitions.

# In an option of an occupation policy event, force the state's resistance to 30
123 = {  # Target STATE scope
    set_resistance = 30
}

Synergy

  • [set_occupation_law](/wiki/effect/set_occupation_law): When switching occupation laws, you often need to synchronize and reset the resistance value. Combining these two ensures the new occupation law takes effect from a clean baseline.
  • [add_compliance](/wiki/effect/add_compliance): Compliance and resistance are inverse indicators of each other. Using set_resistance to lock the resistance level first, then add_compliance to adjust compliance, allows you to precisely construct the initial occupation state.
  • [resistance](/wiki/trigger/resistance): Used as a conditional check, set_resistance only triggers when the current resistance exceeds or falls below a threshold, preventing unnecessary repeated overwriting of values.
  • [set_compliance](/wiki/effect/set_compliance): Like set_resistance, this is a "direct assignment" command. Both appear in pairs when you need to initialize compliance and resistance simultaneously (such as in mod initialization or major story events).

Common Pitfalls

  1. Forgetting that scope must be STATE: Beginners often write set_resistance = 30 directly inside an if block within COUNTRY scope, resulting in silent errors or ineffective execution. You must first switch to the corresponding state scope using 123 = { … } or every_controlled_state / any_state before calling the command.
  2. Confusing add_resistance semantics: set_resistance is a direct assignment that overwrites the current value unconditionally, while add_resistance is relative increment/decrement. In logic where you want to "lower but not below a certain value," using set_resistance by mistake will unconditionally overwrite the value, causing unexpected jumps.