Wiki

effect · add_advisor_role

Definition

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

Description

add advisor role to character
May directly activate (aka hire) using activate = yes

Example:
add_advisor_role = {
	character = "GER_Character_Token" # optional if inside character scope
	advisor = {
		slot = air_chief
		cost = 50
		idea_token = GER_character_token_air_chief
		traits = {
			air_chief_ground_support_2
		}
		allowed = {...}
	}
	activate = yes
}

实战 · 配合 · 坑

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

实战用法

add_advisor_role 最常用于 mod 中为自定义角色(character)动态添加顾问职位,例如在国策或事件触发后让某个历史人物"解锁"成为空军总长或政治顾问。配合 activate = yes 可在赋予职位的同时立即雇用,省去玩家手动操作的步骤,适合剧情强驱动型 mod。

# 在国策完成后,给指定角色添加陆军顾问职位并立即激活
complete_national_focus = GER_militarize_economy
hidden_effect = {
    add_advisor_role = {
        character = GER_von_brauchitsch
        advisor = {
            slot = army_chief
            cost = 150
            idea_token = GER_von_brauchitsch_army_chief
            traits = {
                army_chief_offensive_2
            }
        }
        activate = yes
    }
}

配合关系

  • [remove_advisor_role](/wiki/effect/remove_advisor_role):先移除旧职位再添加新职位,用于角色"晋升"或转换顾问类型时避免槽位冲突。
  • [promote_character](/wiki/effect/promote_character):将角色从将领晋升为元帅的同时补充新的顾问身份,两者组合构成完整的角色升级流程。
  • [has_advisor_role](/wiki/trigger/has_advisor_role):在添加前检查角色是否已持有该顾问职位,防止重复添加导致脚本报错或逻辑混乱。
  • [set_can_be_fired_in_advisor_role](/wiki/effect/set_can_be_fired_in_advisor_role):添加顾问角色后立即设置该角色能否被玩家解雇,常用于剧情关键人物的锁定保护。

常见坑

  1. 在 COUNTRY scope 下忘写 character 字段:只有在 character scope 内部时才可省略 character = ...,若在国家范围的 effect 块(如国策、事件 option)中调用却不指定角色 token,脚本会静默失败且不报错,角色不会获得任何职位。
  2. idea_token 与其他 idea 命名冲突idea_token 的值在全局唯一,若与已有的 idea、国策或其他角色的 token 重名,游戏会加载覆盖或报 duplicate key 警告,导致顾问特性或费用异常,务必使用带角色名前缀的命名规范。

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_advisor_role is most commonly used in mods to dynamically assign advisor positions to custom characters—for example, allowing a historical figure to "unlock" as an air force chief or political advisor after a focus or event is triggered. Combined with activate = yes, the character is hired immediately upon role assignment, eliminating the need for manual player intervention. This is well-suited for story-driven mods.

# After focus completion, add an army advisor role to a specific character and activate immediately
complete_national_focus = GER_militarize_economy
hidden_effect = {
    add_advisor_role = {
        character = GER_von_brauchitsch
        advisor = {
            slot = army_chief
            cost = 150
            idea_token = GER_von_brauchitsch_army_chief
            traits = {
                army_chief_offensive_2
            }
        }
        activate = yes
    }
}

Synergy

  • [remove_advisor_role](/wiki/effect/remove_advisor_role): Remove an old role before adding a new one to avoid slot conflicts when a character is "promoted" or changes advisor type.
  • [promote_character](/wiki/effect/promote_character): Promote a character from general to field marshal while simultaneously adding a new advisor identity, combining both for a complete character upgrade sequence.
  • [has_advisor_role](/wiki/trigger/has_advisor_role): Check whether a character already holds the advisor role before adding it, preventing duplicate assignments that can cause script errors or logic confusion.
  • [set_can_be_fired_in_advisor_role](/wiki/effect/set_can_be_fired_in_advisor_role): Immediately set whether the newly appointed advisor character can be dismissed by the player, commonly used to lock down story-critical figures.

Common Pitfalls

  1. Forgetting the character field in COUNTRY scope: The character = ... parameter can only be omitted when inside a character scope. If called from a national-level effect block (such as a focus or event option) without specifying the character token, the script will silently fail without error, and the character will not receive any role.
  2. idea_token naming conflicts with other ideas: The idea_token value must be globally unique. If it shares a name with an existing idea, focus, or another character's token, the game will load the override or report a duplicate key warning, causing advisor traits or costs to behave unexpectedly. Always use a naming convention prefixed with the character name.