Wiki

trigger · is_power_balance_in_range

Definition

  • Supported scope:any
  • Supported target:none

Description

checks if current value power balance is within a certain range

Example:
is_power_balance_in_range = {
	id = power_balance_id
	range = power_balance_range_id
}

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

is_power_balance_in_range is commonly used to trigger events or unlock decisions in the power balance system. For example, when an ideological scale tilts toward one side within a specific range, it allows the player to activate special diplomatic options or narrative events. In custom Cold War mods, you can use it to check whether the power difference between "capitalism vs communism" falls within a critical threshold, thereby activating proxy war mechanics.

# Event option is only available when power balance falls within a specific range
available = {
    is_power_balance_in_range = {
        id = cold_war_balance
        range = tension_high_range
    }
}

Synergy

  • [power_balance_value](/wiki/trigger/power_balance_value): Directly retrieves the current power balance value, forming a complement to is_power_balance_in_range — the former is used for precise numerical comparison, while the latter is used for range checking. Combining both enables multi-stage conditional branching.
  • [power_balance_weekly_change](/wiki/trigger/power_balance_weekly_change): Determines the trend of power balance change. When combined with range detection, it can distinguish between scenarios like "currently at a high value and still rising" versus "at a high value but declining."
  • [add_power_balance_value](/wiki/effect/add_power_balance_value): After the trigger confirms the power balance is within the target range, use this effect in the effect block to further push the balance shift, implementing a "snowball mechanism" that accelerates once a critical point is reached.
  • [is_power_balance_side_active](/wiki/trigger/is_power_balance_side_active): Checks whether one side of the power balance is in an active state. When combined with range checking, it prevents executing conditional logic before the balance is initialized, avoiding script errors.

Common Pitfalls

  1. Reversed order of id and range fields or typos in field names: id corresponds to the balance system ID registered in the power_balance definition file, while range corresponds to a specific range ID within that system. These are not interchangeable and must be declared in advance in the corresponding database file. Otherwise, the game will silently ignore the condition or throw an invalid token error.
  2. Using directly in a scope where the power balance has not been activated: If the corresponding power_balance has not been activated by any focus/event in the current save, is_power_balance_in_range will always return false without any warning. It is recommended to use [is_power_balance_side_active](/wiki/trigger/is_power_balance_side_active) as a guard check first.