Wiki

effect · remove_from_faction

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

removes specified country from faction

实战 · 配合 · 坑

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

实战用法

remove_from_faction 常用于事件驱动的外交剧本中,例如让某国因不满盟主而脱离阵营,或在内战/傀儡独立剧情里把新生国家踢出原有派系。下面的例子演示一个选项让 TAG 国自行退出所属阵营:

country_event = {
    id = my_mod.1
    title = my_mod.1.t
    desc  = my_mod.1.d

    option = {
        name = my_mod.1.a
        # 当前 scope 即为要退出阵营的国家
        remove_from_faction = THIS
    }
}

配合关系

  • [has_country_flag](/wiki/trigger/has_country_flag) — 用于在触发条件中检查该国是否已达到某个外交状态,避免重复触发退出逻辑。
  • [create_faction](/wiki/effect/create_faction) — 退出旧阵营后立即为该国创建新阵营,常见于"独立路线"剧情。
  • [add_to_faction](/wiki/effect/add_to_faction) — 与本 effect 配对使用,先把某国移出,再拉入另一个阵营,实现阵营跳槽逻辑。
  • [dismantle_faction](/wiki/effect/dismantle_faction) — 若退出后派系只剩盟主一国,可紧跟此命令将空壳派系解散,防止留下孤立的单成员阵营。

常见坑

  1. Scope 指向错误remove_from_faction 必须在被移除国家的 scope 下执行,而不是在阵营盟主的 scope 下。新手常把它写在盟主 scope 里,导致命令静默失效或移除了错误的国家。
  2. 目标国根本不在任何阵营:若目标国当前并不属于任何派系,执行此 effect 不会报错但毫无效果;建议提前用 [has_country_flag](/wiki/trigger/has_country_flag) 或配合其他外交条件(如检查是否存在阵营成员关系)做好前置判断,避免逻辑漏洞。

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_from_faction is commonly used in event-driven diplomacy scripts, such as removing a nation from a faction due to dissatisfaction with the faction leader, or ejecting a newly independent state from its original faction during civil war or puppet independence scenarios. The example below demonstrates an option that allows TAG to voluntarily withdraw from its faction:

country_event = {
    id = my_mod.1
    title = my_mod.1.t
    desc  = my_mod.1.d

    option = {
        name = my_mod.1.a
        # The current scope is the country that will leave the faction
        remove_from_faction = THIS
    }
}

Synergy

  • [has_country_flag](/wiki/trigger/has_country_flag) — Use in trigger conditions to check whether the country has reached a certain diplomatic state, preventing duplicate execution of exit logic.
  • [create_faction](/wiki/effect/create_faction) — Immediately create a new faction for the country after leaving the old one; commonly seen in "independence route" storylines.
  • [add_to_faction](/wiki/effect/add_to_faction) — Used in tandem with this effect: first remove a country, then add it to another faction to implement faction-switching logic.
  • [dismantle_faction](/wiki/effect/dismantle_faction) — If the faction is left with only the faction leader after removal, follow up with this command to disband the empty-shell faction and prevent isolated single-member factions.

Common Pitfalls

  1. Incorrect scope targeting: remove_from_faction must be executed within the scope of the country being removed, not under the faction leader's scope. Beginners often write it under the leader's scope, causing the command to silently fail or remove the wrong country.
  2. Target country is not in any faction: If the target country does not currently belong to any faction, executing this effect produces no error but has no effect; it is recommended to first verify with [has_country_flag](/wiki/trigger/has_country_flag) or combine with other diplomatic conditions (such as checking for faction membership) to perform proper pre-checks and avoid logical gaps.