Wiki

trigger · average_stats

Definition

  • Supported scope:CHARACTER, COMBATANT
  • Supported target:none

Description

Compares the average stats for a unit leader.
Example: average_stats > 10

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

average_stats is commonly used to dynamically filter elite commanders based on their overall attribute average, such as within special mission events or on_action blocks to determine whether a specific commander is "qualified" to trigger exclusive storylines or earn reward traits. It is also suitable for use in the available block of advisor/role assignments to restrict high-level positions only to commanders with well-balanced attributes across the board, rather than relying on a single skill.

# Example: only trigger special promotion event if average exceeds 3
character_event = {
    id = my_mod.1
    trigger = {
        is_corps_commander = yes
        average_stats > 3
    }
    ...
}

Synergy

  • [skill](/wiki/trigger/skill)skill reflects the commander's total skill level; when used together with average_stats, you can enforce both "high total level and balanced attributes," preventing one-sided specialists from passing the filter.
  • [has_trait](/wiki/trigger/has_trait) — combined with trait checks, allows constructing compound conditions such as "possesses a specific trait and meets the average threshold," enabling fine-grained control over commander event trigger logic.
  • [add_skill_level](/wiki/effect/add_skill_level) — commonly serves as a reward effect after average_stats validation passes, further increasing the level of commanders meeting the average threshold.
  • [attack_skill_level](/wiki/trigger/attack_skill_level) — in combination with average_stats, can distinguish between "overall balanced" and "specific attribute standout" commander archetypes, useful for branching event choices.

Common Pitfalls

  1. Incorrect comparison operator direction: Beginners sometimes write average_stats < 10 intending to filter "weak commanders" but forget that this trigger represents a floating-point average rather than an integer, causing the threshold to mismatch expectations; it is recommended to first verify the actual average range via logs or debug mode before setting the threshold.
  2. Invoking outside a commander scope: average_stats is only valid within CHARACTER or COMBATANT scope; if mistakenly used in country or state scope, the game will not error but the condition will never be satisfied, making it extremely easy to overlook during troubleshooting.