Wiki

effect · create_faction

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Create a faction This effect is deprecated, prefer [create_faction_from_template](#create_faction_from_template) instead.
It will use the FACTION_DEFAULT_EFFECT_TEMPLATE if the Deeper Factions DLC is enabled.
### Examples

TAG = { # Creator's tag create_faction = FACTION_NAME_LOC_ID }

实战 · 配合 · 坑

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

实战用法

create_faction 常用于自定义国家路线的 mod 中,在特定国策或事件触发时让某国建立专属阵营,例如让某个原本历史上没有阵营的国家在特定条件下拉起自己的势力圈。由于官方已将其标记为 deprecated,建议仅在不启用 Deeper Factions DLC 的轻量 mod 中使用,否则应改用 create_faction_from_template

# 在国策完成效果中让该国创建新阵营
focus = {
    id = form_new_alliance
    ...
    completion_reward = {
        create_faction = NEW_ALLIANCE_NAME
    }
}

配合关系

  • [add_to_faction](/wiki/effect/add_to_faction):创建阵营后立刻邀请盟友加入,是最常见的配套操作。
  • [create_wargoal](/wiki/effect/create_wargoal):建立阵营后针对共同敌人生成战争目标,推动剧本走向。
  • [dismantle_faction](/wiki/effect/dismantle_faction):在某些分支剧情中需要先解散旧阵营再重建,常与 create_faction 配对使用。
  • [has_completed_focus](/wiki/trigger/has_completed_focus):用于判断是否满足创建阵营的前提条件,确保只在特定国策完成后才触发。

常见坑

  1. Scope 错误create_faction 只能在 COUNTRY scope 下执行,若写在 STATE 或 CHARACTER scope 中会报错或静默失败,初学者容易在嵌套块中忘记切换 scope。
  2. 本地化 ID 缺失:参数填写的是阵营名的本地化键值(如 MY_FACTION_NAME),若没有在 .yml 本地化文件中对应定义该键,游戏内会显示原始键名而非可读名称,容易被误以为脚本出错。

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

create_faction is commonly used in custom national focus tree mods to establish faction-exclusive alliances when specific focuses or events are triggered—for example, enabling a historically non-aligned nation to form its own power bloc under certain conditions. Since the developers have marked it as deprecated, it is recommended to use this command only in lightweight mods that do not enable the Deeper Factions DLC. Otherwise, you should migrate to create_faction_from_template instead.

# Create a new faction as a focus completion reward
focus = {
    id = form_new_alliance
    ...
    completion_reward = {
        create_faction = NEW_ALLIANCE_NAME
    }
}

Synergy

  • [add_to_faction](/wiki/effect/add_to_faction): Immediately invite allies to join the newly created faction. This is the most common companion operation.
  • [create_wargoal](/wiki/effect/create_wargoal): Generate war goals against mutual enemies after establishing the faction to drive the narrative forward.
  • [dismantle_faction](/wiki/effect/dismantle_faction): In certain branching narratives, you may need to dismantle an old faction before rebuilding. Often paired with create_faction.
  • [has_completed_focus](/wiki/trigger/has_completed_focus): Used to verify prerequisites for faction creation, ensuring the effect only triggers after a specific focus is completed.

Common Pitfalls

  1. Scope Errors: create_faction can only be executed under COUNTRY scope. If used within STATE or CHARACTER scope, it will error or fail silently. Beginners often forget to switch scope when nesting blocks.
  2. Missing Localization Keys: The parameter expects a localization key for the faction name (e.g., MY_FACTION_NAME). If the key is not defined in the corresponding .yml localization file, the game will display the raw key instead of a readable name, which is easily mistaken for a scripting error.