effect · clear_global_event_target
Definition
- Supported scope:
any - Supported target:
none
Description
clear a global event target
clear_global_event_targetanynoneclear a global event target
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
clear_global_event_target 常用于需要在事件或决议链结束后清理临时性全局目标的场景,例如某个多步骤外交事件链完成后,释放之前通过 save_global_event_target_as 保存的目标国家或州,避免残留目标影响后续逻辑判断。典型场景包括清除战争调解国、外交谈判代理方等临时性全局引用。
# 事件链结束时,在 immediate 块中清理之前保存的全局目标
immediate = {
clear_global_event_target = my_mediator_country
}
[save_global_event_target_as](/wiki/effect/save_global_event_target_as):这是最直接的配合对象,通常先用此命令保存全局目标,事件链结束或条件失效后再用 clear_global_event_target 清除,形成完整的生命周期管理。[has_event_target](/wiki/trigger/has_event_target):在清除前可用此触发器检测全局目标是否存在,避免对不存在的目标执行清除时产生不必要的脚本警告。[clear_global_event_targets](/wiki/effect/clear_global_event_targets):若需要一次性清除所有全局目标,可改用此命令;两者形成"精确清除"与"批量清除"的互补关系。[if](/wiki/effect/if):配合条件块使用,可在满足特定条件(如事件链已完成)时才执行清除,使逻辑更加严谨。clear_global_event_target 的参数必须与 save_global_event_target_as 中定义的名称完全一致(区分大小写),一旦名称不匹配将静默失败,且游戏通常不会在日志中给出明确报错,极难排查。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.
clear_global_event_target is commonly used in scenarios where temporary global event targets need to be cleaned up after an event or decision chain concludes. For example, after completing a multi-step diplomatic event chain, you can release target countries or states previously saved via save_global_event_target_as, preventing residual targets from interfering with subsequent logic checks. Typical use cases include clearing war mediator countries, diplomatic negotiation proxies, and other temporary global references.
# Clean up previously saved global targets in the immediate block when the event chain ends
immediate = {
clear_global_event_target = my_mediator_country
}
[save_global_event_target_as](/wiki/effect/save_global_event_target_as): This is the most direct companion command. Typically you first save a global target with this command, then use clear_global_event_target to remove it after the event chain ends or conditions become invalid, forming a complete lifecycle management pattern.[has_event_target](/wiki/trigger/has_event_target): You can use this trigger before clearing to detect whether a global target exists, avoiding unnecessary script warnings when attempting to clear non-existent targets.[clear_global_event_targets](/wiki/effect/clear_global_event_targets): If you need to clear all global targets at once, you can use this command instead. The two form a complementary relationship between "precise clearing" and "batch clearing."[if](/wiki/effect/if): Used together with conditional blocks, you can execute the clear operation only when specific conditions are met (such as when the event chain has completed), making your logic more rigorous.clear_global_event_target must exactly match the name defined in save_global_event_target_as (case-sensitive). If names don't match, the operation will silently fail, and the game typically won't provide clear error messages in logs, making it extremely difficult to debug.