Wiki

trigger · has_resistance

Definition

  • Supported scope:STATE
  • Supported target:any

Description

returns true if state has a resistance

实战 · 配合 · 坑

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

实战用法

has_resistance 常用于占领系统相关的 mod 中,用来判断某个州是否存在抵抗运动,从而触发特殊决议、事件或限制某些操作。例如,当玩家想要只对有抵抗活动的州应用镇压决议时,可以用它作为 available 的过滤条件。

# 决议:镇压抵抗运动(仅当州存在抵抗时可用)
available = {
    FROM = {
        has_resistance = yes
        is_controlled_by = ROOT
    }
}

配合关系

  • [resistance](/wiki/trigger/resistance):仅知道"有抵抗"往往不够,搭配 resistance 可进一步判断抵抗值的具体数值范围,实现分级响应逻辑。
  • [has_active_resistance](/wiki/trigger/has_active_resistance):两者区分"存在抵抗数值"与"抵抗活动实际激活",配合使用可精确区分潜伏期与爆发期。
  • [add_resistance](/wiki/effect/add_resistance) / [set_resistance](/wiki/effect/set_resistance):在 effect 块中根据 trigger 结果动态调整抵抗值,构成"判断→修改"的完整流程。
  • [cancel_resistance](/wiki/effect/cancel_resistance):当条件满足时彻底取消抵抗,常在任务完成或事件结算时与 has_resistance 配合做前置检查。

常见坑

  1. Scope 用错has_resistance 必须在 STATE scope 下调用,新手容易在国家或省份 scope 里直接写,导致脚本报错或静默失败;需要先用 every_neighbor_statecapital_scope 等切换到正确的州 scope。
  2. has_active_resistance 混淆has_resistance 只要州的抵抗值不为零就返回真,即使抵抗尚未"激活";若逻辑上需要判断抵抗已经开始对游戏产生实际影响,应改用 has_active_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

has_resistance is commonly used in occupation system-related mods to check whether a state has active resistance movements, allowing you to trigger special decisions, events, or restrict certain actions. For example, when you want to apply suppression decisions only to states with resistance activity, you can use it as a filter condition in available.

# Decision: Suppress Resistance (available only when state has resistance)
available = {
    FROM = {
        has_resistance = yes
        is_controlled_by = ROOT
    }
}

Synergy

  • [resistance](/wiki/trigger/resistance): Knowing "resistance exists" is often insufficient. Combine it with resistance to further evaluate the specific numerical range of resistance values and implement tiered response logic.
  • [has_active_resistance](/wiki/trigger/has_active_resistance): These two triggers distinguish between "resistance value exists" and "resistance activity is actually activated." Using them together allows precise differentiation between dormant and active phases.
  • [add_resistance](/wiki/effect/add_resistance) / [set_resistance](/wiki/effect/set_resistance): Dynamically adjust resistance values based on trigger results within effect blocks, forming a complete "check → modify" workflow.
  • [cancel_resistance](/wiki/effect/cancel_resistance): When conditions are met, completely eliminate resistance. Commonly paired with has_resistance as a pre-check during mission completion or event resolution.

Common Pitfalls

  1. Wrong Scope: has_resistance must be called within a STATE scope. Beginners often write it directly in country or province scopes, causing script errors or silent failures. You need to switch to the correct state scope first using commands like every_neighbor_state or capital_scope.
  2. Confusion with has_active_resistance: has_resistance returns true whenever a state's resistance value is non-zero, even if resistance hasn't yet "activated." If your logic needs to check whether resistance has actually begun affecting gameplay, use has_active_resistance instead. Otherwise, you risk triggering subsequent logic prematurely when resistance values are extremely low.