Wiki

trigger · not

Definition

  • Supported scope:any
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

negates content of trigger

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

not is the most frequently used logical negation tool in mod scripts, commonly employed in scenarios like "trigger only when the player is NOT in a certain state," such as ensuring an event appears only when a nation has not yet acquired a specific flag or completed a certain condition. It can be nested within and/or to construct complex logic.

# Triggers only when the country lacks the global flag and is not in historical focus mode
trigger = {
    not = {
        has_global_flag = my_mod_event_fired
    }
    not = {
        is_historical_focus_on = yes
    }
}

Synergy

  • [and](/wiki/trigger/and)not frequently pairs with and to negate multiple conditions as a whole (equivalent to De Morgan's laws), avoiding scattered individual not statements.
  • [or](/wiki/trigger/or) — Combined with or, it builds "neither A nor B" logic, which is foundational for complex gating conditions.
  • [has_global_flag](/wiki/trigger/has_global_flag) — The archetypal negation target, used to check "a certain event has not yet fired," preventing duplicate triggers.
  • [custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip) — When the logic inside not becomes complex, wrapping it with custom_trigger_tooltip provides friendly localized tooltips and prevents UI display of confusing double-negative text.

Common Pitfalls

  1. When placing multiple sub-conditions inside not, the overall semantic is "these conditions are all true results in false" (implicit and inside), NOT "false if any one is true" — Beginners often mistakenly believe not { A B } is equivalent to "not A and not B," but it actually equals "not (A and B)." To express "not A and not B," you must write two separate not = { A } and not = { B }, or use not = { or = { A B } }.
  2. When negating numeric triggers (like check_variable) within a limit block, pay attention to boundary values — For example, not = { check_variable = { var = x value > 5 } } includes the case where x = 5, unlike the intuitive "less than 5," overlooking boundaries causes hard-to-trace logic bugs.