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
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.