Hands-On Usage
When creating Power Balance mods, you often need to decide whether to trigger events, unlock decisions, or display AI logic branches based on whether a particular side is active. For example, you might block certain options when the player's ideological struggle hasn't reached the activation threshold, or confirm in an available block that a side is truly active before allowing related operations to execute.
# This decision is only selectable when the "left_wing_side" is active
decision_example = {
available = {
is_power_balance_side_active = {
id = ideology_struggle
side = left_wing_side
}
}
}
Synergy
[is_power_balance_in_range](/wiki/trigger/is_power_balance_in_range): Typically use is_power_balance_side_active first to confirm a side is activated, then use is_power_balance_in_range to check whether the current value falls within the expected range. These two triggers combine to form complete power balance condition checks.
[has_power_balance_modifier](/wiki/trigger/has_power_balance_modifier): After the activation status check passes, you often need to further confirm whether that side has the specified modifier attached. The two triggers are typically nested within the same and block.
[add_power_balance_value](/wiki/effect/add_power_balance_value): In effect blocks, confirm the side is active before executing value changes, avoiding script errors from writing values to inactive sides.
[add_power_balance_modifier](/wiki/effect/add_power_balance_modifier): Combined with activation checks, only stack modifiers when the side is active, preventing modifiers from being incorrectly applied to dormant sides.
Common Pitfalls
- Mixing up or reversing
id and side: id corresponds to the identifier of the entire power balance system, while side is the identifier of a specific side within that system. They come from different definition levels. Filling them incorrectly will cause the trigger to always return false without error, making it extremely difficult to debug.
- Misusing the trigger in scopes where the power balance system is undefined: Although this trigger supports
any scope, if the id you reference doesn't correspond to a power balance system defined in common/power_balance/, or the file hasn't been loaded correctly, the trigger silently fails. Beginners often mistakenly assume the logic is wrong rather than the file is missing.