Wiki

trigger · has_officer_name

Definition

  • Supported scope:(none)
  • Supported target:none

Description

checks if division has an officer with the provided name key.
Examples:
	has_officer_name = FIN_nikke_parmi

实战 · 配合 · 坑

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

实战用法

has_officer_name 常用于芬兰、苏联等历史向 mod 中,根据特定将领是否存在于某师团来触发专属事件、解锁特殊决议或给予额外奖励,实现"名将在场"的叙事效果。例如,当某位历史名将统率的师团参与特定战役时,可通过此 trigger 激活隐藏剧情分支。

# 检测师团是否配备了指定军官,以触发特殊事件
division_trigger = {
    has_officer_name = FIN_nikke_parmi
}

配合关系

由于当前 scope 下白名单中暂无可交叉引用的命令,以下说明该 trigger 在通用写法中的逻辑搭配方向:

  • 该 trigger 通常嵌套在 division_triggerlimit 块内使用,与其他师团级条件共同构成复合判断,避免单独使用导致 scope 不匹配。
  • 在 focus/event 的 availabletrigger 块中,应先确保外层 scope 已正确切换至对应师团,再调用此 trigger,否则返回值不可预期。

常见坑

  1. Scope 不匹配has_officer_name 要求处于 division scope 下,若直接写在 country scope(如国策或事件的顶层 trigger 块)而未切换作用域,脚本会静默失败或报错,新手极易忽略这一点。
  2. 名称键拼写错误:填写的参数是本地化/数据库中的 key(如 FIN_nikke_parmi),而非将领的显示名称字符串,若直接填写中文或英文显示名将永远返回假,调试时难以察觉。

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

has_officer_name is commonly used in historical mods for Finland, the Soviet Union, and similar nations to trigger exclusive events, unlock special decisions, or grant additional rewards based on whether a specific officer exists in a given division, achieving a narrative effect of "legendary commanders in action." For example, when a division led by a historical figure participates in a specific battle, this trigger can activate hidden story branches.

# Check whether a division is equipped with the specified officer to trigger special events
division_trigger = {
    has_officer_name = FIN_nikke_parmi
}

Synergy

Since there are currently no cross-referenceable commands in the whitelist of the current scope, the following describes the logical combinations in which this trigger is typically used:

  • This trigger is usually nested within division_trigger or limit blocks, working alongside other division-level conditions to form compound judgments; avoid using it in isolation as this can cause scope mismatches.
  • In available or trigger blocks within focuses/events, you must first ensure that the outer scope has been correctly switched to the corresponding division before calling this trigger; otherwise, the return value will be unpredictable.

Common Pitfalls

  1. Scope Mismatch: has_officer_name requires a division scope. If written directly in a country scope (such as the top-level trigger block of a focus or event) without switching the scope, the script will silently fail or throw an error—a mistake that beginners frequently make.
  2. Officer Name Key Spelling Errors: The parameter you provide should be the localization/database key (such as FIN_nikke_parmi), not the display name string of the officer. If you fill in the Chinese or English display name directly, it will always return false, making it difficult to detect during debugging.