Wiki

effect · set_politics

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

set_politics: 
ruling_party = key of new ruling ideology
elections_allowed = yes/no
optional (renames the ruling party and displays correct loc):
long_name = loc_key
name = loc_key

实战 · 配合 · 坑

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

实战用法

set_politics 常用于国家焦点、决议或事件中强制切换执政党意识形态,例如政变、革命或外交压力导致的政权更迭场景。它能一步到位地设置执政意识形态并控制选举开关,避免手动逐项调整带来的状态不一致。

# 示例:通过国家焦点触发共产主义政变
focus = {
    id = GER_communist_revolution
    ...
    completion_reward = {
        set_politics = {
            ruling_party = communism
            elections_allowed = no
            long_name = "GER_communist_party_long"
            name = "GER_communist_party"
        }
    }
}

配合关系

  • [add_popularity](/wiki/effect/add_popularity) — 切换执政党后,原执政意识形态支持率往往仍然偏低,需要同步提升新执政党的民意支持,否则游戏内显示的支持率与执政状态脱节。
  • [add_ideas](/wiki/effect/add_ideas) — 政权更迭后通常需要添加对应意识形态的国家精神或政策 idea,与 set_politics 搭配形成完整的政体切换逻辑。
  • [remove_ideas](/wiki/effect/remove_ideas) — 旧政权遗留的 idea 需要在切换后清除,与 set_politics 配合保证前后政治状态的一致性(白名单中对应 add_ideas 的反向操作,实际使用时注意命令名)。
  • [has_country_leader_ideology](/wiki/trigger/has_country_leader_ideology) — 在切换政治前用此触发器检查当前领袖意识形态,避免对已符合目标意识形态的国家重复执行,减少不必要的日志开销。

常见坑

  1. ruling_party 填写的是意识形态组 key(如 communismdemocraticfascismneutrality),而非具体派系或政党名称,新手容易误填本地化字符串或自定义派系名,导致脚本报错或静默失效。
  2. long_namename 字段填写的是本地化 key,不是直接的显示文本;若对应 key 在 .yml 本地化文件中不存在,游戏会显示原始 key 字符串而非预期名称,且不会抛出明显错误,排查困难。

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

set_politics is commonly used in national focuses, decisions, or events to forcibly switch the ruling party's ideology, such as in scenarios involving coups, revolutions, or regime changes due to diplomatic pressure. It allows you to set the ruling ideology and control the elections toggle in one step, avoiding state inconsistencies from manually adjusting individual elements.

# Example: Trigger a communist coup through a national focus
focus = {
    id = GER_communist_revolution
    ...
    completion_reward = {
        set_politics = {
            ruling_party = communism
            elections_allowed = no
            long_name = "GER_communist_party_long"
            name = "GER_communist_party"
        }
    }
}

Synergy

  • [add_popularity](/wiki/effect/add_popularity) — After switching the ruling party, the support for the previous ruling ideology often remains low. You need to simultaneously boost the popularity of the new ruling party; otherwise, the in-game displayed support rate will be out of sync with the ruling status.
  • [add_ideas](/wiki/effect/add_ideas) — After a regime change, you typically need to add corresponding ideological national spirits or policy ideas. Combining this with set_politics creates a complete political system transition logic.
  • [remove_ideas](/wiki/effect/remove_ideas) — Legacy ideas from the old regime should be removed after the switch. Used in conjunction with set_politics, this ensures political consistency before and after the transition (the inverse operation corresponding to add_ideas in the whitelist; be careful about command names when actually using it).
  • [has_country_leader_ideology](/wiki/trigger/has_country_leader_ideology) — Use this trigger to check the current leader's ideology before switching politics, avoiding redundant execution on countries that already match the target ideology and reducing unnecessary log overhead.

Common Pitfalls

  1. ruling_party takes an ideology group key (such as communism, democratic, fascism, neutrality), not a specific faction or party name. Newcomers often mistakenly fill in localization strings or custom faction names, resulting in script errors or silent failures.
  2. The long_name and name fields take localization keys, not direct display text. If the corresponding key does not exist in the .yml localization file, the game will display the raw key string instead of the expected name, and will not throw an obvious error, making troubleshooting difficult.