Wiki

trigger · has_completed_custom_achievement

Definition

  • Supported scope:any
  • Supported target:any

Description

Return true if the input achievement is found in currently loaded mods, and if this achievement has been completed (either in current game or in a previous one)

Example:
has_completed_custom_achievement = {
	mod = my_mod_unique_id # set in common/achievements files
	achievement = my_achievement_token
}

实战 · 配合 · 坑

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

实战用法

此 trigger 常见于 mod 的跨存档进度系统,例如完成某成就后才解锁特殊国策、事件选项或隐藏内容。典型场景是在国策的 available 块中检测玩家是否在此前的游戏中完成了特定 mod 成就,从而给予"新周目奖励"。

focus = {
    id = my_mod_secret_focus
    available = {
        has_completed_custom_achievement = {
            mod = my_mod_unique_id
            achievement = conquered_the_world
        }
    }
    ...
}

配合关系

  • [has_dlc](/wiki/trigger/has_dlc):在检测成就前先确认 mod 所依赖的 DLC 已激活,避免因 DLC 缺失导致成就数据根本不存在而产生误判。
  • [has_global_flag](/wiki/trigger/has_global_flag):与全局旗标联用,当成就条件满足时配合 effect 侧设置旗标,防止同一局内重复触发奖励逻辑。
  • [custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip):包裹该 trigger 以提供更友好的本地化提示文本,让玩家在 UI 中能清晰看到"需要完成 XXX 成就"的解锁说明。
  • [game_rules_allow_achievements](/wiki/trigger/game_rules_allow_achievements):若 mod 成就系统要求成就模式才计数,可同步检测当前游戏规则是否允许成就,避免在非成就局中显示永远无法满足的条件。

常见坑

  1. mod ID 填错mod 字段必须与 common/achievements 文件中声明的 mod_id 完全一致(区分大小写),填写 mod 的 Steam Workshop ID 或显示名称是无效的,会导致 trigger 始终返回 false 且不报错。
  2. 误以为只检测当局:新手常认为此 trigger 仅对当前存档有效,实际上它也会读取历史完成记录;但若玩家完全卸载了对应 mod,成就记录将无法被找到,trigger 同样返回 false,因此文档说明中"currently loaded mods"这一前提条件不可忽视。

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 found in cross-save progression systems within mods, such as unlocking special national focuses, event options, or hidden content only after completing certain achievements. A typical scenario involves checking within a focus's available block whether the player has completed a specific mod achievement in a previous playthrough, thereby granting "New Game+ rewards".

focus = {
    id = my_mod_secret_focus
    available = {
        has_completed_custom_achievement = {
            mod = my_mod_unique_id
            achievement = conquered_the_world
        }
    }
    ...
}

Synergy

  • [has_dlc](/wiki/trigger/has_dlc): Confirm that the DLC dependencies of the mod are active before checking achievements, preventing false negatives caused by missing DLC that makes achievement data non-existent.
  • [has_global_flag](/wiki/trigger/has_global_flag): Use in conjunction with global flags; when achievement conditions are met, pair with effects to set flags, preventing duplicate reward logic triggers within the same session.
  • [custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip): Wrap this trigger to provide more user-friendly localized tooltip text, allowing players to clearly see unlock requirements like "Requires completing XXX achievement" in the UI.
  • [game_rules_allow_achievements](/wiki/trigger/game_rules_allow_achievements): If the mod's achievement system requires ironman mode to count, simultaneously check whether the current game rules allow achievements, preventing impossible-to-satisfy conditions from appearing in non-achievement sessions.

Common Pitfalls

  1. Incorrect mod ID: The mod field must exactly match the mod_id declared in the common/achievements file (case-sensitive). Using the mod's Steam Workshop ID or display name is invalid and will cause the trigger to always return false without error reporting.
  2. Mistakenly thinking it only checks the current session: Beginners often assume this trigger only applies to the current save, but it actually reads historical completion records as well. However, if the player completely uninstalls the corresponding mod, achievement records become unfindable and the trigger similarly returns false. Therefore, the prerequisite condition "currently loaded mods" mentioned in documentation cannot be overlooked.