Wiki

trigger · has_opinion

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

check what opinion the country has towards a specified country

Hands-On Notes

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.

Hands-On Usage

has_opinion is commonly used in diplomatic events or decision availability conditions to check whether a country's opinion toward a target nation meets a threshold. Typical use cases include restricting alliance invitations, determining AI diplomatic behavior, or unlocking specific story branches. For example, you might only allow a coalition event to trigger if the player nation's opinion of a major power is sufficiently high.

# Example available block in a decision: execution only permitted if own opinion of GER ≥ 50
available = {
    has_opinion = {
        target = GER
        value > 50
    }
}

Synergy

  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — Adds opinion modifiers to a specified nation within an effect block. Combined with has_opinion, this forms a complete diplomatic logic chain: "check current relations first → then apply modifier stacking."
  • [any_allied_country](/wiki/trigger/any_allied_country) — When iterating through allies, nest has_opinion checks to filter allies whose opinion meets your threshold, enabling granular conditional logic.
  • [has_country_flag](/wiki/trigger/has_country_flag) — Often used alongside has_opinion to record diplomatic progress stages via country flags, preventing the same diplomatic chain from triggering repeatedly.
  • [add_relation_modifier](/wiki/effect/add_relation_modifier) — Similar effect to add_opinion_modifier but lower-level; combined with has_opinion, it can trigger compensatory relation modifiers when opinion is insufficient.

Common Pitfalls

  1. Missing or incorrect comparison operators: Beginners often omit the value field in value > 50, or misuse = for magnitude comparison (in PDX script, = means "equals" not assignment), causing conditions to never fire or throw errors.
  2. Invalid scope passed to target: target only accepts whitelisted scope keywords or concrete country tags (e.g., GER). Passing a state-level scope or nonexistent tag will not trigger an error, but the condition will silently fail.