Wiki

trigger · is_character_slot

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

alias of has_advisor_role

实战 · 配合 · 坑

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

实战用法

is_character_slot 常用于检查某个角色当前是否担任特定的顾问职位槽,例如在决议或事件中判断某人是否已在某类顾问位置上,从而决定是否触发后续效果。典型场景包括:角色晋升逻辑、防止重复任命同类职位,以及在 limit 块中过滤特定顾问身份的角色。

# 示例:在事件中,仅当角色占据某顾问槽时才允许触发对话选项
option = {
    name = my_event.1.a
    trigger = {
        FROM = {
            is_character_slot = political_advisor
        }
    }
    # 后续效果...
}

配合关系

  • [has_advisor_role](/wiki/trigger/has_advisor_role)is_character_slot 本质上是其别名,两者逻辑等价,了解 has_advisor_role 的完整参数写法有助于正确使用本 trigger。
  • [is_advisor](/wiki/trigger/is_advisor):先用 is_advisor 确认角色当前处于被雇用状态,再用 is_character_slot 进一步缩小到具体职位槽,形成层次化筛选。
  • [remove_advisor_role](/wiki/effect/remove_advisor_role):条件满足(角色确实在某槽)后,可用此 effect 安全地移除其顾问职位,避免对未持有该槽的角色执行无效操作。
  • [add_advisor_role](/wiki/effect/add_advisor_role):与之配合用于"若尚未占据该槽则添加"的互斥判断逻辑,常见于动态调整顾问阵容的 mod。

常见坑

  1. scope 写错:此 trigger 必须在 CHARACTER scope 下调用,新手常在国家 scope 直接写 is_character_slot = ...,导致游戏报错或静默失效;应先通过角色引用(如 country_with_original_tag 或具名角色块)切入角色 scope 再使用。
  2. is_advisor 混淆is_advisor 只检查角色"是否正在被雇用为顾问",而 is_character_slot 检查的是其具体担任的职位槽类型,两者含义不同;仅用 is_advisor 无法区分政治顾问与军事顾问,务必根据需求选择正确的 trigger。

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

is_character_slot is commonly used to check whether a specific character currently occupies a particular advisor role slot. Typical use cases include checking in decisions or events whether a character already holds a certain advisor position, which determines whether to trigger subsequent effects. Common scenarios include: character promotion logic, preventing duplicate appointments to the same advisor type, and filtering characters with specific advisor roles within limit blocks.

# Example: In an event, only allow a dialog option to trigger if the character occupies a specific advisor slot
option = {
    name = my_event.1.a
    trigger = {
        FROM = {
            is_character_slot = political_advisor
        }
    }
    # subsequent effects...
}

Synergy

  • [has_advisor_role](/wiki/trigger/has_advisor_role): is_character_slot is essentially an alias for this trigger; both are logically equivalent. Understanding the complete parameter syntax of has_advisor_role helps ensure correct usage of this trigger.
  • [is_advisor](/wiki/trigger/is_advisor): First use is_advisor to confirm the character is currently employed, then use is_character_slot to narrow down to the specific role slot, forming a hierarchical filtering approach.
  • [remove_advisor_role](/wiki/effect/remove_advisor_role): Once the condition is met (the character indeed occupies the slot), use this effect to safely remove their advisor role, avoiding invalid operations on characters who don't hold that slot.
  • [add_advisor_role](/wiki/effect/add_advisor_role): Used in conjunction for "if not yet occupying the slot, then add" mutual exclusion logic, commonly seen in mods that dynamically adjust advisor rosters.

Common Pitfalls

  1. Incorrect scope: This trigger must be called within a CHARACTER scope. Beginners often write is_character_slot = ... directly in a country scope, causing game errors or silent failures. You must first enter character scope through character references (such as country_with_original_tag or named character blocks) before using it.
  2. Confusion with is_advisor: is_advisor only checks whether a character "is currently employed as an advisor," while is_character_slot checks the specific role slot type they occupy. These have different meanings. Using only is_advisor cannot distinguish between political advisors and military advisors; always select the correct trigger based on your requirements.