Wiki

trigger · resistance

Definition

  • Supported scope:STATE
  • Supported target:any

Description

Compares the current resistance level of a state to a value. Example: resistance > 50

实战 · 配合 · 坑

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

实战用法

resistance 常用于占领区管理类 mod 中,在决策或事件的 available/trigger 块里判断某州的抵抗力量是否达到阈值,从而触发镇压行动、更换占领法令或解锁特定选项。例如,当抵抗值超过某一警戒线时自动弹出事件提醒玩家处理:

# 在 state scope 下,判断抵抗值是否超过警戒线
available = {
    resistance > 50
}

配合关系

  • [has_active_resistance](/wiki/trigger/has_active_resistance):先用它确认该州存在活跃抵抗网络,再用 resistance 做精确数值过滤,避免对无抵抗州做无意义判断。
  • [compliance](/wiki/trigger/compliance):抵抗与顺从度往往反向关联,同时检查两者可构造更精细的占领状态条件(如"顺从低且抵抗高"才触发)。
  • [set_occupation_law](/wiki/effect/set_occupation_law):当 resistance 触发条件满足后,在 effect 块中切换更严苛的占领法令以压制抵抗。
  • [add_resistance](/wiki/effect/add_resistance):在测试或事件中,用它手动调整抵抗值来验证 resistance 触发条件是否按预期工作。

常见坑

  1. Scope 写错位置resistance 只在 STATE scope 下有效,若写在 COUNTRY scope 的 trigger 块里会静默失败或报错,需确保外层已通过 every_state/any_neighbor_state 等迭代切换到 STATE scope。
  2. 误用等号比较:抵抗值是浮点数,直接写 resistance = 50 几乎永远不会精确命中,应始终使用 ><>=<= 进行范围比较。

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

resistance is commonly used in occupation management mods to check whether a state's resistance level exceeds a threshold within the available/trigger block of a decision or event, thereby triggering suppression actions, switching occupation laws, or unlocking specific options. For example, automatically triggering an event to alert the player when resistance surpasses a critical threshold:

# Check if resistance exceeds the alert threshold in state scope
available = {
    resistance > 50
}

Synergy

  • [has_active_resistance](/wiki/trigger/has_active_resistance): Use it first to confirm the state has an active resistance network, then use resistance for precise numeric filtering to avoid meaningless checks on states without resistance.
  • [compliance](/wiki/trigger/compliance): Resistance and compliance are often inversely related; checking both simultaneously constructs more granular occupation state conditions (e.g., trigger only when "compliance is low AND resistance is high").
  • [set_occupation_law](/wiki/effect/set_occupation_law): Once the resistance trigger condition is met, switch to stricter occupation laws in the effect block to suppress resistance.
  • [add_resistance](/wiki/effect/add_resistance): In testing or events, use it to manually adjust resistance values to verify whether the resistance trigger condition works as expected.

Common Pitfalls

  1. Scope in wrong location: resistance only works in STATE scope; placing it in a COUNTRY scope trigger block will silently fail or throw an error. Ensure the outer scope has been switched to STATE scope via every_state/any_neighbor_state or similar iteration commands.
  2. Misusing equality comparison: Resistance is a floating-point number; directly writing resistance = 50 will almost never hit the exact value. Always use >, <, >=, <= for range comparisons instead.