Wiki

effect · add_attack

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

Adds attack skill to a character
Example: add_attack = 1

实战 · 配合 · 坑

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

实战用法

add_attack 常用于 mod 中为特定角色提供成长奖励,例如在将领完成特定战役任务后动态强化其进攻属性,或作为国家焦点/决议的奖励提升关键指挥官的能力值。该效果只能在 CHARACTER scope 下执行,因此通常需要先通过事件或焦点将 scope 切换到目标角色。

# 国家焦点奖励:强化某位将领的进攻技能
focus = {
    id = train_elite_commander
    ...
    completion_reward = {
        # 假设已通过 characters 列表定义了 GER_erwin_rommel
        GER_erwin_rommel = {
            add_attack = 2
        }
    }
}

配合关系

  • [add_defense](/wiki/effect/add_defense):进攻与防御技能通常成对调整,用于塑造一个攻守兼备或偏科型的将领形象。
  • [add_skill_level](/wiki/effect/add_skill_level):整体技能等级提升往往与单项属性增强同步使用,避免角色属性分布过于失衡。
  • [add_trait](/wiki/effect/add_trait):为将领添加特质与属性加成组合使用,可以更立体地体现某种战术风格(如同时给"进攻专家"特质和攻击加成)。
  • [attack_skill_level](/wiki/trigger/attack_skill_level):在给予加成前用触发器检查当前进攻等级,防止属性溢出或超出设计上限,做条件保护。

常见坑

  1. Scope 不正确add_attack 必须在 CHARACTER scope 下执行,直接写在 COUNTRY scope 的 completion_rewardimmediate 块中会导致脚本报错或静默失败。需要先用角色 token(如 GER_erwin_rommel = { ... })显式切换到对应角色的 scope。
  2. 对非将领角色使用:对顾问、科学家等非军事指挥官类型的角色使用该效果,即便脚本不报错,实际上也不会产生任何有意义的游戏效果,因为进攻属性只对陆/海军指挥官有意义,新手容易忽视角色类型的区别。

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

add_attack is commonly used in mods to provide growth bonuses to specific characters, such as dynamically enhancing a general's attack attribute after completing a specific campaign objective, or as a reward from national focuses/decisions to boost the capability values of key commanders. This effect can only be executed within CHARACTER scope, so it typically requires first switching scope to the target character through events or focuses.

# National focus reward: enhance a general's attack skill
focus = {
    id = train_elite_commander
    ...
    completion_reward = {
        # Assuming GER_erwin_rommel has been defined in the characters list
        GER_erwin_rommel = {
            add_attack = 2
        }
    }
}

Synergy

  • [add_defense](/wiki/effect/add_defense): Attack and defense skills are typically adjusted in pairs to create a general with balanced or specialized combat profiles.
  • [add_skill_level](/wiki/effect/add_skill_level): Overall skill level increases are often used in conjunction with individual attribute enhancements to prevent character stat distribution from becoming too imbalanced.
  • [add_trait](/wiki/effect/add_trait): Combining trait additions with attribute bonuses creates a more multidimensional representation of a specific tactical style (e.g., granting both an "Aggressive" trait and attack bonus simultaneously).
  • [attack_skill_level](/wiki/trigger/attack_skill_level): Use triggers to check current attack level before granting bonuses, preventing attribute overflow or exceeding design caps as a conditional safeguard.

Common Pitfalls

  1. Incorrect Scope: add_attack must be executed within CHARACTER scope. Writing it directly in a COUNTRY scope's completion_reward or immediate block will cause script errors or silent failures. You must first explicitly switch to the target character's scope using a character token (e.g., GER_erwin_rommel = { ... }).
  2. Using on Non-Military Characters: Applying this effect to advisors, scientists, or other non-military commander types will not produce meaningful game effects even if the script doesn't error, since attack attributes only apply to land/naval commanders. Newcomers often overlook the distinction between character types.