trigger · ai_has_role_template
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
check if the ai controlled country has any template for a specific role
ai_has_role_templateCOUNTRYnonecheck if the ai controlled country has any template for a specific role
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.
ai_has_role_template is commonly used in AI strategy or decision availability conditions to check whether an AI nation has established a corresponding division template for a specific combat role (such as armor, infantry, or marines). This determines whether to trigger related production or strategic recommendations. For example, in an AI strategy script, a decision to provide equipment subsidies may only be available once the AI has an appropriate template for that role.
# In the available block of a decision, ensure the AI possesses the corresponding role template before enabling the decision
available = {
ai_has_role_template = armor
}
[ai_has_role_division](/wiki/trigger/ai_has_role_division): Both belong to the AI unit capability detection series. ai_has_role_division checks whether the AI has already deployed divisions of a corresponding role, and is commonly chained with this trigger—first confirm the template exists, then confirm actual forces are deployed.[ai_wants_divisions](/wiki/trigger/ai_wants_divisions): Determines whether the AI intends to produce more divisions. Combined with this trigger, it constructs a composite condition of "AI has both the template and expansion intent," preventing strategies from triggering at the wrong moment.[add_ai_strategy](/wiki/effect/add_ai_strategy): After confirming the AI possesses the corresponding role template, inject specific AI strategy directives through this effect, forming a complete "condition-execution" logical loop with this trigger.[add_equipment_subsidy](/wiki/effect/add_equipment_subsidy): Provide equipment subsidies to the AI when it already has role templates, accelerating the actual formation of that role's forces. Commonly seen in alliance support or overlord nation development scripts.armor, infantry, marine, etc.). Directly entering a division template name or custom string will cause the condition to never evaluate as true and produce no error, making it extremely difficult to debug.is_ai = yes protection), the condition's behavior after the player assumes control may not work as expected. It is recommended to always pair this trigger with is_ai = yes.