Wiki

effect · remove_resistance_target

Definition

  • Supported scope:STATE
  • Supported target:any

Description

removes a previously added resistance target using its id. No tooltips are generated.:
remove_resistance_target = 42

实战 · 配合 · 坑

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

实战用法

remove_resistance_target 用于在任务或决策完成后清理之前通过 add_resistance_target 动态添加的抵抗目标标记,防止游戏内存中残留无效的抵抗目标条目。典型场景是占领事件链中,当某个特殊事件触发的强化抵抗阶段结束时,通过 id 精准移除对应目标。

# 某个决策完成后,移除之前添加的特殊抵抗目标
123 = { # 以 STATE scope 执行
    remove_resistance_target = 42
}

配合关系

  • [add_resistance_target](/wiki/effect/add_resistance_target):成对使用,先用 add_resistance_target 注册目标并获得 id,事件结束后再用 remove_resistance_target 按同一 id 清除,形成完整生命周期管理。
  • [resistance_target](/wiki/trigger/resistance_target):在执行移除前用该触发器检查目标 id 是否仍然存在,避免对已不存在的目标执行移除操作导致脚本异常。
  • [cancel_resistance](/wiki/effect/cancel_resistance):常在同一执行块中配合使用,彻底终结某地区的抵抗状态时,既取消持续的抵抗逻辑,又清理掉对应的抵抗目标标记。
  • [has_active_resistance](/wiki/trigger/has_active_resistance):作为前置条件判断,确认该 STATE 当前确实处于活跃抵抗状态,再决定是否执行移除操作,逻辑更严谨。

常见坑

  1. id 来源不明确:移除时填写的 id 必须与 add_resistance_target 返回的实际 id 完全对应,新手容易硬编码一个猜测的数字(如 42)而非记录真实分配的 id,导致移除失效且不会有任何报错提示,抵抗目标将永久残留。
  2. scope 混用:该 effect 只能在 STATE scope 下执行,若写在 COUNTRY 或 CHARACTER 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

remove_resistance_target is used to clean up resistance target markers previously added via add_resistance_target after a mission or decision completes, preventing stale resistance target entries from accumulating in game memory. A typical scenario is in occupation event chains, where when a special event-triggered enhanced resistance phase ends, the corresponding target is precisely removed by id.

# After a decision completes, remove the previously added special resistance target
123 = { # Execute in STATE scope
    remove_resistance_target = 42
}

Synergy

  • [add_resistance_target](/wiki/effect/add_resistance_target): Use as a paired operation. First register the target with add_resistance_target to obtain an id, then remove it by the same id with remove_resistance_target when the event concludes, forming a complete lifecycle management.
  • [resistance_target](/wiki/trigger/resistance_target): Before executing removal, use this trigger to verify whether the target id still exists, avoiding script exceptions from attempting to remove non-existent targets.
  • [cancel_resistance](/wiki/effect/cancel_resistance): Commonly used in combination within the same execution block. When completely ending a region's resistance state, both terminate the ongoing resistance logic and clean up the corresponding resistance target marker.
  • [has_active_resistance](/wiki/trigger/has_active_resistance): Serves as a prerequisite condition to confirm the STATE is currently in active resistance state before deciding whether to execute the removal operation, making the logic more robust.

Common Pitfalls

  1. Unclear id source: The id provided when removing must exactly match the actual id returned by add_resistance_target. Beginners often hardcode a guessed number (such as 42) instead of recording the real assigned id, resulting in removal failure with no error messages, leaving the resistance target permanently orphaned.
  2. Scope confusion: This effect only executes in STATE scope. If written in execution blocks with COUNTRY or CHARACTER scope, it will not function, and debugging becomes difficult—always ensure the outer scope has switched to the target state.