trigger · is_assigned
Definition
- Supported scope:
CHARACTER - Supported target:
none
Description
is_assigned = yes/no - Checks if the current unit leader is assigned to command an army/navy
is_assignedCHARACTERnoneis_assigned = yes/no - Checks if the current unit leader is assigned to command an army/navy
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
is_assigned 常用于动态角色管理场景,例如在将领被派遣上阵时禁止玩家对其执行某些操作(如晋升、退休或更换顾问职务),或者在事件/决策中判断某位角色当前是否处于指挥状态以给出不同的剧情分支。典型场景是:一名角色同时挂载了顾问角色,当其在统帅军队时不允许被解雇。
# 示例:仅当该角色未被分配指挥任务时,才允许解雇其顾问职务
advisor_can_be_fired = {
limit = {
NOT = { is_assigned = yes }
}
}
[is_leading_army](/wiki/trigger/is_leading_army):两者经常组合使用,is_assigned 判断角色是否绑定到任何指挥位置,is_leading_army 则进一步确认其是否正在实际统率一支陆军,二者形成粗粒度与细粒度的双重校验。[advisor_can_be_fired](/wiki/trigger/advisor_can_be_fired):当需要保护正在出征的将领不被从顾问位解雇时,将 is_assigned 作为 advisor_can_be_fired 的否定前置条件,逻辑最为直接。[retire](/wiki/effect/retire):在触发强制退役 effect 前用 is_assigned = no 做保护判断,避免将仍在指挥部队的将领直接退役导致部队失去统帅的逻辑错误。[is_corps_commander](/wiki/trigger/is_corps_commander):配合使用可区分"被分配指挥的军团长"与"尚未分配的军团长",常见于按战场状态给予不同特质或经验奖励的脚本。corps_commander 或 field_marshal 角色,is_assigned 就会返回 yes,实际上该 trigger 只有在角色被玩家/AI 实际拖入指挥位(绑定到具体军队/舰队)后才为真,未分配的将领即使有角色定义也返回 no。is_assigned 只在 CHARACTER scope 下有效,若在国家事件的 trigger 块中直接书写而不先用 any_character/specific character scope 切换作用域,脚本会静默失败或报错,排查时往往难以发现。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_assigned is commonly used in dynamic character management scenarios, such as preventing players from performing certain operations (like promotions, retirement, or reassigning advisor roles) on a general when they are deployed in command, or determining in events/decisions whether a character is currently in command to branch the narrative accordingly. A typical scenario is: a character simultaneously holds an advisor role, and when commanding an army they cannot be dismissed.
# Example: Only allow dismissing the advisor role if the character is not assigned to any command position
advisor_can_be_fired = {
limit = {
NOT = { is_assigned = yes }
}
}
[is_leading_army](/wiki/trigger/is_leading_army): These two are frequently used in combination. is_assigned determines whether a character is bound to any command position, while is_leading_army further confirms whether they are actually commanding an army unit, forming a dual validation of coarse-grained and fine-grained checks.[advisor_can_be_fired](/wiki/trigger/advisor_can_be_fired): When protecting a general on active deployment from being dismissed from their advisor position, using is_assigned as a negated precondition for advisor_can_be_fired provides the most direct logic.[retire](/wiki/effect/retire): Use is_assigned = no as a protective check before triggering the force retirement effect, preventing the logical error of losing command when retiring a general still commanding troops.[is_corps_commander](/wiki/trigger/is_corps_commander): Combined use allows distinguishing between "corps commanders assigned to command" and "unassigned corps commanders", commonly found in scripts that grant different traits or experience rewards based on battlefield status.corps_commander or field_marshal role, is_assigned will return yes. In reality, this trigger only returns true after the character is actually dragged into a command position by the player/AI (bound to a specific army/fleet). Unassigned generals return no even if they have role definitions.is_assigned only works in CHARACTER scope. If written directly in a country event's trigger block without first switching scope using any_character/specific character scope, the script will silently fail or throw an error, making debugging difficult.