trigger · is_character
Definition
- Supported scope:
CHARACTER - Supported target:
none
Description
Checks whether the character in scope matches the character in input
is_characterCHARACTERnoneChecks whether the character in scope matches the character in input
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
is_character 常用于角色专属事件或决议中,确保只对特定角色触发效果,例如在将领死亡事件或顾问招募逻辑中精确匹配目标人物。也可在 limit 块内筛选出唯一角色后再执行后续操作,避免逻辑误伤其他角色。
# 某个事件选项:仅当当前角色是指定将领时才移除特定特质
option = {
trigger = {
is_character = GER_erwin_rommel
}
remove_unit_leader_trait = ill_supplied
}
[has_trait](/wiki/trigger/has_trait):先用 is_character 锁定特定角色,再用 has_trait 检查其是否持有某个特质,实现"对某人且满足某条件"的复合判断。[is_field_marshal](/wiki/trigger/is_field_marshal):与 is_character 组合,确认该角色既是指定人物又担任元帅职位,常用于晋升或剧情解锁。[remove_unit_leader_trait](/wiki/effect/remove_unit_leader_trait):条件确认角色身份后执行特质移除,保证效果精准作用于目标人物而非同 scope 下的其他角色。[set_character_flag](/wiki/effect/set_character_flag):配合 is_character 对特定角色打旗标,用于追踪该角色是否已经历过某条剧情分支。country 或 division scope 下直接写 is_character 会导致脚本报错或静默失败,需先通过 any_character/every_character 等方式进入正确 scope 后再使用。is_character = GER 这类写法不会报语法错误,但逻辑上永远为假,正确写法应使用角色定义文件中声明的具体角色 token(如 GER_erwin_rommel)。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.
is_character is commonly used in character-exclusive events or decisions to ensure effects trigger only for specific characters, such as in general death events or advisor recruitment logic where precise targeting of the character is required. It can also be used within limit blocks to filter out a unique character before executing subsequent operations, preventing logic from inadvertently affecting other characters.
# Example event option: remove a specific trait only if the current character is the designated general
option = {
trigger = {
is_character = GER_erwin_rommel
}
remove_unit_leader_trait = ill_supplied
}
[has_trait](/wiki/trigger/has_trait): First use is_character to lock in a specific character, then use has_trait to check whether they possess a certain trait, enabling compound conditions like "for this person and satisfying this condition".[is_field_marshal](/wiki/trigger/is_field_marshal): Combine with is_character to confirm that the character is both the designated person and holds the position of field marshal, commonly used for promotions or story unlocks.[remove_unit_leader_trait](/wiki/effect/remove_unit_leader_trait): After confirming character identity with the condition, execute trait removal to ensure the effect applies precisely to the target character and not other characters in the same scope.[set_character_flag](/wiki/effect/set_character_flag): Pair with is_character to set flags on specific characters, useful for tracking whether that character has already experienced a particular story branch.is_character directly under country or division scope will cause script errors or silent failures. You must first enter the correct scope using any_character/every_character or similar constructs before using it.is_character = GER will not produce a syntax error but will always evaluate to false logically. The correct approach is to use the specific character token declared in the character definition files (e.g., GER_erwin_rommel).