Wiki

effect · remove_targeted_decision

Definition

  • Supported scope:STATE, COUNTRY
  • Supported target:none

Description

Removes targeted decisions or mission. 
Example: remove_targeted_decision = { target = TAG decision = decision_id_here

实战 · 配合 · 坑

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

实战用法

remove_targeted_decision 常用于 mod 中需要动态撤销针对特定目标的决策或任务的场合,例如当某个外交关系破裂、事件触发后取消正在进行的谈判决策,或者任务完成后清理不再相关的使命入口。典型场景是:玩家通过事件选项放弃某项外交行动,此时需要同时清除挂在目标国身上的对应决策。

# 在某国放弃结盟谈判时,移除针对目标国的外交决策
country_event = {
    id = my_mod.15
    option = {
        name = my_mod.15.a
        # 移除本国对 ENG 挂载的谈判决策
        remove_targeted_decision = {
            target = ENG
            decision = my_alliance_negotiation_decision
        }
    }
}

配合关系

  • [activate_targeted_decision](/wiki/effect/activate_targeted_decision):两者互为逆操作,通常在激活决策的条件不再满足时,用 remove_targeted_decision 将其撤销,形成完整的开关逻辑。
  • [has_active_mission](/wiki/trigger/has_active_mission):在 limittrigger 块中先检查目标是否真正持有对应使命/决策,再执行移除,可避免无效调用产生的日志警告。
  • [add_days_remove](/wiki/effect/add_days_remove):若只是希望决策在有限时间后自动消失,可用 add_days_remove 代替手动移除;但当需要立即且无条件清除时,remove_targeted_decision 才是正确选择,两者配合能处理不同的生命周期需求。
  • [activate_decision](/wiki/effect/activate_decision):与非目标版决策激活配合使用,可在同一 option 中先移除旧的 targeted 决策,再激活新的普通决策,实现决策状态的流畅切换。

常见坑

  1. target 填写错误导致静默失败target 必须是当前游戏中存在的国家 TAG 或合法的 STATE 引用,若目标国家已不存在或 TAG 拼写有误,游戏不会报错但决策不会被移除,新手常因此误以为脚本生效而实际上决策仍然挂载。
  2. 在错误的 scope 下执行:该 effect 需在拥有该决策的 COUNTRY 或 STATE scope 下调用,若在目标方的 scope 内执行(例如误用 every_allied_country 迭代到对方),会导致找不到决策而静默失败,务必确认执行 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_targeted_decision is commonly used in mods to dynamically revoke decisions or tasks targeted at specific nations. Typical scenarios include canceling ongoing negotiation decisions when diplomatic relations break down or after events trigger, or cleaning up mission entries that are no longer relevant upon task completion. A typical use case is when a player abandons a diplomatic action through an event option, requiring the corresponding decision attached to the target nation to be removed simultaneously.

# When a nation abandons alliance negotiations, remove the diplomatic decision targeting the recipient
country_event = {
    id = my_mod.15
    option = {
        name = my_mod.15.a
        # Remove the negotiation decision this country mounted on ENG
        remove_targeted_decision = {
            target = ENG
            decision = my_alliance_negotiation_decision
        }
    }
}

Synergy

  • [activate_targeted_decision](/wiki/effect/activate_targeted_decision): These two are inverse operations of each other. When the conditions for activating a decision no longer hold, use remove_targeted_decision to revoke it, forming complete toggle logic.
  • [has_active_mission](/wiki/trigger/has_active_mission): Check in limit or trigger blocks whether the target actually holds the corresponding mission/decision before executing removal, avoiding invalid call log warnings.
  • [add_days_remove](/wiki/effect/add_days_remove): If you only want a decision to disappear automatically after a limited time, use add_days_remove instead of manual removal. However, when immediate and unconditional removal is needed, remove_targeted_decision is the correct choice. Using both together handles different lifecycle requirements.
  • [activate_decision](/wiki/effect/activate_decision): Use in conjunction with non-targeted decision activation to remove the old targeted decision and then activate a new standard decision within the same option, enabling smooth decision state transitions.

Common Pitfalls

  1. Incorrect target specification causing silent failure: The target must be a valid nation TAG or STATE reference existing in the current game. If the target nation no longer exists or the TAG is misspelled, the game will not report an error but the decision will not be removed. Beginners often mistakenly believe the script worked when the decision actually remains mounted.
  2. Execution in the wrong scope: This effect must be called within the COUNTRY or STATE scope that owns the decision. If executed within the target's scope (for example, mistakenly using every_allied_country to iterate to the other party), it will fail silently due to not finding the decision. Always ensure the executing scope is the side that mounted the decision, not the target side.