Tooltips ​
A tooltip is the small window that appears when the player points at something: an item, an ability, a buff, a node of a skill tree, a button. The toolkit has six tooltips, one for each kind of thing it describes. They are made once, when the game starts, and one of each is reused for every request.
| Tooltip | Root class | Shown for | Template (in ui_scenes/in_game/tooltips/) |
|---|---|---|---|
| Item | TooltipItem | An item in a bag, the equipment, a shop, a loot window | items/tooltip_item_template.tscn |
| Ability | TooltipAbility | An ability in the spellbook, on the action bar, in a trainer's list | abilites/tooltip_ability_template.tscn |
| Effect | TooltipEffect | A buff or a debuff icon | tooltip_effect_template.tscn |
| Skill node | TooltipSkillNode | A node of a skill tree (and the choices of a choice node) | tooltip_skill_node_template.tscn |
| Description | TooltipDescription | Anything with a name and a text: the buttons of the mini menu, a stat | tooltip_description_template.tscn |
| Entity | TooltipEntity | An NPC, a pet, a party member or an object under the pointer | tooltip_entity_template.tscn |
They are set in UI Settings. All five extend TooltipBase, which brings the common look and the placement.
The entity tooltip ​
Pointing at an NPC, a pet, a party member or an object (its body or its nameplate) shows the entity tooltip. It is deliberately short:
| Line | Where it comes from |
|---|---|
| Name | The name of the entity, in the color of a tag that asks for it |
| Tags | The entity tags it has that want to be listed (Show the tag in the tooltip), the highest priority first, in the color of the first |
| Type | Its entity types (Humanoid, Undead). Hidden when it has none |
| Level | Level 12. Hidden for an object |
| Faction | The name of its faction. Hidden for the environmental faction |
| Standing | What the player is to that faction: the name of the reputation level when the faction has levels (Honored), otherwise Friendly, Neutral or Hostile. In the color the nameplates use for that relation |
| Description | The Description written on the NPC or object definition |
| Quests | The active quest objectives that are about it: the NPC to defeat or talk to, the chest to open, the gathering node. Each line is the quest, the objective and its progress (Hunt for glory: Defeat 3 Wolves (1/3)). Hidden when none is |
An entity tag can also put art at the top of the tooltip (Tooltip art), for a boss crest or a banner.
Every part is optional. The tooltip looks for each node by its unique name and fills it only if the node is in the scene. To get a tooltip with the parts you want, add or remove nodes in your own copy of tooltip_entity_template.tscn:
| Unique name | Type | Shows |
|---|---|---|
%EntityNameLabel | Label | The name |
%TagsLabel | Label | The listed entity tags |
%EntityTypeLabel | Label | The entity types |
%LevelLabel | Label | The level |
%FactionLabel | Label | The faction |
%StandingLabel | Label | The standing of the player |
%DescriptionLabel | Label | The description |
%TagArt | TextureRect | The art of the tag |
%ObjectivesContainer | any Control | The part that holds the quest lines. Hidden when no objective is about the target |
%ObjectivesLabel | Label | The quest lines |
A part with nothing to show is hidden. A node that is not in the scene is never touched.
The tooltip is set in UI Settings (Entity tooltip). Leave the setting empty and no tooltip is shown for entities. To show it from your own part of the interface, emit entity_tooltip_requested(target) and hide_tooltip(false) like the others; the in-game interface already does it when the pointer goes over an entity or an object.
How a tooltip is requested ​
Nothing in the interface shows a tooltip directly. A part (a slot, a button, an icon) emits a signal, and the signal travels up to the UI manager, which tells the right tooltip to show:
text
an item slot ─ item_tooltip_requested(item, definition, context, extra) ─► the in-game UI ─► the UI manager ─► the item tooltipEvery HUD element and every panel has these signals already, so a part you make only has to emit them:
| Signal | Arguments |
|---|---|
item_tooltip_requested | the item instance, its definition, a context, extra data |
ability_tooltip_requested | the ability |
effect_tooltip_requested | the effect |
skill_node_tooltip_requested | the skill node |
description_tooltip_requested | a name, a text |
entity_tooltip_requested | an entity or an object |
hide_tooltip | force_hide |
hide_tooltip hides all of them. Emit it when the mouse leaves.
The item tooltip's context ​
The item tooltip changes what it shows by the context it is asked for:
| Context | Shows |
|---|---|
inventory | The value of the item |
vendor_buying | What the player pays |
vendor_selling | What the vendor pays the player |
An item instance shows full detail (the rolled affixes of a generated item, durability, charges, the sockets that are filled, the set pieces that are worn); an item definition alone (a shop's stock, a recipe's result) shows the basics.
Placement ​
A tooltip is a MarginContainer drawn above the rest of the interface, kept at least a few pixels inside the screen. Each tooltip scene has its own placement, set on the root node of the scene (the Placement group):
| Export | What it does | Default |
|---|---|---|
| Placement | Mouse: next to the mouse pointer, with its bottom right corner on it. Fixed: at a place of the screen of your choice, whatever the mouse does | Mouse |
| Fixed corner | For a fixed tooltip: the corner of the screen it is placed from (top left, top right, bottom left, bottom right, center). The same corner of the tooltip is put on that point, so it grows away from the corner | Bottom right |
| Fixed offset | For a fixed tooltip: the distance from that corner in pixels, towards the inside of the screen. From the center: right and down | 16, 16 |
For example, to show the item tooltip in a box in the top right corner of the screen like a character sheet: open tooltip_item_template.tscn, set Placement to Fixed, Fixed corner to Top right and Fixed offset to 20, 80. Each tooltip can differ: the item tooltip fixed, the ability tooltip on the mouse.
Styling ​
The tooltips share the label settings of TooltipBase, set on the root node of each scene:
| Option | What it sets |
|---|---|
| Font, Font size | The text of every label (except the item name) |
| Outline size and color | The outline |
| Shadow size, color and offset | The shadow |
Beyond that, the look (backgrounds, borders, spacing) is plain scenes: restyle them as you like.
Making your own ​
For each tooltip scene, keep the root class and the unique names its script reads (open the script to see them: each is a short @onready list at the top). You can add anything else. For example, to add a line to the ability tooltip, add a Label to the scene and fill it in a subclass: class_name MyTooltipAbility extends TooltipAbility, override set_tooltip_data.
Set the new scene in UI Settings. The settings editor checks that the root of each is the right class.
See also ​
- UI Settings
- HUD (the signals of an element)
- Effects (the description shown on an effect tooltip)