Wiki

trigger · power_balance_value

Definition

  • Supported scope:any
  • Supported target:none

Description

compares current value of a power balance

Example:
power_balance_value = {
	id = power_balance_id
	value > 0.5 # supported operators are: >, < and =
}

实战 · 配合 · 坑

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

实战用法

power_balance_value 常用于根据势力天平的当前数值动态触发事件或解锁决议,例如当某一阵营的影响力积累到特定阈值时激活特殊选项。典型场景包括冷战类 mod 中判断"东西方影响力"是否达到临界点,从而触发代理战争或外交危机事件。

# 当势力天平值超过 0.7 时,允许某决议
available = {
    power_balance_value = {
        id = east_west_balance
        value > 0.7
    }
}

配合关系

  • [is_power_balance_in_range](/wiki/trigger/is_power_balance_in_range):配合使用可以同时检测天平值是否落在某个区间,power_balance_value 检测单向阈值,而 is_power_balance_in_range 检测双侧边界,两者互补覆盖不同判断需求。
  • [is_power_balance_side_active](/wiki/trigger/is_power_balance_side_active):在读取天平数值前先确认某一方向的势力侧处于激活状态,避免天平尚未初始化时产生意外判定。
  • [add_power_balance_value](/wiki/effect/add_power_balance_value):常用于 effect 块中,当 trigger 判定条件满足后立即修改天平值,形成"达到阈值→进一步推动天平"的连锁逻辑。
  • [has_power_balance_modifier](/wiki/trigger/has_power_balance_modifier):与数值判断配套,先确认某修正器是否存在再判断当前值,防止遗漏影响天平变动的前置条件。

常见坑

  1. id 填写错误或拼写不一致id 必须与 power_balance 定义文件中声明的 id 完全匹配,大小写敏感;若写错 id,游戏不会报错但 trigger 将永远返回 false,极难排查。
  2. 误用 >=<= 等运算符:该 trigger 仅支持 ><= 三种运算符,使用 >= 会导致脚本解析失败或被静默忽略,需要"大于等于某值"时应改用 not = { power_balance_value = { id = xxx value < 目标值 } } 来间接实现。

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

power_balance_value is commonly used to dynamically trigger events or unlock decisions based on the current value of the power balance, such as activating special options when one faction's influence accumulates to a specific threshold. Typical scenarios include Cold War-themed mods where you check whether "East-West influence" has reached a critical point, thereby triggering proxy war or diplomatic crisis events.

# Allow a certain decision when power balance exceeds 0.7
available = {
    power_balance_value = {
        id = east_west_balance
        value > 0.7
    }
}

Synergy

  • [is_power_balance_in_range](/wiki/trigger/is_power_balance_in_range): Using these together allows you to check whether the balance value falls within a specific range. power_balance_value checks single-direction thresholds, while is_power_balance_in_range checks two-sided boundaries. They complement each other to cover different judgment needs.
  • [is_power_balance_side_active](/wiki/trigger/is_power_balance_side_active): Before reading the balance value, first confirm that one side of the power faction is in an active state, avoiding unexpected judgments when the balance has not yet been initialized.
  • [add_power_balance_value](/wiki/effect/add_power_balance_value): Commonly used in effect blocks. After a trigger condition is met, immediately modify the balance value, forming a "threshold reached → further push the balance" chain logic.
  • [has_power_balance_modifier](/wiki/trigger/has_power_balance_modifier): Pair with numerical checks by first confirming whether a certain modifier exists before judging the current value, preventing you from overlooking prerequisite conditions that affect balance changes.

Common Pitfalls

  1. Incorrect id spelling or inconsistency: The id must exactly match the id declared in the power_balance definition file, and is case-sensitive. If you misspell the id, the game will not report an error but the trigger will always return false, making it extremely difficult to debug.
  2. Misusing operators like >= or <=: This trigger only supports three operators: >, <, and =. Using >= will cause script parsing to fail or be silently ignored. To achieve "greater than or equal to a certain value," use the workaround: not = { power_balance_value = { id = xxx value < target_value } }.