Wiki

trigger · game_rules_allow_achievements

Definition

  • Supported scope:any
  • Supported target:none

Description

Returns true if all of the active game rule options allow achievements.

实战 · 配合 · 坑

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

实战用法

game_rules_allow_achievements 常用于自定义成就系统或职业档案(Career Profile)相关 mod 中,用来在颁发成就前确认当前游戏规则设置不会阻断成就解锁。例如在某个 focus 完成时,先检查本条件再触发奖励逻辑,避免在非成就局中误判:

focus = {
    id = my_focus_achievement_check
    available = {
        game_rules_allow_achievements = yes
    }
    completion_reward = {
        # 仅在允许成就的游戏规则下才有意义的奖励
    }
}

配合关系

  • [is_ironman](/wiki/trigger/is_ironman):铁人模式是解锁成就的前提之一,两者通常同时出现在 and 块中,共同确保成就解锁环境完全合规。
  • [has_game_rule](/wiki/trigger/has_game_rule):当需要细粒度检查某条具体游戏规则选项时,可与 game_rules_allow_achievements 配合,先做整体放行检查,再做特定规则的分支判断。
  • [has_completed_custom_achievement](/wiki/trigger/has_completed_custom_achievement):在自定义成就系统中,先用 game_rules_allow_achievements 确认环境允许,再用此 trigger 判断玩家是否已完成某项成就,形成完整的成就校验流程。
  • [custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip):将本 trigger 包裹在此命令中,可以在 UI 中向玩家呈现更友好的「游戏规则允许成就」提示文本,而不暴露原始条件名。

常见坑

  1. 误将其用作"启用成就"的 effect:本命令是纯判断 trigger,只能出现在条件块中,无法主动开启或关闭成就资格;想要影响游戏规则状态必须依赖游戏本体设置,脚本层面无法绕过。
  2. 忽略游戏规则叠加逻辑:该 trigger 检查的是所有当前激活的游戏规则选项是否共同允许成就,只要有任意一条规则禁止成就,结果即为 false;新手容易以为只要主规则允许就足够,忽略了其他自定义规则选项同样会影响返回值。

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

game_rules_allow_achievements is commonly used in custom achievement systems or Career Profile-related mods to verify that the current game rules configuration will not block achievement unlock before granting achievements. For example, when a focus is completed, check this condition first before triggering reward logic, avoiding false positives in non-ironman playthroughs:

focus = {
    id = my_focus_achievement_check
    available = {
        game_rules_allow_achievements = yes
    }
    completion_reward = {
        # Rewards that only make sense under game rules that allow achievements
    }
}

Synergy

  • [is_ironman](/wiki/trigger/is_ironman): Ironman mode is a prerequisite for unlocking achievements; both typically appear together in and blocks to jointly ensure the achievement environment is fully compliant.
  • [has_game_rule](/wiki/trigger/has_game_rule): When fine-grained checking of a specific game rule option is needed, it can be paired with game_rules_allow_achievements—first perform a blanket environment check, then branch on specific rule conditions.
  • [has_completed_custom_achievement](/wiki/trigger/has_completed_custom_achievement): In custom achievement systems, use game_rules_allow_achievements first to confirm the environment permits achievements, then use this trigger to check whether the player has already completed a given achievement, forming a complete achievement validation pipeline.
  • [custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip): Wrapping this trigger within this command allows presenting a more player-friendly "game rules allow achievements" tooltip in the UI rather than exposing the raw condition name.

Common Pitfalls

  1. Mistaking it for an effect that "enables achievements": This command is purely a conditional trigger and can only appear in condition blocks; it cannot actively enable or disable achievement eligibility. Influencing game rule state requires relying on the game's built-in settings—the scripting layer cannot bypass this.
  2. Overlooking game rule stacking logic: This trigger checks whether all currently active game rule options collectively allow achievements. If any single rule prohibits achievements, the result is false. Beginners often assume that as long as the main rule allows it, that is sufficient, overlooking that other custom rule options equally affect the return value.