About this mod
Add more fine-grained control of HUD elements, including customizable automatic rules and hotkeys for quickly showing or hiding parts of the UI.
- Requirements
- Permissions and credits
- Changelogs
With this mod, UI element visibility can be bound to automatically show or hide based on certain conditions like being in battle, having weapons drawn, player remaining HP, etc. There is also the ability to bind any keyboard or controller key to toggle visibility, or to show the UI element only while a key is being pressed down.
Default hotkeys are F1 to toggle control guides, hold F2 for minimap and player/pawn HP, F3 to toggle dialogue, and F4 to toggle most of the other less important UI.
Configuration
All behaviour can be configured via the REFramework's ingame Script Generated UI, there is also some additional help text ingame.
Configurable UI elements:
- Minimap
- Control guide
- Dialogue subtitles
- Floating subtitles
- Player HUD (HP, stamina, status)
- Pawn HUD (HP, status)
- Enemy HP
- Boss HP
- Location names
- Items/Gold Received
- 3D text hints (item pickup and NPC interaction)
- Save indicator
- Optionally can also hide literally every piece of UI
Available additional display conditions:
- In / out of combat
- In / outside of town
- Weapons drawn / not drawn
- Player HP below / above a percentage
- Player stamina below / above a percentage
- Pawn HP percentage (for pawn HP bars)
- Enemy HP percentage (for enemy HP bars)
- Whether speaker speaks elvish, pawn random chatter, pawn dialogue (for dialogue subtitles)
- Important item interaction (golden trove beetle or seeker's token)
All the settings are stored in GAMEDIR/reframework/data/hud_control_settings.json so if for some reason you want to edit it manually or backup the config, it's there. If it doesn't exist it will get created when you change any setting ingame. If you want to revert to the default config, just delete the file.
Installation
Enable with fluffy mod manager or manually paste the lua files into GAME_DIR/reframework/autorun.
The ingame interface settings must be set to show = Yes or Auto, otherwise I can't make it show up, since the mod just adds an additional "Don't show up" check.
Compatibility
My display switches are done dynamically through code so any recolors or repositioning from other mods should not affect it at all. Should be compatible with anything that doesn't change the structure of the GUI objects. I don't think there are any currently released mods that do so, but feel free to prove me wrong.
If it doesn't work, you can try reinstalling one or the other mod just in case.
Display condition evaluation
1. If Hold key is held down, show
2. If global toggle is hidden, hide
3. Check other condition rules (hp/stamina%, is in/out of battle, is in/outside of town, ...) and combine them to choose whether to show or not
4. Toggle button behaviour can be set to either override conditional rules or not
Modding API
A global hud_controls lua object is exposed that provides some methods that can be used to adjust the behaviour. It has full type annotations so you can use that to figure out what options are available. If anything's unclear, ask.
High level wise, things that the API lets you do:
- get or modify any existing settings
- define additional GUIs that my mod doesn't necessarily know about, including any custom mod UI
- define custom display rules
- add additional options for existing GUIs (similar to the minimap's compass mode); The mod provides a callback for rendering the settings, the actual logic must be implemented on the caller's side.
Basic usage example for a custom imgui-based UI:
local hud_controls = require('dd2_hud_controls')
local hud_settings = hud_controls.define_ui('my_mod_name', {
label = 'Editor display label'
})
...
local shouldShow = hud_controls.calculate_alpha(hud_settings) > 0
if shouldShow then
imgui.text('Hello world!')
end