Wiki

trigger · has_idea

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check if country has idea

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

has_idea 常用于检测某国是否持有特定国策思潮、顾问或精神 buff,从而决定后续事件或决议是否可用。例如在自定义国策树中,限定只有已获得某经济法规的国家才能触发下一阶段选项,或在事件中根据是否携带特定军事顾问 idea 来分支对话。

# 仅当该国持有"战时经济"思潮时,决议才可用
available = {
    has_idea = war_economy
}

配合关系

  • [has_completed_focus](/wiki/trigger/has_completed_focus):先判断完成了某个国策,再用 has_idea 确认该国策附加的 idea 是否真正生效,两者双重验证,避免因 idea 被其他途径移除而导致逻辑漏洞。
  • [add_ideas](/wiki/effect/add_ideas):在 effect 块中为国家添加 idea,通常在 trigger 块中先用 has_idea 判断该 idea 不存在才执行,防止重复叠加。
  • [remove_ideas](/wiki/effect/remove_ideas)(白名单内以 add_ideas 对应的移除操作)搭配使用:先用 has_idea 确认 idea 存在,再安全地将其移除,避免对不存在的 idea 执行移除时产生报错或静默失败。
  • [has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier)has_idea 检查静态 idea,has_dynamic_modifier 检查动态修正器,两者配合可完整覆盖国家所有增益/减益状态的判断逻辑。

常见坑

  1. idea 名称大小写或拼写错误has_idea 的参数必须与 ideas = { ... } 定义块中的 idea token 完全一致,哪怕一个下划线之差也会静默返回 false 而不报错,非常难以排查。
  2. 混淆 idea 与 advisor character:在新版本中顾问系统已迁移到 character 体系,部分顾问不再作为传统 idea 注册;对这类顾问使用 has_idea 会永远返回 false,应改用 [has_character](/wiki/trigger/has_character)[has_country_leader](/wiki/trigger/has_country_leader) 进行检测。

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 is commonly used to check whether a nation possesses a specific national focus ideology, advisor, or spirit buff, thereby determining whether subsequent events or decisions are available. For example, in a custom focus tree, you can restrict the next phase of options to only nations that have acquired a certain economic law idea, or in an event, branch dialogue based on whether a specific military advisor idea is present.

# Decision is only available if the nation has the "war_economy" idea
available = {
    has_idea = war_economy
}

Synergy

  • [has_completed_focus](/wiki/trigger/has_completed_focus): First check whether a specific focus has been completed, then use has_idea to confirm that the idea granted by that focus is actually in effect. This double verification prevents logical gaps caused by ideas being removed through other means.
  • [add_ideas](/wiki/effect/add_ideas): Add ideas to a nation within an effect block. Typically, first check in a trigger block using has_idea to ensure the idea does not already exist before execution, preventing duplicate stacking.
  • [remove_ideas](/wiki/effect/remove_ideas) (paired removal operations corresponding to add_ideas entries): First confirm the idea's existence using has_idea, then safely remove it to avoid errors or silent failures when attempting to remove non-existent ideas.
  • [has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier): has_idea checks static ideas while has_dynamic_modifier checks dynamic modifiers. Used together, they provide complete coverage for evaluating all bonus/penalty states of a nation.

Common Pitfalls

  1. Incorrect capitalization or spelling of idea names: The parameter for has_idea must match the idea token in the ideas = { ... } definition block exactly. Even a single underscore difference will silently return false without error, making it extremely difficult to debug.
  2. Confusing ideas with advisor characters: In newer versions, the advisor system has migrated to the character framework, and some advisors are no longer registered as traditional ideas. Using has_idea on such advisors will always return false. Use [has_character](/wiki/trigger/has_character) or [has_country_leader](/wiki/trigger/has_country_leader) instead.