Wiki

trigger · has_active_mission

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check if country has an active mission with specified ID. has_active_mission = my_test_mission

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

has_active_mission is commonly used in mission chain design to lock other options, display specific prompts, or trigger subsequent events once a mission is activated. It serves as a prerequisite check in available or trigger blocks to determine whether the player is currently in an active countdown mission, preventing duplicate triggers or enforcing mutually exclusive logic.

# In another decision's available block, prevent conflicts with ongoing missions
available = {
    NOT = { has_active_mission = my_expansion_mission }
}

Synergy

  • [activate_mission](/wiki/effect/activate_mission): The most direct partner — first use activate_mission to activate a mission, then use has_active_mission to check if that mission is still running, forming a complete "activate → monitor" loop.
  • [add_days_mission_timeout](/wiki/effect/add_days_mission_timeout): When dynamically extending a countdown timer during mission execution, use has_active_mission first to confirm the mission is active before proceeding, avoiding operations on non-existent missions.
  • [has_decision](/wiki/trigger/has_decision): These two often appear side-by-side in the same trigger block, separately checking the activation status of decisions and missions to jointly establish mutual exclusion or interlocking conditions for complex mission chains.
  • [activate_mission_tooltip](/wiki/effect/activate_mission_tooltip): Used to hint to the player "a certain mission is in progress" when available checks fail, improving UI readability in conjunction with has_active_mission.

Common Pitfalls

  1. Mission ID spelling mismatch with missions file: The value in has_active_mission must match the key name of the corresponding mission block in the missions folder exactly (case-sensitive). Misspelling the ID produces no error but always returns false, causing silent logic failure that is extremely difficult to debug.
  2. Mistaking completed missions as still "active": Once a mission times out or is completed, it no longer remains in active status, and this trigger immediately returns false. If you need to check for "previously triggered" states, use [has_country_flag](/wiki/trigger/has_country_flag) instead, setting a flag in the mission's complete_effect to persistently record the state.