Wiki

effect · effect_tooltip

Definition

  • Supported scope:any
  • Supported target:any

Description

Shows just tooltip of effects

实战 · 配合 · 坑

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

实战用法

effect_tooltip 用于在不真正执行效果的情况下,将某段效果的提示文本展示给玩家,常见于需要向玩家预告某个选项将来可能触发的结果、或者在 hidden_effect 外层补充说明文字。例如,在事件选项中,你已经把真正的效果写在 hidden_effect 里,但仍希望玩家在选项界面看到完整的说明,就可以用它来"假装"展示那段效果的 tooltip。

option = {
    name = my_event.1.a
    hidden_effect = {
        # 真正执行的复杂逻辑放这里,不会直接显示给玩家
        add_victory_points = { province = 3 value = 5 }
    }
    # 只展示 tooltip,不重复执行效果
    effect_tooltip = {
        add_victory_points = { province = 3 value = 5 }
    }
}

配合关系

  • [hidden_effect](/wiki/effect/hidden_effect):最典型的搭档——将实际执行逻辑藏进 hidden_effect,再用 effect_tooltip 在外层补回可见的 tooltip,避免效果被展示两次或逻辑暴露给玩家。
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip):当 effect_tooltip 展示的内容仍不够直观时,可额外用 custom_effect_tooltip 配合本地化字符串提供更友好的说明文字。
  • [if](/wiki/effect/if):在条件分支中,若某分支的效果只想在满足条件时才提示(而非执行),可将 effect_tooltip 嵌套在 if 块内,实现"条件性 tooltip"。

常见坑

  1. 误以为它会真正执行效果effect_tooltip 只渲染 tooltip 文字,不会对游戏状态产生任何实际改变。新手常在 hidden_effect 外同时写了 effect_tooltip 又漏掉 hidden_effect,导致效果根本没有执行,只是看起来"好像发生了"。
  2. custom_effect_tooltip 混用导致重复描述:若已经用 custom_effect_tooltip 写了自定义说明,再套一层 effect_tooltip 展示同样的内容,玩家会在 UI 中看到重复的两段 tooltip,需要仔细规划哪种方式负责最终展示。

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

effect_tooltip is used to display the tooltip text of an effect to the player without actually executing it. This is commonly used when you need to preview potential outcomes of an option to the player, or to add explanatory text outside a hidden_effect block. For example, in an event option where you've already placed the real logic in hidden_effect, you can still use this to "pretend" to show the tooltip of that effect in the option interface.

option = {
    name = my_event.1.a
    hidden_effect = {
        # The actual complex logic goes here, won't be directly displayed to the player
        add_victory_points = { province = 3 value = 5 }
    }
    # Only show the tooltip without re-executing the effect
    effect_tooltip = {
        add_victory_points = { province = 3 value = 5 }
    }
}

Synergy

  • [hidden_effect](/wiki/effect/hidden_effect): The classic pairing — hide the actual execution logic in hidden_effect, then use effect_tooltip at the outer layer to restore the visible tooltip, preventing effects from being displayed twice or logic from being exposed to the player.
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): When the content displayed by effect_tooltip still isn't intuitive enough, you can additionally pair it with custom_effect_tooltip using localization strings to provide friendlier explanatory text.
  • [if](/wiki/effect/if): In conditional branches, if you only want an effect to display as a tooltip in certain conditions (rather than execute), you can nest effect_tooltip inside the if block to achieve "conditional tooltips".

Common Pitfalls

  1. Mistakenly thinking it will actually execute the effect: effect_tooltip only renders the tooltip text and won't produce any actual changes to the game state. Beginners often write effect_tooltip outside hidden_effect while forgetting to include the hidden_effect block itself, resulting in the effect not executing at all — it just looks like "something happened".
  2. Mixing with custom_effect_tooltip causing duplicate descriptions: If you've already written custom explanatory text using custom_effect_tooltip, wrapping another layer of effect_tooltip displaying the same content will cause the player to see duplicate tooltip segments in the UI. You need to carefully plan which approach should handle the final display.