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

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

average_stats 常用于根据将领的综合能力均值动态筛选精英将领,例如在特殊任务事件或 on_action 里判断某位指挥官是否"够格"触发专属剧情或获得奖励特质。它也适合在 advisor/role 的 available 块中限制高阶职位只对全面属性均衡的将领开放,而非只看单一技能。

# 示例:均值超过 3 才能触发特殊晋升事件
character_event = {
    id = my_mod.1
    trigger = {
        is_corps_commander = yes
        average_stats > 3
    }
    ...
}

配合关系

  • [skill](/wiki/trigger/skill)skill 反映将领总技能等级,与 average_stats 联用可同时限制"总级别高且各项属性均衡",避免单项偏科的将领通过筛选。
  • [has_trait](/wiki/trigger/has_trait) — 配合特质检查,可构建"拥有某特质 均值达标"的复合条件,用于精细化将领事件触发逻辑。
  • [add_skill_level](/wiki/effect/add_skill_level) — 常作为 average_stats 检查通过后的奖励效果,给满足均值门槛的将领进一步提升等级。
  • [attack_skill_level](/wiki/trigger/attack_skill_level) — 与 average_stats 组合可区分"总体均衡"与"特定属性突出"两种风格的将领,用于分支事件选择。

常见坑

  1. 误用比较符方向:新手有时写成 average_stats < 10 想筛选"弱将领"却忘记该 trigger 是浮点均值而非整数,导致阈值设置与预期不符;建议先用日志或调试模式确认实际均值范围再定阈值。
  2. 在非将领 scope 下调用average_stats 仅在 CHARACTERCOMBATANT scope 下有效,若在 countrystate scope 里误用,游戏不会报错但条件永远不满足,排查时极易被忽略。

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.