命令百科

trigger · advisor_can_be_fired

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

Return true if the character has an advisor role and they can be fired.
Warning: will return false if the character has no advisor role or it does not match the input slot. You should use has_advisor_role trigger first to really test the can_be_fired flag.

Examples:
some_character_scope = {
  advisor_can_be_fired = {
    slot = political_advisor # mandatory if the character has several advisor role
  }
}

some_character_scope = {
  advisor_can_be_fired = yes # or no
}

实战 · 配合 · 坑

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

实战用法

在顾问相关的 mod 场景中,此 trigger 常用于判断某个顾问角色是否可以被解雇,从而决定是否显示解雇按钮、触发相关事件,或在特定决议/事件中加以限制。例如在一个政治事件里,检测某位政治顾问能否被解雇,若可以则提供解雇选项:

some_character = {
    limit = {
        has_advisor_role = { slot = political_advisor }
        advisor_can_be_fired = {
            slot = political_advisor
        }
    }
    remove_advisor_role = { slot = political_advisor }
}

配合关系

  • [has_advisor_role](/wiki/trigger/has_advisor_role):在使用本 trigger 之前,应先用此 trigger 确认角色确实拥有对应顾问槽位,否则 advisor_can_be_fired 会直接返回 false,导致逻辑判断失效。
  • [remove_advisor_role](/wiki/effect/remove_advisor_role):确认顾问可以被解雇后,调用此 effect 实际执行解雇操作,两者形成"检查-执行"的标准配对。
  • [set_can_be_fired_in_advisor_role](/wiki/effect/set_can_be_fired_in_advisor_role):与本 trigger 形成读写关系——用此 effect 设置顾问能否被解雇的标志,再用本 trigger 读取并判断该标志。

常见坑

  1. 跳过 has_advisor_role 直接使用:若角色没有对应槽位的顾问角色,advisor_can_be_fired 会直接返回 false,而不会报错,导致逻辑静默失败。新手容易误以为 false 代表"有角色但不可解雇",实际上可能是"根本没有该角色",因此务必先用 has_advisor_role 做前置检查。
  2. 多顾问角色时省略 slot 字段:当角色同时拥有多个顾问角色时,不指定 slot 会导致结果不可预期。只有角色仅持有唯一一个顾问角色时,才可以使用简写的 advisor_can_be_fired = yes 形式。