Trigger API Reference DCEI Functions Region0 - BLKTower/TestWiki GitHub Wiki

Table of Contents

Trigger API Reference\DCEI Functions\Region {Trigger-API-ReferenceDCEI-FunctionsRegion}

Region CreateRegion(float x, float z, float w, float h) {Region-CreateRegionfloat-x-float-z-float-w-float-h}

Region CreateRegion(float x, float z, float w, float h)

Description

Creates a dynamic region.

Parameters

  • float x the x coordinate of the new region.
  • float z the z coordinate of the new region.
  • float w the width of the new region.
  • float h the height of the new region.

Example Usage

local region = DCEI.CreateRegion(16, 16, 4, 4)

void RemoveRegion(Region region) {void-RemoveRegionRegion-region}

void RemoveRegion(Region region)

Description

Parameters

Example Usage

void RemoveRegionSync(Region region) {void-RemoveRegionSyncRegion-region}

void RemoveRegionSync(Region region)

⚠️Warning⚠️: This api was deprecated at 7/19/2022, and will be removed after 90 days.

Description

Removes a region.

Parameters

  • Region region region to remove

Example Usage

function OnRegionLeave()
    local r = DCEI.TriggeringRegion
    DCEI.RemoveRegionSync(r)
end

DCEI.TriggerAddUnitEnterRegionEvent(DCEI.UnitAny, region, OnRegionLeave)

Region FindRegion(string name) {Region-FindRegionstring-name}

Region FindRegion(string name)

Description

Returns a region by name. Currently only works for regions pre-placed in the terrain editor.

Parameters

  • string name the name of the existing region to return.

Example Usage

local region = DCEI.FindRegion("region_a")

bool RegionExists(string name) {bool-RegionExistsstring-name}

bool RegionExists(string name)

Description

Returns true if the region exists. Currently only works for regions pre-placed in the terrain editor.

Parameters

  • string name name of the region to check.

Example Usage

function OnRegionEnter()
  SCORE = SCORE + 1
end

local region = DCEI.FindRegion("region_a")
if DCEI.RegionExists(region) then
    DCEI.TriggerAddUnitEnterRegionEvent(DCEI.UnitAny, region, OnRegionEnter)

string GetRegionName(Region region) {string-GetRegionNameRegion-region}

string GetRegionName(Region region)

Description

Returns the name of a region. Currently only works for regions pre-placed in the terrain editor.

Parameters

  • Region region the region to get the name of.

Example Usage

function OnRegionEnter()
    local u = DCEI.TriggeringUnit
    local r = DCEI.TriggeringRegion

    local region_name = DCEI.RegionName(r)
    if region_name = "goal_region" then
        SCORE = SCORE + 1
    end
end

DCEI.TriggerAddUnitEnterRegionEvent(DCEI.UnitAny, DCEI.RegionAny, OnRegionEnter)

Float2 GetRandomPointInRegion(Region region) {Float2-GetRandomPointInRegionRegion-region}

Float2 GetRandomPointInRegion(Region region)

Description

Returns the coordinates of a random point in the region.

Parameters

  • Region region the region to find a random point in.

Example Usage

local region = DCEI.CreateRegion(16, 16, 4, 4)
local random_point = DCEI.GetRandomPointInRegion(region)

Float2 GetCenterOfRegion(Region region) {Float2-GetCenterOfRegionRegion-region}

Float2 GetCenterOfRegion(Region region)

Description

Returns the coordinates of the center point of the region.

Parameters

  • Region region the region to find the center point of.

Example Usage

local region = DCEI.CreateRegion(16, 16, 4, 4)
local center_point = DCEI.GetCenterOfRegion(region)

Float2 GetSizeOfRegion(Region region) {Float2-GetSizeOfRegionRegion-region}

Float2 GetSizeOfRegion(Region region)

Description

Returns the X and Y dimensions of the region.

Parameters

  • Region region the region to find the dimensions of.

Example Usage

local region = DCEI.CreateRegion(16, 16, 4, 4)
local region_size = DCEI.GetSizeOfRegion(region)

bool CheckPointInRegion(Region region, float x, float z) {bool-CheckPointInRegionRegion-region-float-x-float-z}

bool CheckPointInRegion(Region region, float x, float z)

Description

Returns true if coordinates are within the region.

Parameters

  • Region region the region to find the dimensions of.
  • float x the x coordinate of the point.
  • float z the z coordinate of the point.

Example Usage

    local SCORE = 0
    local region = DCEI.CreateRegion(16, 16, 4, 4)

    if DCEI.CheckPointInRegion(region, 14, 18) then
        SCORE = SCORE + 1
    end

object GetUnitsInRegion(Region region) {object-GetUnitsInRegionRegion-region}

object GetUnitsInRegion(Region region)

Description

Returns a table of the units within the region.

Parameters

  • Region region the region to find the units within.

Example Usage

local region = DCEI.CreateRegion(16, 16, 4, 4)
local units_in_region = DCEI.GetUnitsInRegion(region)

void HideRegion(Region region) {void-HideRegionRegion-region}

void HideRegion(Region region)

Description

Obscures the region on the map from the player.

Parameters

  • Region region the region to obscure (creates fog of war).

Example Usage

local region = DCEI.CreateRegion(16, 16, 4, 4)
DCEI.HideRegion(region)

void RevealRegion(Region region) {void-RevealRegionRegion-region}

void RevealRegion(Region region)

Description

Reveals a previously hidden region on the map to the player (clears fog of war).

Parameters

  • Region region the region to reveal.

Example Usage

local region = DCEI.CreateRegion(16, 16, 4, 4)
DCEI.HideRegion(region)
DCEI.RevealRegion(region)

void MoveRegion(Region region, float x, float z) {void-MoveRegionRegion-region-float-x-float-z}

void MoveRegion(Region region, float x, float z)

Description

Moves the center of the region to the specified coordinates.

Parameters

  • Region region the region to move.
  • float x the x coordinate to move the region to.
  • float z the z coordinate to move the region to.

Example Usage

local region = DCEI.CreateRegion(16, 16, 4, 4)
DCEI.MoveRegion(region, 10, 10)

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