effect · clear_global_event_targets
Definition
- Supported scope:
any - Supported target:
THIS,ROOT,PREV,FROM,OWNER,CONTROLLER,OCCUPIED,CAPITAL
Description
clear all global event targets
clear_global_event_targetsanyTHIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITALclear all global event targets
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_targets is best suited for "reset/wipe" scenarios in mods, such as clearing all global targets saved via save_global_event_target_as at the end of a large event chain to prevent stale references from polluting downstream logic. It's also commonly used in game initialization scripts to ensure no orphaned global event targets interfere with the first trigger.
# In the immediate block of a "reset world situation" event
news_event = {
id = my_mod.999
immediate = {
clear_global_event_targets = yes
}
}
[save_global_event_target_as](/wiki/effect/save_global_event_target_as): The complementary "storage" command; typically you batch-save global targets first, then use this command at the end of an event chain for wholesale cleanup, forming a complete lifecycle management pattern.[clear_global_event_target](/wiki/effect/clear_global_event_target): Used to delete a single global target with precision; when only specific targets need cleanup rather than all, these two form a complementary choice.[clr_global_flag](/wiki/effect/clr_global_flag): Often paired with this command in the same "reset" block to synchronously clear global flags and ensure state is completely reset.[has_event_target](/wiki/trigger/has_event_target): Before clearing, use this trigger to check whether a specific global target exists, aiding debugging or conditional branch protection.clear_global_event_target: Beginners often get these backwards—the singular form clear_global_event_target requires a target name as a parameter, while this command takes no parameters and is simply written as = yes; if you try to use this command as a singular version and pass a name, the script will fail to parse correctly.