Wiki

trigger · power_balance_weekly_change

Definition

  • Supported scope:any
  • Supported target:none

Description

compares current total weekly change of a power balance

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

实战 · 配合 · 坑

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

实战用法

power_balance_weekly_change 常用于势力均衡(Power Balance)系统的动态事件触发,例如当某一方的每周变化量超过阈值时,触发相应的外交事件或特殊决议。在冷战题材 mod 中,可用它判断"意识形态天平"是否正在快速向某侧倾斜,从而给玩家提供干预机会。

# 若每周变化量大于 0.3,触发"局势急剧升温"事件
trigger = {
    power_balance_weekly_change = {
        id = cold_war_balance
        value > 0.3
    }
}

配合关系

  • [power_balance_value](/wiki/trigger/power_balance_value):先用 power_balance_value 检查当前绝对值所处区间,再用本 trigger 判断变化趋势,两者结合可精确捕捉"正处于极端值且仍在快速偏移"的危险状态。
  • [is_power_balance_in_range](/wiki/trigger/is_power_balance_in_range):配合使用可区分"尚在安全范围内但变化加速"与"已越界"两种情形,写出层次分明的条件判断。
  • [add_power_balance_modifier](/wiki/effect/add_power_balance_modifier):当 weekly change 触发条件成立后,在 effect 块里用此命令施加修正值,形成"检测异常→施加抑制修正"的完整闭环逻辑。
  • [power_balance_daily_change](/wiki/trigger/power_balance_daily_change):与日变化量 trigger 对比使用,可判断势力均衡的短期波动与中期趋势是否一致,避免因单日脉冲误触发。

常见坑

  1. 运算符写法错误:本 trigger 仅支持 ><= 三种运算符,不支持 >=<=,新手容易照搬普通 check_variable 的习惯写成 value >= 0.5,导致脚本解析失败或判断逻辑静默出错。
  2. 忽略正负方向含义:weekly change 的正负代表势力均衡向哪一侧移动,直接写 value > 0 只能捕捉"向正侧偏移"的情形;若需检测"任意方向的快速变化",必须分两个条件块分别判断正值和负值,用 OR 包裹,不能用绝对值简写。

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_weekly_change is commonly used in the Power Balance system to dynamically trigger events, such as launching diplomatic events or special decisions when one side's weekly change exceeds a threshold. In Cold War-themed mods, it can be used to detect whether the "ideological scale" is rapidly tilting toward one side, providing players with intervention opportunities.

# If weekly change is greater than 0.3, trigger the "Situation Rapidly Escalates" event
trigger = {
    power_balance_weekly_change = {
        id = cold_war_balance
        value > 0.3
    }
}

Synergy

  • [power_balance_value](/wiki/trigger/power_balance_value): First use power_balance_value to check the current absolute value range, then use this trigger to judge the trend. Combined together, they can precisely capture the dangerous state of "currently at extreme values and still rapidly shifting."
  • [is_power_balance_in_range](/wiki/trigger/is_power_balance_in_range): Using in combination allows you to distinguish between "still within safe range but acceleration increasing" and "already out of bounds," enabling layered and well-structured conditional logic.
  • [add_power_balance_modifier](/wiki/effect/add_power_balance_modifier): After the weekly change trigger condition is met, use this command in the effect block to apply modifiers, forming a complete closed-loop logic of "detect anomaly → apply suppression modifier."
  • [power_balance_daily_change](/wiki/trigger/power_balance_daily_change): Compare with daily change triggers to determine whether the power balance's short-term fluctuations and medium-term trends are consistent, avoiding accidental triggers caused by single-day spikes.

Common Pitfalls

  1. Incorrect operator syntax: This trigger only supports three operators: >, <, and =. It does not support >= or <=. Beginners often apply the habit from regular check_variable syntax and write value >= 0.5, resulting in script parsing failure or silent logic errors.
  2. Ignoring the positive/negative directional meaning: The sign of weekly change indicates which side the power balance is moving toward. Writing only value > 0 can only capture "shifting toward the positive side." To detect "rapid changes in any direction," you must use two separate condition blocks to judge positive and negative values respectively, wrapped with OR. You cannot use absolute value shorthand.