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
- 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.
- 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.