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

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.