Built In UI Functions Overview - BLKTower/TestWiki GitHub Wiki

Overview

This page covers the editor's currently available built-in UI functions. These are hardcoded functions you may find useful for quick prototyping. For more advanced UI, you'll want to build your own.

Download the example map here.

Big Head Message

Displays a "big head" image with a title and text.

local bighead_images = {
    "bighead_hero_smith",
    "bighead_hero_windknight",
    "bighead_hero_icemage_02",
    "bighead_hero_chosengirl",
    "bighead_hero_alchemist",
    "bighead_hero_lastdragoon"
}

local title = "Hero"
local text = "This is a \"Big Head\" Message!"
local image = bighead_images[math.random(1, #bighead_images)]

DCEI.ShowBigHeadMessage(title, text, image)
DCEI.HideBigHeadMessage()

big_head

Circle Menu

Displays a circular command card for a unit that displays up to six abilities.

-- 0 is the command card index

DCEI.ShowAbilitiesUi(0, unit)
DCEI.HideAbilitiesUi(0, unit)

circle_menu

Fast Forward Button

Hide the fast forward button.

DCEI.HideFastForwardButton()

speed up

Feedback Message

Displays a feedback message in the middle of the screen.

local text = "This is a feedback message."

DCEI.ShowFeedbackMessage(text)

feedback_msg

Floating Text

Create floating text at a unit.

-- use anim_id = 0 for bounce-in animation
-- use anim_id = 1 for float-up animation

local pos = DCEI.GetUnitPosition3D(unit)
local text = "<color=green>" .. "text!"
local anim_id = 0
local show_duration = 0.5
local anim_duration = 1

--optional offset options
local options = { 
    offset = {
        up = 1.25,
        right = 0,
        front = 0
    }
}

DCEI.ShowFloatingText(
    pos,
    text,
    show_duration,
    anim_id,
    anim_duration,
    options
)

floating_text

Help Button

Shows a help button that runs a function when clicked, commonly combined with a message box to give gameplay tips.

function ShowQuestionMessage()
    local title = "Another Message"
    local body = "The question button runs a function when pressed, such as showing a message box."  
    local button_text = "Continue"
    DCEI.ShowMessageWithButtonText(title, body, button_text)
end

DCEI.SetQuestionButton(ShowQuestionMessage)

question_btn

Hero Status

Shows a portrait, health bar, mana bar, and ability cast button for a unit.

DCEI.ShowUnitStatusUiInSlot(3, hero, slot)  -- shows unit status
DCEI.ShowAbilitiesUiInSlot(2, hero, slot)   -- shows ability button
DCEI.HideUnitStatusUi(3, unit)  -- hides unit status (this doesn't seem to work)
DCEI.HideAbilitiesUi(2, unit)   -- hides ability button

hero_status

Left Menu

Shows a mana bar and ability buttons for a unit.

DCEI.ShowShipSpellMenu()        
DCEI.ShowUnitStatusUi(2, unit)  -- shows mana bar
DCEI.ShowAbilitiesUi(1, unit)   -- shows abilities
DCEI.HideShipSpellMenu()        
DCEI.HideUnitStatusUi(2, unit)  -- hides mana bar
DCEI.HideAbilitiesUi(1, unit)   -- hides abilities

left_menu

Message Box

Displays a modal message box that pauses gameplay and masks user input until dismissed.

local title = "Message Title"
local body = (
    "This is a message box. It pauses the game.\n" ..
    "It supports multiple lines.\n" ..
    "And also <color=yellow>rich text</color><size=125%>!</size></color><size=175%>!</size></color><size=125%>!</size>\n" ..
    "It also supports images, but you can't use custom images yet so this is of limited use."
)     
local button_text = "Continue"
        
DCEI.ShowMessageWithButtonText(title, body, button_text)  

message_box

Objective Display

Shows objective text in the upper left corner of the screen.

DCEI.ShowObjective("- Objective Text")
DCEI.HideObjective()

objective_text

Screen Mask

Shows a screen mask with or without alpha that completely blocks mouse input while shown.

local alpha_value = 0.5

DCEI.ShowScreenMaskWithAlpha(alpha_value)
DCEI.ShowScreenMask() -- functionally the same as as DCEI.ShowScreenMaskWithAlpha(0)
DCEI.HideScreenMask()

screen_mask

Slow Motion FX

Overlays a vignette and some particle FX.

DCEI.ShowSlowMotionEffect()
DCEI.HideSlowMotionEffect()

slow_mo

Speech Bubble

Attach a speech bubble with a title to a unit.

local max_width = 320
local text = "Hello!"
local title = "Slime"

-- optional offset options
local options = {   
    up = 0.5,
    right = 0,
    front = 0
}

DCEI.ShowSpeechBubble(unit, max_width, text, title, options)
DCEI.HideSpeechBubble(unit)

speech_bubble

Unit Label

Attach static text to a unit. Supports rich text.

local text = "Some Text"

-- optional offset options
local options = {   
    offset = {
        right = 0,
        up = 0.5,
        front = 0
    }
}

-- shows unit label
DCEI.ShowUnitLabel(unit, text, options)
-- hides unit label
DCEI.HideUnitLabel(unit)

ui_unit_label

⚠️ **GitHub.com Fallback** ⚠️