Wiki

trigger · has_idea_with_trait

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check if country has idea with specified trait

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_idea_with_trait is commonly used to check whether a country possesses an advisor or national focus with a specific trait tag. For example, you can use it to determine whether a "military advisor" series idea with the military_theorist trait exists, and based on that result, decide whether to unlock subsequent options or trigger events. In advisor system expansion mods, it can prevent duplicate additions of functionally overlapping ideas, or provide bonuses when ideas with specific traits are present.

# Decision is available if the country has any idea with the military_theorist trait
available = {
    has_idea_with_trait = military_theorist
}

Synergy

  • [has_available_idea_with_traits](/wiki/trigger/has_available_idea_with_traits): Often used in contrast with this trigger—the latter checks for "already owned," the former checks "available but inactive," together forming a complete advisor status judgment chain.
  • [has_allowed_idea_with_traits](/wiki/trigger/has_allowed_idea_with_traits): Used to further distinguish whether an idea is permitted by rules; combining with has_idea_with_trait allows precise filtering of advisor pool states.
  • [add_ideas](/wiki/effect/add_ideas): After confirming no existing idea with the same trait, use this effect to add a new idea, avoiding logic conflicts caused by duplicate advisor stacking.
  • [deactivate_advisor](/wiki/effect/deactivate_advisor): When detecting an existing idea with the same trait, first remove the old advisor before triggering the replacement process, implementing an advisor upgrade mechanism.

Common Pitfalls

  1. Trait name mismatch with idea definition: has_idea_with_trait checks the trait declared in the traits = { ... } field on the idea, not the idea's own id name. Beginners often mistakenly use the idea's token name as the trait name, causing the condition to always evaluate false.
  2. Incorrect scope usage: This trigger is only valid under COUNTRY scope. If called directly in code blocks under STATE or CHARACTER scope without first switching scope, the script will silently fail or throw an error. Pay attention to scope mismatch warnings in the logs during debugging.