Wiki

trigger · has_power_balance_modifier

Definition

  • Supported scope:any
  • Supported target:none

Description

checks if the power balance has a modifier added to it

Example:
has_power_balance_modifier = {
	id = power_balance_id
	modifier = static_modifier_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

When creating mods related to Power Balance systems, this trigger is commonly used in the available / trigger blocks of events or decisions to check whether a modifier has already been added, thereby preventing duplicate additions or implementing mutually exclusive logic. For example, after confirming that a specific bonus for a certain faction has not yet taken effect, proceed to trigger subsequent events:

available = {
    NOT = {
        has_power_balance_modifier = {
            id = my_pb_east_west
            modifier = eastern_bloc_dominance
        }
    }
}

Synergy

  • [add_power_balance_modifier](/wiki/effect/add_power_balance_modifier): The most direct companion—first use has_power_balance_modifier to check if the modifier exists, and only execute the addition if it does not, preventing duplicate stacking.
  • [remove_power_balance_modifier](/wiki/effect/remove_power_balance_modifier): Remove the corresponding modifier when conditions are met (modifier already exists), implementing a "remove if present" state-switching logic.
  • [remove_all_power_balance_modifiers](/wiki/effect/remove_all_power_balance_modifiers): When you need to reset the entire power balance state, first use the trigger to confirm that modifiers exist, then batch remove them, avoiding meaningless script calls.
  • [is_power_balance_in_range](/wiki/trigger/is_power_balance_in_range): Frequently combined with this trigger, simultaneously checking whether a specific modifier exists and whether the current power balance value is within the target range, with both conditions jointly gatekeeping the decision trigger timing.

Common Pitfalls

  1. Reversing or omitting the id and modifier fields: id refers to the unique identifier of the power balance itself, while modifier is the static modifier id mounted on it; the two have different meanings, and filling them incorrectly causes the trigger to always return false, and the game log may not report an error.
  2. Mistakenly assuming the scope is limited to a specific country: The supported scope of this trigger is any, but in actual scripts you still need to ensure that the current execution context can access the corresponding power balance definition; if the power balance is defined in a specific DLC or specific mod file and is not loaded, it will similarly fail silently rather than report an error.