Wiki

trigger · can_research

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check if country can research technology

实战 · 配合 · 坑

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

实战用法

can_research 常用于科技限制类 mod 中,例如判断某国是否具备研究某项技术的资格,从而决定是否显示或开放特定国策/决议。典型场景是在 available 块中把科技能力作为前置门槛,避免 AI 或玩家绕过设计限制。

# 国策的 available 条件:只有当该国能够研究技术时才可选
focus = {
    id = my_focus_advanced_industry
    available = {
        can_research = industry
    }
}

配合关系

  • [has_completed_focus](/wiki/trigger/has_completed_focus):常与 can_research 同置于 available 块,先确认完成了相关前置国策,再确认具备研究能力,双重门槛更严谨。
  • [amount_research_slots](/wiki/trigger/amount_research_slots):两者配合可区分"能研究"和"有足够槽位研究",避免国家因科技槽不足而触发逻辑异常。
  • [add_tech_bonus](/wiki/effect/add_tech_bonus):在 can_research 通过后的 effect 块中给予科技加速奖励,形成"能研究 → 奖励提速"的完整逻辑链。
  • [add_research_slot](/wiki/effect/add_research_slot):若 can_research 检测失败(即无法研究),可在 else 分支通过此 effect 补充研究槽或条件,作为补救手段。

常见坑

  1. 误把 can_research 当研究完成判断使用:此 trigger 只检查"能否研究",而非"是否已研究",判断技术是否已解锁应使用 has_tech(白名单外但游戏内存在),新手容易混淆两者语义导致条件逻辑错误。
  2. 在非 COUNTRY scope 下调用can_research 仅在国家 scope 下有效,若写在 any_owned_stateany_unit_leader 等子 scope 内部而未用 ROOT/PREV 跳回国家 scope,脚本会静默失败或报错,调试时难以察觉。

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

can_research is commonly used in tech-restriction mods to determine whether a country qualifies to research a particular technology, thereby deciding whether to display or unlock specific focuses/decisions. A typical scenario is placing tech capability as a prerequisite gate within an available block, preventing the AI or player from circumventing design constraints.

# Available condition for a focus: selectable only when the country can research the technology
focus = {
    id = my_focus_advanced_industry
    available = {
        can_research = industry
    }
}

Synergy

  • [has_completed_focus](/wiki/trigger/has_completed_focus): Often placed together with can_research in the available block. First confirm the relevant prerequisite focus is completed, then verify research capability—a dual-gate approach for stricter validation.
  • [amount_research_slots](/wiki/trigger/amount_research_slots): Used in tandem, these distinguish between "can research" and "has enough slots to research," preventing logic errors when a nation lacks sufficient research slots.
  • [add_tech_bonus](/wiki/effect/add_tech_bonus): After can_research passes in the effect block, grant tech acceleration bonuses, forming a complete logic chain: "can research → grant speed bonus."
  • [add_research_slot](/wiki/effect/add_research_slot): If can_research fails (i.e., cannot research), use this effect in an else branch to supplement research slots or conditions as a fallback measure.

Common Pitfalls

  1. Mistakenly using can_research to check if research is already completed: This trigger only checks "whether research is possible," not "whether research is already done." To determine if a technology is unlocked, use has_tech (exists in-game but outside the whitelist). Newcomers often confuse the two semantics, leading to incorrect condition logic.
  2. Calling outside COUNTRY scope: can_research is only valid under country scope. If written inside subscopes like any_owned_state or any_unit_leader without jumping back to country scope via ROOT/PREV, the script silently fails or errors, making debugging difficult to spot.