命令百科

trigger · not_already_hired_except_as

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

not_already_hired_except_as = <slot> - For characters with several advisor roles, checks if the current character is already assigned in another advisor slot.
example: let's say a character can be a political advisor and a theorist. But they should only be hired in one role, never both at the same time.
then you may set in the advisor available trigger :
	advisor = {
		slot = political_advisor
		available = { not_already_hired_except_as = political_advisor } 
		...
	}
	advisor = {
		slot = theorist
		available = { not_already_hired_except_as = theorist } 
		...
	}

实战 · 配合 · 坑

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

实战用法

当一个角色被设计为可担任多个顾问职位时(例如"政治顾问"与"理论家"同时存在于同一角色定义中),使用此 trigger 可以防止玩家将同一角色同时雇用在两个槽位上。在自定义角色 mod 中,只要角色携带多个 advisor 块,就应在每个 available 里加上对应的检查。

character = {
    advisor = {
        slot = political_advisor
        available = {
            not_already_hired_except_as = political_advisor
        }
        traits = { smooth_talking_charmer }
        cost = 150
    }
    advisor = {
        slot = high_command
        available = {
            not_already_hired_except_as = high_command
        }
        traits = { army_logistics_2 }
        cost = 100
    }
}

配合关系

  • [is_hired_as_advisor](/wiki/trigger/is_hired_as_advisor):可作为补充检查,确认角色当前是否已以某顾问身份被雇用,与 not_already_hired_except_as 形成互补的状态验证逻辑。
  • [has_advisor_role](/wiki/trigger/has_advisor_role):用于判断角色是否定义了某个顾问角色,常在 allowed 块中搭配使用,确保角色具备该职位资质后再做唯一性检查。
  • [set_can_be_fired_in_advisor_role](/wiki/effect/set_can_be_fired_in_advisor_role):在雇用逻辑触发后控制角色能否被解雇,与可用性检查配合构成完整的顾问生命周期管理。
  • [is_advisor](/wiki/trigger/is_advisor):快速判断角色当前是否处于任意顾问激活状态,可在 limit 中搭配使用,避免冗余的雇用操作。

常见坑

  1. 忘记在每个 advisor 块单独添加:新手常误以为只需写一次,实际上每个 advisor 块的 available 都必须各自填入以自身 slot 为参数的检查,遗漏任意一个都会导致该槽位失去互斥保护,角色可被重复雇用。
  2. 将参数写成其他 slot 名not_already_hired_except_as = political_advisor 中的参数必须与当前所在 advisor 块的 slot 值一致,若误写成另一个 slot 名,逻辑将反转——角色在已担任本职时反而无法再次被选中,而在担任其他职位时却可以重复雇用。