trigger · has_defensive_war
Definition
- Supported scope:
COUNTRY - Supported target:
THIS,ROOT,PREV,FROM,OWNER,CONTROLLER,OCCUPIED,CAPITAL
Description
is country at defensive war
has_defensive_warCOUNTRYTHIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITALis country at defensive war
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.
has_defensive_war is commonly used in national focuses, decisions, or events to determine whether your country is currently under attack from another nation's offensive war declaration, thereby triggering specific defensive bonuses or diplomatic aid options. For example, in a mod centered on "resisting aggression," certain emergency mobilization decisions can only be activated when the player is in a defensive war state:
# In the available block of a decision
available = {
has_defensive_war = yes
has_war_support > 0.3
}
[has_defensive_war_with](/wiki/trigger/has_defensive_war_with): After confirming you are in a defensive war, further narrows the scope to a specific enemy nation; commonly nested with this trigger for precise scenario matching.[any_enemy_country](/wiki/trigger/any_enemy_country): Iterates through all enemy nations at war; combined with has_defensive_war, it can verify whether enemies meet additional conditions (such as ideology, military strength, etc.) within the defensive war context.[add_ideas](/wiki/effect/add_ideas): In events or decisions triggered by defensive war, grants your nation emergency mobilization-themed national spirit ideas; this is the most common reward effect following has_defensive_war checks.[add_war_support](/wiki/effect/add_war_support): Defensive wars often involve dynamic adjustments to war support; using this trigger to restrict war support increases to defensive states only prevents logic errors and ensures correct execution.has_defensive_war returns true only when your nation is declared upon (i.e., as the defending side). Even if your nation simultaneously has offensive wars from your own declarations, this trigger can still evaluate to true—beginners often mistakenly believe "in a defensive war" means "has no offensive war goals whatsoever," but these are not mutually exclusive. You must combine this with additional triggers like has_annex_war_goal to properly exclude unwanted cases.COUNTRY scope. If mistakenly placed in a state or character-related scope (such as forgetting to switch back to country scope within a limit block inside any_owned_state), it will cause script errors or silent failures. Careful scope hierarchy inspection is essential during debugging.