Trigger API Reference\DCEI Functions\Tutorial

void ShowWorldPositionHelper(float x, float z)

void ShowWorldPositionHelper(float x, float z)

Description


Shows the position helper hand at the specified coordinates. This will replace previous position helpers.

Parameters

Example Usage

DCEI.ShowWorldPositionHelper(16, 16)

DCEI.TriggerAddTimerEventElapsed(function()
    DCEI.HideWorldPositionHelper()
end, 2)

void HideWorldPositionHelper()

void HideWorldPositionHelper()

Description


Hides the position helper.

Example Usage

DCEI.ShowWorldPositionHelper(16, 16)

DCEI.TriggerAddTimerEventElapsed(function()
    DCEI.HideWorldPositionHelper()
end, 2)

void BlockGameWorld()

void BlockGameWorld()

Description


Blocks the player from interacting with the game world. Removes any active whitelist(s). An exception to this is joystick input.

Example Usage

-- Creates a unit
local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, y = 16, 16
local unit = DCEI.CreateUnit(team_id, player_id, unit_type, x, y)

-- Blocks the game world, except the unit
DCEI.BlockGameWorld()
DCEI.WhitelistUnit(unit)

-- When the function is triggered, unblocks the game world
function OnSelect()
    DCEI.UnblockGameWorld()
end

-- Sets the function to when the unit is selected
DCEI.TriggerAddUnitSelectedEvent(unit, OnSelect)

void WhitelistUnit(unit u)

void WhitelistUnit(unit u)

Description


Whitelists a unit for player selection while normal input is blocked with DCEI.BlockGameWorld(). In isolation, this will allow a player to select a unit but not issue movement or other commands to it.

Parameters

Example Usage

-- Creates a unit
local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, y = 16, 16
local unit = DCEI.CreateUnit(team_id, player_id, unit_type, x, y)

-- Blocks the game world, except the unit
DCEI.BlockGameWorld()
DCEI.WhitelistUnit(unit)

-- When the function is triggered, unblocks the game world
function OnSelect()
    DCEI.UnblockGameWorld()
end

-- Sets the function to when the unit is selected
DCEI.TriggerAddUnitSelectedEvent(unit, OnSelect)

void WhitelistWorldPosition(float x, float z, float radius)

void WhitelistWorldPosition(float x, float z, float radius)

Description


Whitelists a map position for player interaction while normal input is blocked with DCEI.BlockGameWorld().

Parameters

Example Usage

DCEI.BlockGameWorld()
DCEI.WhitelistUnit(unit)
DCEI.WhitelistWorldPosition(20, 16, 2)

void WhitelistUi(InGameUILayoutComponent ui)

void WhitelistUi(InGameUILayoutComponent ui)

Description


Whitelists the given UI element while normal input is blocked with DCEI.BlockGameWorld()

Parameters

Example Usage

-- Creates a button
local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

-- Blocks the game world, except the button
DCEI.BlockGameWorld()
DCEI.WhitelistUi(button_layout.Button)

-- Unblocks the game world when the button is pressed
DCEI.SetOnClickCallback(button_layout.Button, function()
    DCEI.UnblockGameWorld()
end)

void UnblockGameWorld()

void UnblockGameWorld()

Description


Unblocks the game world, allowing user interaction again.

Example Usage

-- Creates a unit
local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, y = 16, 16
local unit = DCEI.CreateUnit(team_id, player_id, unit_type, x, y)

-- Blocks the game world, except the unit
DCEI.BlockGameWorld()
DCEI.WhitelistUnit(unit)

-- When the function is triggered, unblocks the game world
function OnSelect()
    DCEI.UnblockGameWorld()
end

-- Sets the function to when the unit is selected
DCEI.TriggerAddUnitSelectedEvent(unit, OnSelect)