Wiki

trigger · exists

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Check if the current country exist. The country of the scope you are in. Example: DEN = { exists = yes }

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

exists is commonly used in the trigger/available blocks of country events or decisions to prevent scripts from operating on eliminated (non-existent) nations, avoiding null pointer errors or logic failures. For example, in a decision like "invite allies to join faction", first confirm the target nation still exists before executing subsequent checks:

available = {
    GER = { exists = yes }
    GER = { is_in_faction = no }
}

Synergy

  • [has_capitulated](/wiki/trigger/has_capitulated): Capitulated nations technically may still "exist"; using these together can distinguish between "exists but capitulated" and "completely annihilated" states, making logic more robust.
  • [any_allied_country](/wiki/trigger/any_allied_country): When iterating through allies, nest exists = yes as a filter condition to ensure each ally in the loop is a valid nation.
  • [annex_country](/wiki/effect/annex_country): Perform a preliminary check with exists = yes before executing annexation to prevent script errors from trying to annex non-existent country tags.
  • [country_event](/wiki/effect/country_event): Confirm a nation's existence before sending it an event, avoiding silent failures when events are sent to eliminated country tags.

Common Pitfalls

  1. Confusing "exists" with "not capitulated": exists = yes only checks whether the country tag is still registered in the game; nations that have capitulated but not been annexed still return true. If you need to exclude capitulated nations, you must additionally combine it with has_capitulated = no.
  2. Misusing in effect blocks: Newcomers sometimes place exists in effect blocks, such as directly putting it in the immediate section of a country_event, causing script parsing errors—exists is a pure trigger check and can only appear in conditional blocks.