Wiki

effect · add_power_balance_value

Definition

  • Supported scope:any
  • Supported target:none

Description

adds current value of a power balance

Example:
add_power_balance_value = {
	id = power_balance_id
	value = 0.42 # this value is added to the current value of the power balance
	tooltip_side = side_id # optional - add this to tell the game to show the name of the specific side in the tooltip
}

实战 · 配合 · 坑

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

实战用法

add_power_balance_value 常见于自定义意识形态拉锯、阵营影响力博弈或外交事件结果等 mod 场景,例如当某国完成特定国策时将权力天平推向己方阵营。下面示例展示了一个国策完成后向某一侧倾斜的写法:

focus = {
    id = my_focus_push_balance
    ...
    completion_reward = {
        add_power_balance_value = {
            id = east_west_balance
            value = 0.15
            tooltip_side = western_side
        }
    }
}

配合关系

  • [add_power_balance_modifier](/wiki/effect/add_power_balance_modifier):用于在调整即时数值的同时附加持续性的每日/每周偏移修正,两者结合可实现"一次性推进 + 长期维持"的双重效果。
  • [is_power_balance_in_range](/wiki/trigger/is_power_balance_in_range):在执行推值之前先检测当前天平是否处于某个区间,避免数值溢出边界或触发不符合预期的阵营状态。
  • [is_power_balance_side_active](/wiki/trigger/is_power_balance_side_active):确认特定阵营当前是否处于激活状态后再写入数值,防止在天平尚未初始化时执行操作导致逻辑错误。
  • [remove_all_power_balance_modifiers](/wiki/effect/remove_all_power_balance_modifiers):在重置剧本或切换阶段时,先清除所有修正再重新调用本 effect 写入基准值,确保状态干净。

常见坑

  1. 忘记 id 与实际定义的 power balance 名称完全匹配id 必须与 common/power_balance/ 文件夹中对应定义文件里声明的 id 一字不差,拼写错误不会报错但效果完全不生效,调试时难以察觉。
  2. tooltip_side 并非必须填写却容易混淆显示:省略该字段时游戏会使用默认 tooltip,但若填写了一个不存在于该 power balance 定义中的 side id,tooltip 将显示空白或乱码,新手常以为是数值未生效而走弯路。

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

add_power_balance_value is commonly found in mod scenarios involving custom ideology tug-of-wars, factional influence contests, or diplomatic event outcomes—for instance, pushing the balance of power toward your faction when a nation completes a specific focus. The example below demonstrates how to tilt the scale to one side upon focus completion:

focus = {
    id = my_focus_push_balance
    ...
    completion_reward = {
        add_power_balance_value = {
            id = east_west_balance
            value = 0.15
            tooltip_side = western_side
        }
    }
}

Synergy

  • [add_power_balance_modifier](/wiki/effect/add_power_balance_modifier): Adds a persistent daily/weekly offset modifier alongside the instant value adjustment, combining both for a "one-time push + long-term maintenance" dual effect.
  • [is_power_balance_in_range](/wiki/trigger/is_power_balance_in_range): Check whether the current balance is within a specific range before executing the value adjustment, preventing numerical overflow or unintended faction state triggers.
  • [is_power_balance_side_active](/wiki/trigger/is_power_balance_side_active): Confirm that the target faction is currently active before writing values, preventing logic errors from operations executed before the balance is initialized.
  • [remove_all_power_balance_modifiers](/wiki/effect/remove_all_power_balance_modifiers): When resetting a scenario or transitioning phases, clear all modifiers first before re-applying this effect with baseline values to ensure a clean state.

Common Pitfalls

  1. Forgetting that id must exactly match the actual power balance definition name: The id must match the id declared in the corresponding definition file within the common/power_balance/ folder character-for-character. Spelling errors will not produce warnings but the effect will fail silently, making it difficult to catch during debugging.
  2. tooltip_side is optional but easily causes display confusion: Omitting this field causes the game to use a default tooltip, but if you specify a side id that doesn't exist in the power balance definition, the tooltip will display blank or corrupted text. Newcomers often mistake this for the value not taking effect and waste troubleshooting time.