Wiki

trigger · custom_trigger_tooltip

Definition

  • Supported scope:any
  • Supported target:none

Description

Alias for [custom_override_tooltip](#custom_override_tooltip) trigger (see that trigger for more info). Kept for backward compatibility.
Prefer [custom_override_tooltip](#custom_override_tooltip) instead.

实战 · 配合 · 坑

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

实战用法

custom_trigger_tooltipcustom_override_tooltip 的向后兼容别名,常见于旧版 mod 中用来在条件块里替换显示给玩家的提示文本,使复杂的逻辑判断以更友好的本地化字符串呈现。例如在某个 focus 的 available 块里隐藏内部变量检查、只显示玩家可读的条件描述:

available = {
    custom_trigger_tooltip = {
        tooltip = my_focus_requirement_tt
        check_variable = { var = my_mod_progress value = 5 compare = greater_than }
    }
}

配合关系

  • [custom_override_tooltip](/wiki/trigger/custom_override_tooltip):这是其现代等价命令,建议新 mod 统一迁移到该命令,两者可在同一条件块中混用以区分新旧逻辑。
  • [check_variable](/wiki/trigger/check_variable):最常作为 custom_trigger_tooltip 包裹的内层判断,将变量数值比较隐藏在自定义 tooltip 文本背后。
  • [if](/wiki/trigger/if):配合使用可实现"只在特定条件下才显示某段自定义提示",让 UI 反馈更有条件性。
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip):在 effect 侧对应的 tooltip 覆盖手段,trigger 与 effect 各自的自定义提示通常成对出现,保持 UI 风格一致。

常见坑

  1. 不应在新 mod 中优先使用:许多开发者看到旧教程直接复制此命令,忽略官方已建议改用 custom_override_tooltip,导致代码风格不一致且未来兼容性存疑。
  2. tooltip 键未本地化tooltip = my_key 对应的本地化字符串若未在 .yml 文件中定义,游戏内会直接显示原始 key 字符串而非提示文本,这个错误在 error.log 中不会有明显报错,极易被忽略。

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

custom_trigger_tooltip is a backward-compatible alias for custom_override_tooltip, commonly found in legacy mods to replace the tooltip text displayed to players within condition blocks, presenting complex logical checks as more user-friendly localized strings. For example, hiding internal variable checks within a focus's available block and showing only player-readable condition descriptions:

available = {
    custom_trigger_tooltip = {
        tooltip = my_focus_requirement_tt
        check_variable = { var = my_mod_progress value = 5 compare = greater_than }
    }
}

Synergy

  • [custom_override_tooltip](/wiki/trigger/custom_override_tooltip): This is its modern equivalent command. New mods are recommended to migrate uniformly to this command; both can be mixed within the same condition block to differentiate legacy and new logic.
  • [check_variable](/wiki/trigger/check_variable): Most commonly used as the inner check wrapped by custom_trigger_tooltip, concealing variable value comparisons behind custom tooltip text.
  • [if](/wiki/trigger/if): Using in combination enables "display custom tooltip only under specific conditions," making UI feedback more conditional.
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): The corresponding tooltip override mechanism on the effect side. Custom tooltips for triggers and effects typically appear in pairs to maintain consistent UI styling.

Common Pitfalls

  1. Should not be prioritized in new mods: Many developers copy this command from legacy tutorials without noticing that the official recommendation has shifted to custom_override_tooltip, resulting in inconsistent code style and questionable future compatibility.
  2. Tooltip key not localized: If the localization string corresponding to tooltip = my_key is not defined in the .yml file, the game will display the raw key string instead of the tooltip text. This error often goes unnoticed in error.log without obvious warnings, making it easy to overlook.