Wiki

trigger · has_country_custom_difficulty_setting

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

Returns true if the game has any custom difficulty on the scope nation

实战 · 配合 · 坑

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

实战用法

这个 trigger 常用于自定义难度系统相关的 mod 场景中,例如当玩家为某个国家开启了自定义难度选项后,动态调整该国的科研速度、工厂产出或 AI 行为。也可以用在 focus 或 decision 的 available 块中,限制某些强力选项仅在标准难度下才能触发。

# 在某个国家事件的 trigger 中,检测是否启用了自定义难度
country_event = {
    id = my_mod.1
    trigger = {
        has_country_custom_difficulty_setting = yes
        # 只有开启了自定义难度的国家才会触发此事件
    }
    ...
}

配合关系

  • [has_country_flag](/wiki/trigger/has_country_flag):先用 flag 记录玩家对难度的选择行为,再结合本 trigger 双重确认状态,避免误判。
  • [has_active_rule](/wiki/trigger/has_active_rule):自定义难度往往伴随特定规则的开关,两者配合可以精确区分多种难度配置组合。
  • [add_ideas](/wiki/effect/add_ideas):检测到自定义难度后,通过添加 idea 来动态平衡国家属性,是最常见的后续效果写法。
  • [country_event](/wiki/effect/country_event):确认自定义难度生效后触发专属事件,向玩家提示当前难度状态或给予特殊奖惩。

常见坑

  1. scope 误用:此 trigger 只能在 COUNTRY scope 下调用,若放在 STATE 或 CHARACTER 等 scope 内会静默失败或报错,新手容易在 limit 块嵌套层级较深时忘记切换 scope。
  2. 混淆"有自定义难度"与"具体难度值":本 trigger 只返回是否存在自定义难度设置,并不判断难度的具体数值或类型;若需要区分不同难度档位,还需结合其他 flag 或 rule 进行细分判断,不能用本 trigger 单独完成。

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

This trigger is commonly used in mod scenarios related to custom difficulty systems. For example, after a player enables custom difficulty options for a nation, you can dynamically adjust that nation's research speed, factory output, or AI behavior. It can also be used in the available block of a focus or decision to restrict certain powerful options to only trigger on standard difficulty.

# Check whether custom difficulty is enabled in a country event trigger
country_event = {
    id = my_mod.1
    trigger = {
        has_country_custom_difficulty_setting = yes
        # Only countries with custom difficulty enabled will trigger this event
    }
    ...
}

Synergy

  • [has_country_flag](/wiki/trigger/has_country_flag): Use flags to record player difficulty choices first, then combine with this trigger for dual confirmation to avoid false positives.
  • [has_active_rule](/wiki/trigger/has_active_rule): Custom difficulty often comes with specific rule toggles; using both together allows precise differentiation between multiple difficulty configuration combinations.
  • [add_ideas](/wiki/effect/add_ideas): After detecting custom difficulty, dynamically balance nation attributes by adding ideas—this is the most common follow-up effect pattern.
  • [country_event](/wiki/effect/country_event): After confirming custom difficulty takes effect, trigger exclusive events to notify players of the current difficulty state or grant special rewards/penalties.

Common Pitfalls

  1. Scope misuse: This trigger can only be called within COUNTRY scope. Placing it in STATE or CHARACTER scopes will fail silently or throw errors. Beginners often forget to switch scopes when nesting is deep within limit blocks.
  2. Confusing "having custom difficulty" with "specific difficulty value": This trigger only returns whether custom difficulty settings exist; it does not judge the specific value or type of difficulty. To distinguish between different difficulty tiers, you must combine it with other flags or rules for fine-grained judgment—this trigger alone cannot complete the task.