Wiki

trigger · meta_trigger

Definition

  • Supported scope:STATE, COUNTRY, CHARACTER, COMBATANT, ACE, STRATEGIC_REGION, OPERATION, INDUSTRIAL_ORG, PURCHASE_CONTRACT, RAID_INSTANCE, SPECIAL_PROJECT, FACTION
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

meta triggers can be used for building triggers from strings and running them. following example will test if Germany has 42 pp:
meta_trigger = {
    text = {
        [COUNTRY] = {
            political_power > [POW]
        }
    }
    COUNTRY = "GER"
    POW = 42
    debug = no #set to yes if you want to see what game actually executes
}

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

meta_trigger is ideal for constructing dynamic conditions in generic template scripts—for example, building a reusable judgment framework for "any country reaching a certain threshold," or dynamically concatenating country tags within a scripted_trigger based on variables without hardcoding repetitive logic for each nation. The following example checks whether a country specified by a variable possesses a particular technology:

# Check if the country pointed to by TARGET_TAG has researched TARGET_TECH
meta_trigger = {
    text = {
        [NATION] = {
            has_tech = [TECH]
        }
    }
    NATION = "GER"
    TECH = "infantry_weapons2"
    debug = no
}

Synergy

  • [hidden_trigger](/wiki/trigger/hidden_trigger): Wrapping meta_trigger inside hidden_trigger prevents dynamically constructed conditions from exposing themselves in hard-to-read form within localization tooltips, keeping the UI clean.
  • [any_country_with_core](/wiki/trigger/any_country_with_core): Often paired with meta_trigger for scenario traversal; when you need to execute parameterized judgments on each member of a dynamic set, nesting the two together dramatically reduces redundant code.
  • [has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier): The existence of dynamic modifiers often depends on runtime variables; using it alongside meta_trigger allows the conditions for checking dynamic modifiers themselves to be parameterized, all driven uniformly by string templates.

Common Pitfalls

  1. Placeholder casing must match exactly: The [COUNTRY] in the text block and the assignment key COUNTRY = below must match letter-for-letter. Any case difference will cause the substitution to fail silently, the condition will always return false, and no obvious error will be raised.
  2. The text block contains triggers for the target scope, not the current scope: Beginners often write judgment logic for the outer scope directly into text, forgetting that [COUNTRY] = { ... } has already switched the scope, resulting in executing conditions on the wrong object and producing completely unexpected logic results.