Wiki

trigger · has_template_majority_unit

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check if country has a division template that is majority of specific unit

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_template_majority_unit is commonly used to trigger specific events or decisions based on the primary unit type in a nation's existing division templates. For example, you can check whether a country primarily deploys armor units to unlock tank-related focuses or decisions. It can also be used in AI strategy constraints to confirm that a nation has completed a specific unit composition direction before allowing subsequent commands to execute.

# In the available block of a decision, check if the country has a template with armor as the majority unit type
available = {
    has_template_majority_unit = {
        unit = armor
    }
}

Synergy

  • [has_army_size](/wiki/trigger/has_army_size): First use has_army_size to confirm the country possesses a sufficient number of troops, then use this trigger to evaluate the unit type composition of those troops. Combining both provides a more precise assessment of military capability direction.
  • [any_country_division](/wiki/trigger/any_country_division): Can be used together in the same condition block. any_country_division performs detailed checks on whether specific divisions meet certain attributes, complementing this trigger with both macro and micro perspectives.
  • [add_tech_bonus](/wiki/effect/add_tech_bonus): When this trigger returns true (the country indeed has a certain unit type as primary), grant corresponding tech bonuses for that unit type in the effect block, forming a complete logical chain of "detect unit composition → reward specialization direction".
  • [ai_has_role_template](/wiki/trigger/ai_has_role_template): Also a template-focused judgment trigger that can be used alongside this one. One evaluates AI template roles while the other checks unit type proportions within templates, combining them prevents conditions from becoming too permissive.

Common Pitfalls

  1. Confusing "template primary unit" with "national fleet primary unit": This trigger checks unit type proportions at the division template level, not statistics across all deployed divisions nationwide. Beginners often mistakenly assume that equipping the nation with large quantities of a certain unit type will return true, but in reality a template definition with that unit type as the majority must exist for the trigger to fire.
  2. Forgetting this trigger only works under COUNTRY scope: If nested within condition blocks under STATE or CHARACTER scope, the script will not produce a hard error but the logic will never execute. When debugging, scope issues are easily overlooked.