Wiki

trigger · defense_skill_level

Definition

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

Description

Compares defense skill level of a unit leader.
Example: defense_skill_level > 5

实战 · 配合 · 坑

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

实战用法

defense_skill_level 常用于判断某位将领的防御技能是否达到门槛,从而触发专属剧情、解锁特殊特质或限制某些 advisor 角色的指派。例如在自定义将领成长系统中,当防御技能超过某个值时自动奖励新特质:

# 当将领防御技能大于 4 时,给予强化防御特质
if = {
    limit = {
        defense_skill_level > 4
        is_corps_commander = yes
    }
    add_trait = { trait = defensive_doctrine_expert }
}

配合关系

  • [attack_skill_level](/wiki/trigger/attack_skill_level):常与进攻技能判断并列使用,构建"攻防均衡型"将领筛选条件,避免只偏重单一维度。
  • [has_trait](/wiki/trigger/has_trait):配合特质判断,确保触发前将领尚未持有目标特质,防止重复授予。
  • [skill](/wiki/trigger/skill):用于同时约束将领的综合技能总等级,与防御技能形成双重门槛,精确定位精英将领。
  • [add_trait](/wiki/effect/add_trait):最常见的后续 effect,在防御技能满足条件后授予防御相关特质作为奖励。

常见坑

  1. 混淆 defense_skill_leveladd_defense:前者是条件判断(trigger),后者是修改游戏状态的 effect,二者不可互换位置,不能把 defense_skill_level 写进 effect 块里使用。
  2. 忽略 scope 限制:此 trigger 仅在 CHARACTER 或 COMBATANT scope 下有效,若在国家(country)scope 下直接调用而不先切换 scope(如通过 any_army_leader),将导致条件永远不成立且不会报错,难以排查。

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

defense_skill_level is commonly used to evaluate whether a commander's defense skill meets a threshold, thereby triggering exclusive events, unlocking special traits, or restricting the assignment of certain advisor roles. For example, in a custom commander growth system, automatically grant a new trait when defense skill exceeds a certain value:

# Grant enhanced defense trait when commander's defense skill exceeds 4
if = {
    limit = {
        defense_skill_level > 4
        is_corps_commander = yes
    }
    add_trait = { trait = defensive_doctrine_expert }
}

Synergy

  • [attack_skill_level](/wiki/trigger/attack_skill_level): Often used in parallel with attack skill checks to construct "balanced offense-defense" commander filtering conditions, avoiding bias toward a single dimension.
  • [has_trait](/wiki/trigger/has_trait): Combined with trait checks to ensure the commander does not already possess the target trait before triggering, preventing duplicate trait grants.
  • [skill](/wiki/trigger/skill): Used to simultaneously constrain the commander's overall skill level, forming a dual threshold with defense skill to precisely identify elite commanders.
  • [add_trait](/wiki/effect/add_trait): The most common follow-up effect, granting defense-related traits as a reward after defense skill conditions are met.

Common Pitfalls

  1. Confusing defense_skill_level with add_defense: The former is a conditional check (trigger), while the latter is an effect that modifies game state; they cannot be used interchangeably and defense_skill_level cannot be placed inside an effect block.
  2. Ignoring scope restrictions: This trigger is only valid under CHARACTER or COMBATANT scope. If called directly under a country scope without first switching scope (such as through any_army_leader), the condition will never evaluate and produce no error, making it difficult to troubleshoot.