effect · clr_unit_leader_flag
Definition
- Supported scope:
CHARACTER - Supported target:
none
Description
clear unit leader flag
This effect is deprecated in favor of clr_character_flag.
clr_unit_leader_flagCHARACTERnoneclear unit leader flag
This effect is deprecated in favor of clr_character_flag.
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
clr_unit_leader_flag 用于在旧版 mod 中清除挂在将领 CHARACTER scope 下的自定义布尔标记,例如在某个事件结束后撤销之前用 set_unit_leader_flag 打上的状态标记,防止标记残留导致后续触发器误判。由于官方已将其标为废弃,仅在维护老旧 mod 或兼容旧存档时才会看到它。
# 旧版写法示例:清除将领的特殊任务标记
character_event = {
id = my_mod.10
...
option = {
name = my_mod.10.a
# 任务结束,清除标记
clr_unit_leader_flag = my_special_mission_active
}
}
[set_unit_leader_flag](/wiki/effect/set_unit_leader_flag) — 与本命令成对使用,先用 set 打标记,再用 clr 清除,构成完整的标记生命周期管理。[has_unit_leader_flag](/wiki/trigger/has_unit_leader_flag) — 清除前通常用此触发器检查标记是否存在,避免在无标记时执行无意义的清除操作。[clr_character_flag](/wiki/effect/clr_character_flag) — 官方推荐的替代命令,迁移旧 mod 时应将 clr_unit_leader_flag 一对一替换为此命令。[modify_unit_leader_flag](/wiki/effect/modify_unit_leader_flag) — 同属旧版将领标记体系,若需要的是修改而非清除,可对比选用。clr_character_flag;继续使用旧命令虽然短期内可能不报错,但未来版本兼容性无法保障,建议第一时间迁移。immediate 块里而未先切入具体角色),脚本将静默失效,标记不会被清除,难以排查。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.
clr_unit_leader_flag is used in legacy mods to clear custom boolean flags attached to unit leaders under the CHARACTER scope. For example, it can be used to remove a status flag previously set with set_unit_leader_flag after an event concludes, preventing flag residue from causing subsequent trigger misevaluations. Since the official implementation has marked it as deprecated, you will only encounter it when maintaining older mods or ensuring compatibility with legacy saves.
# Legacy usage example: clearing a leader's special mission flag
character_event = {
id = my_mod.10
...
option = {
name = my_mod.10.a
# Mission complete, clear the flag
clr_unit_leader_flag = my_special_mission_active
}
}
[set_unit_leader_flag](/wiki/effect/set_unit_leader_flag) — Used as a counterpart to this command; set the flag first, then clear it with clr to form a complete flag lifecycle management cycle.[has_unit_leader_flag](/wiki/trigger/has_unit_leader_flag) — Typically check flag existence with this trigger before clearing to avoid executing meaningless clear operations when no flag is present.[clr_character_flag](/wiki/effect/clr_character_flag) — The officially recommended replacement command; when migrating legacy mods, replace clr_unit_leader_flag one-to-one with this command.[modify_unit_leader_flag](/wiki/effect/modify_unit_leader_flag) — Part of the legacy leader flag system; if you need to modify rather than clear, consider this as an alternative.clr_character_flag directly. While continuing to use the old command may not produce errors in the short term, future version compatibility cannot be guaranteed. Migration is strongly recommended immediately.immediate block without first switching to a specific character), the script will silently fail and the flag will not be cleared, making it difficult to debug.