Wiki

effect · set_power_balance

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

sets active power balance for country or sets parameters of the already active power balance

Example:
set_power_balance = {
	id = power_balance_id
	left_side = left_side_id
	right_side = right_side_id
	set_default = yes/no # default = no
	set_value = 0.5 # if used, will set the new value of the power balance
}

实战 · 配合 · 坑

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

实战用法

set_power_balance 常用于势力博弈类 mod 中,例如在国家完成某条国策或触发事件后,动态切换当前激活的权力天平,或将天平数值强制拨到某一侧以反映剧情进展。典型场景包括:内战爆发时将天平默认值推向某一派系,或在联合政府 focus 链完成后重新绑定左右阵营 ID。

# 某国完成国策后,激活新的权力天平并将初始值设为偏左侧
complete_national_focus = POL_grand_coalition
immediate = {
    set_power_balance = {
        id = pol_coalition_balance
        left_side  = reformist_bloc
        right_side = conservative_bloc
        set_default = yes
        set_value = -0.3
    }
}

配合关系

  • [has_any_power_balance](/wiki/trigger/has_any_power_balance) — 在执行 set_power_balance 之前先用此 trigger 检查该天平是否已对该国激活,避免对未激活天平写入参数导致逻辑异常。
  • [add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) — 权力天平通常搭配动态修正器共同驱动数值效果,在激活天平的同一块里一并挂载对应的 dynamic_modifier,保证视觉与逻辑同步。
  • [add_ideas](/wiki/effect/add_ideas) — 天平激活后常需要同步给予代表初始立场的 idea,二者配合描述派系权力格局的起点状态。
  • [country_event](/wiki/effect/country_event) — 天平数值被强制拨动后,往往需要立即触发一个事件向玩家说明背景,用 country_event 衔接叙事。

常见坑

  1. 忘记先在 power_balance 定义文件中声明 idset_power_balance 只能操作已在 common/power_balance/ 中定义好的天平,若 id 拼写与定义文件不一致,游戏不会报明显错误,但天平将静默失效,新手极易忽略。
  2. 在天平未激活的国家上直接设置 set_value:若该国从未通过任何途径激活过此天平,直接写 set_value 不会自动激活它;应先确保天平已激活(或同块内用 set_default = yes 初始化),再写入数值,否则设置会被丢弃。

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_power_balance is commonly used in mods featuring power struggle mechanics. It dynamically switches the active power balance for a nation after completing a focus or triggering an event, or forces the balance value to a specific side to reflect narrative progression. Typical scenarios include pushing the balance toward a faction upon civil war outbreak, or rebinding left and right faction IDs after completing a coalition government focus chain.

# After a nation completes a focus, activate a new power balance and set the initial value to lean left
complete_national_focus = POL_grand_coalition
immediate = {
    set_power_balance = {
        id = pol_coalition_balance
        left_side  = reformist_bloc
        right_side = conservative_bloc
        set_default = yes
        set_value = -0.3
    }
}

Synergy

  • [has_any_power_balance](/wiki/trigger/has_any_power_balance) — Use this trigger before executing set_power_balance to check whether the balance is already active for the nation, avoiding logic errors from writing parameters to an inactive balance.
  • [add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) — Power balances typically work in tandem with dynamic modifiers to drive numerical effects. Mount the corresponding dynamic_modifier in the same block as the balance activation to ensure visual and logical consistency.
  • [add_ideas](/wiki/effect/add_ideas) — After activating a balance, it is usually necessary to grant an idea representing the initial ideological stance simultaneously, with both combining to describe the starting state of factional power distribution.
  • [country_event](/wiki/effect/country_event) — After the balance value is forcibly shifted, an event often needs to be triggered immediately to explain the background to the player, using country_event to bridge the narrative.

Common Pitfalls

  1. Forgetting to declare the id in the power_balance definition file first: set_power_balance can only operate on balances already defined in common/power_balance/. If the id spelling does not match the definition file, the game will not produce an obvious error, but the balance will silently fail—a trap that newcomers frequently overlook.
  2. Setting set_value directly on a nation where the balance is not yet active: If a nation has never activated this balance through any means, writing set_value alone will not automatically activate it. You must first ensure the balance is activated (or initialize it with set_default = yes in the same block), then write the value; otherwise the setting will be discarded.