effect · add_named_threat
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
Adds country threat
add_named_threatCOUNTRYnoneAdds country threat
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.
add_named_threat is commonly used in events or decisions to make a country's actions impose "threat" to the rest of the world, thereby triggering AI responses or alliance alert mechanisms in other nations. For example, in expansionist national focuses or war declaration events, you can attach a named threat with a specific label to the aggressor, making it easy to reference by name in subsequent conditional checks or display in tooltips.
# Triggered after a country completes an aggressive focus
country_event = {
id = my_mod.101
immediate = {
add_named_threat = {
threat = 2
name = my_mod_aggressive_expansion
}
}
}
[add_threat](/wiki/effect/add_threat): The unnamed version of threat increase; both are often used contrastively—use add_named_threat when you need to track specific sources in UI or scripts, and use add_threat for bulk rapid accumulation.[has_added_tension_amount](/wiki/trigger/has_added_tension_amount): Checks if the current world tension has reached a threshold; combined with add_named_threat to form a complete logic chain of "impose threat → evaluate global tension".[create_wargoal](/wiki/effect/create_wargoal): AI nations are often triggered to create war goals once threat accumulates to a certain level; the two together simulate "escalating aggression" storylines.[add_opinion_modifier](/wiki/effect/add_opinion_modifier): Synchronously reduce diplomatic relations as threat rises, making international responses in your mod more realistic and nuanced..yml localization file, the in-game tooltip will display the raw key name (e.g., my_mod_aggressive_expansion) rather than readable text, easily mistaken as a scripting error.