trigger · has_defensive_war_with
Definition
- Supported scope:
COUNTRY - Supported target:
THIS,ROOT,PREV,FROM,OWNER,CONTROLLER,OCCUPIED,CAPITAL
Description
One country has defensive war against other country.
has_defensive_war_withCOUNTRYTHIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITALOne country has defensive war against other country.
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.
This trigger is commonly used in defensive war-related events or decision scenarios, such as unlocking special aid options for invaded nations, activating resistance bonus ideas, or triggering "homeland defense" type scripted events. The example below shows a decision that is only available when your country is in a defensive war against a specific enemy.
available = {
has_defensive_war_with = FROM
}
It can also be used in event trigger conditions to check whether the player's nation is being invaded by a target nation:
trigger = {
has_defensive_war_with = ROOT
}
[has_defensive_war](/wiki/trigger/has_defensive_war): has_defensive_war only checks "whether any defensive war exists", while has_defensive_war_with pinpoints the opposing nation. Both are often nested or used in parallel—first coarse filtering, then precise target identification.[any_enemy_country](/wiki/trigger/any_enemy_country): Can be used within any_enemy_country subscopes to iterate through enemy nations and filter actual attackers with has_defensive_war_with, providing more rigorous logic.[has_war_goal_against](/wiki/trigger/has_war_goal_against) (see note below) / [can_declare_war_on](/wiki/trigger/can_declare_war_on): When combined, these allow distinguishing between "currently defending" and "can declare war" as mutually exclusive states in AI strategies or decisions, avoiding logical conflicts.[add_ideas](/wiki/effect/add_ideas): When conditions are met, adds "full mobilization" type ideas to grant the defending nation wartime bonuses—the most typical effect synergy.THIS/ROOT/PREV/FROM/OWNER, and cannot directly write nation tag strings (e.g., GER). Otherwise the script parsing will silently fail and the condition will always be false.