effect · remove_unit_leader
Definition
- Supported scope:
COUNTRY,CHARACTER - Supported target:
none
Description
remove a unit leader ( remove_unit_leader=ID )
remove_unit_leaderCOUNTRY, CHARACTERnoneremove a unit leader ( remove_unit_leader=ID )
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
remove_unit_leader 常用于剧情事件中清除某个将领(如角色死亡、被俘、退役剧情),或在 MOD 重构将领系统时批量替换旧将领 ID。使用时需要提前通过调试或日志确认目标将领的数字 ID,然后直接传入即可。
country_event = {
id = my_mod.5
title = "将领阵亡"
option = {
name = "沉痛悼念"
remove_unit_leader = 1200 # 移除 ID 为 1200 的将领
}
}
[create_corps_commander](/wiki/effect/create_corps_commander) / [create_field_marshal](/wiki/effect/create_field_marshal):移除旧将领后紧接着创建新将领,实现将领"替换"剧情,避免同名角色重复存在于编制中。[kill_operative](/wiki/effect/kill_operative):同为"从世界中移除角色"类命令,在处理角色死亡事件时可对比选用——将领用 remove_unit_leader,情报人员用 kill_operative,逻辑上保持一致。[any_unit_leader](/wiki/trigger/any_unit_leader):在执行移除前先用此触发器确认对应将领确实存在,防止 ID 不存在时产生静默错误或日志报错。[remove_unit_leader_role](/wiki/effect/remove_unit_leader_role):若只想剥夺将领的某个职位而非彻底删除角色,应优先考虑此命令;两者目的不同,需按场景区分使用。remove_unit_leader 依赖固定数字 ID,若将领是通过 create_corps_commander 等命令动态生成的,其 ID 可能因存档或游戏版本不同而变化,直接写死 ID 会导致目标将领无法被正确移除,应配合变量或事件触发链保证 ID 来源可靠。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.
remove_unit_leader is commonly used in scripted events to remove a specific unit leader (e.g., character death, capture, retirement storyline), or to bulk-replace outdated leader IDs when restructuring a MOD's commander system. Before use, verify the target leader's numeric ID through debugging or log inspection, then pass it directly to the command.
country_event = {
id = my_mod.5
title = "将领阵亡"
option = {
name = "沉痛悼念"
remove_unit_leader = 1200 # Remove leader with ID 1200
}
}
[create_corps_commander](/wiki/effect/create_corps_commander) / [create_field_marshal](/wiki/effect/create_field_marshal): Create a new leader immediately after removing the old one to implement a leader "replacement" storyline, avoiding duplicate characters with the same name in the roster.[kill_operative](/wiki/effect/kill_operative): Both are "remove character from the world" type commands; when handling character death events, choose between them based on role—use remove_unit_leader for unit leaders and kill_operative for operatives to maintain logical consistency.[any_unit_leader](/wiki/trigger/any_unit_leader): Confirm the target leader actually exists before executing the removal using this trigger, preventing silent errors or log warnings when an ID doesn't exist.[remove_unit_leader_role](/wiki/effect/remove_unit_leader_role): If you only want to strip a leader of a specific position rather than delete the character entirely, prioritize this command instead; the two serve different purposes and should be chosen based on context.remove_unit_leader relies on fixed numeric IDs; if the leader was dynamically generated via create_corps_commander or similar commands, its ID may vary across saves or game versions. Hard-coding the ID will fail to remove the intended leader—pair the command with variables or event trigger chains to ensure reliable ID sourcing.