trigger · has_idea_with_trait
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
check if country has idea with specified trait
has_idea_with_traitCOUNTRYnonecheck if country has idea with specified trait
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
has_idea_with_trait 常用于检测某国是否拥有带特定 trait 标签的顾问或国策思潮,例如判断是否存在"军事顾问"系列中带有 military_theorist 特征的 idea,从而决定是否解锁后续选项或触发事件。在顾问系统扩展 mod 中,可用它来防止重复添加功能重叠的 idea,或为特定 trait 的 idea 存在时提供加成。
# 若该国拥有任何带 military_theorist trait 的 idea,则该决策可用
available = {
has_idea_with_trait = military_theorist
}
[has_available_idea_with_traits](/wiki/trigger/has_available_idea_with_traits):两者经常对比使用——前者检查"已拥有",后者检查"可用但未激活",共同构成完整的顾问状态判断链。[has_allowed_idea_with_traits](/wiki/trigger/has_allowed_idea_with_traits):用于进一步区分 idea 是否被规则允许,与 has_idea_with_trait 组合可精确筛选顾问池状态。[add_ideas](/wiki/effect/add_ideas):确认当前不存在同 trait 的 idea 后,再用此 effect 添加新 idea,避免同类顾问叠加导致逻辑冲突。[deactivate_advisor](/wiki/effect/deactivate_advisor):在检测到已有同 trait idea 时,先移除旧顾问再触发替换流程,实现顾问升级机制。has_idea_with_trait 检查的是 idea 上 traits = { ... } 字段中声明的 trait,而非 idea 本身的 id 名,新手容易误将 idea 的 token 名当作 trait 名填入,导致条件永远为假。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_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
}
[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.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.