Hands-On Usage
has_war_with_wargoal_against is commonly used to check whether the current country has declared war against a specific target with a particular war goal. Typical use cases include decision or focus availability conditions (for example, activating a special decision only when the player attacks Germany with "Annex" as the war goal), or in AI logic to detect war intentions and determine whether to trigger events.
# This decision is only available if this country is at war with GER with "take_state" as the war goal
available = {
has_war_with_wargoal_against = {
target = GER
type = take_state
}
}
Synergy
[has_defensive_war_with](/wiki/trigger/has_defensive_war_with): Often paired with this trigger to form "bidirectional conflict detection"—one checks if your side actively holds war goals, the other checks if your side is passively defending, preventing logical confusion.
[any_enemy_country](/wiki/trigger/any_enemy_country): Used to iterate through all enemy nations when the target is uncertain, then invoke this trigger in sub-conditions to filter out wars with specific war goals.
[create_wargoal](/wiki/effect/create_wargoal): Typically linked with the result of this trigger in effect blocks—first use this trigger to confirm whether the war goal already exists, then decide whether to create additional war goals, preventing duplication.
[declare_war_on](/wiki/effect/declare_war_on): After a declare war effect executes, you often need to verify in subsequent triggers using this command that the declaration carried the expected war goal type, commonly seen in condition validation nodes of event chains.
Common Pitfalls
- Assuming the trigger matches only a specific war goal when
type is omitted: When the type field is left blank, the trigger returns true for "any war goal," so if you only want to check a specific type (such as take_state), you must explicitly write type = take_state. Otherwise, the condition will fire whenever the two nations are at war and any war goal exists, making the condition too permissive.
- Confusing scope direction: This trigger checks whether the "current scope country holds a war goal against
target," not the reverse. Newcomers often set target to their own country or call the trigger in the wrong scope (such as STATE scope), causing the condition to never activate. Always ensure the outer scope is COUNTRY and that target points to the attacked nation.