Wiki

trigger · has_active_resistance

Definition

  • Supported scope:STATE
  • Supported target:any

Description

returns true if state has an active resistance (above zero)

实战 · 配合 · 坑

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

实战用法

has_active_resistance 常用于占领系统相关 mod 中,当你想在特定州存在活跃抵抗运动时触发事件、限制决议可用性或解锁特殊应对措施。例如,可以用它来阻止玩家在抵抗未平息前执行某项安抚政策:

available = {
    NOT = { has_active_resistance = yes }
}

配合关系

  • [resistance](/wiki/trigger/resistance):先用 resistance 检查抵抗值的具体数值,再用 has_active_resistance 做简单的有/无判断,两者组合可以精确分层处理不同抵抗烈度的逻辑。
  • [compliance](/wiki/trigger/compliance):抵抗与顺从度互为消长,配合检查顺从度能更全面地评估占领状态,避免逻辑遗漏。
  • [add_resistance](/wiki/effect/add_resistance):当条件满足时向该州添加抵抗值,是"检测到抵抗 → 进一步激化"事件链的常见配对。
  • [set_occupation_law](/wiki/effect/set_occupation_law):在检测到活跃抵抗后切换占领法律,是镇压或安抚逻辑的典型后续 effect。

常见坑

  1. 混淆 scopehas_active_resistance 必须在 STATE scope 下使用,新手常在 COUNTRY scope 的 trigger 块中直接写,导致脚本报错或静默失效;需要先用 any_state / every_state 等切换到州 scope。
  2. 忽略"严格大于零"的含义:该 trigger 仅在抵抗值严格高于 0 时返回真,若你的逻辑需要区分"恰好为 0"与"略高于 0"的边界情况,应额外配合 [resistance](/wiki/trigger/resistance) 设置精确阈值,而不能单靠此 trigger 做精细数值判断。

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

has_active_resistance is commonly used in occupation-system-related mods. You can use it to trigger events, restrict decision availability, or unlock special countermeasures when active resistance exists in a specific state. For example, you can prevent players from executing certain appeasement policies before resistance is suppressed:

available = {
    NOT = { has_active_resistance = yes }
}

Synergy

  • [resistance](/wiki/trigger/resistance): Use resistance first to check the exact resistance value, then use has_active_resistance for simple yes/no judgments. Combining both allows precise layered handling of different resistance intensities.
  • [compliance](/wiki/trigger/compliance): Resistance and compliance are inversely related. Checking compliance alongside this trigger provides a more comprehensive assessment of occupation status and prevents logical gaps.
  • [add_resistance](/wiki/effect/add_resistance): When conditions are met, add resistance to the state. This is a common pairing in event chains like "detected resistance → further escalation".
  • [set_occupation_law](/wiki/effect/set_occupation_law): After detecting active resistance, switch occupation law. This is a typical follow-up effect in suppression or appeasement logic.

Common Pitfalls

  1. Confusing scope: has_active_resistance must be used under STATE scope. Beginners often write it directly in trigger blocks under COUNTRY scope, causing script errors or silent failures. You need to switch to state scope first using any_state / every_state and similar constructs.
  2. Misunderstanding the "strictly greater than zero" condition: This trigger returns true only when resistance is strictly greater than 0. If your logic needs to distinguish between "exactly 0" and "slightly above 0" boundary cases, use [resistance](/wiki/trigger/resistance) to set precise thresholds instead of relying solely on this trigger for fine-grained numeric judgments.