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

Table of Contents

Trigger API Reference\DCEI Functions\Terrain (1/2) {Trigger-API-ReferenceDCEI-FunctionsTerrain-12}

void EnableRoute(string routeName, bool enable) {void-EnableRoutestring-routeName-bool-enable}

void EnableRoute(string routeName, bool enable)

Description

Enable/disable a waypoints route according to route name.

Parameters

  • string routeName the name of the route.
  • bool enable if true, enabel the route.

Example Usage

DCEI.EnableRoute("test_route", true)

Float2 GetMapSize() {Float2-GetMapSize}

Float2 GetMapSize()

Description

Returns the X and Z dimensions of the map.

Example Usage

local map_dim = DCEI.GetMapSize()
DCEI.LogMessage("Map Dim X: " .. map_dim.x .. " Map Dim Z: " .. map_dim.y)

Float2 GetMapCenterPoint() {Float2-GetMapCenterPoint}

Float2 GetMapCenterPoint()

Description

Returns the X and Z coordinates of the center of the map.

Example Usage

local map_center = DCEI.GetMapCenterPoint()
DCEI.LogMessage("Map Center X: " .. map_center.x .. " Map Center Z: " .. map_center.y)

int GetTerrainTypeAtPoint(float x, float z) {int-GetTerrainTypeAtPointfloat-x-float-z}

int GetTerrainTypeAtPoint(float x, float z)

Description

Returns the terrain type at the given point. Returns 0-4 depending on the texture painted at the point, with 0 being the default texture. Ignores terrain features such as cliffs, borders, and water - this returns the texture that would otherwise be painted on the tile.

Parameters

  • float x the X coordinate of the point.
  • float z the Z coordinate of the point.

Example Usage

local terrain_type = DCEI.GetTerrainTypeAtPoint(16, 16)

float GetTerrainHeightAtPoint(float x, float z) {float-GetTerrainHeightAtPointfloat-x-float-z}

float GetTerrainHeightAtPoint(float x, float z)

Description

Returns the terrain height at the given point. Values can range from 5 to -5. Default terrain height is 0, border height defaults to -1. Ignores water height.

Parameters

  • float x the X coordinate of the point.
  • float z the Z coordinate of the point.

Example Usage

local terrain_height = DCEI.GetTerrainHeightAtPoint(16, 16)

void ChangePropLayerDisplay(string layerName, bool display) {void-ChangePropLayerDisplaystring-layerName-bool-display}

void ChangePropLayerDisplay(string layerName, bool display)

Description

Enables or disables the display of a prop player.

Parameters

  • string layerName the name of the layer.
  • bool display if true, display the prop layer, otherwise hide the prop layer.

Example Usage

DCEI.ChangePropLayerDisplay("layer_1", false)

void LoadPropLayer(string layerName, bool initialDisplay) {void-LoadPropLayerstring-layerName-bool-initialDisplay}

void LoadPropLayer(string layerName, bool initialDisplay)

Description

Loads the prop layer into memory. If prop layer has already been loaded, does nothing. Layers may need to be unloaded via DCEI.UnloadPropLayer(string layerName) first.

Parameters

  • string layerName the name of the layer.
  • bool InitialDisplay if true, display the prop layer when the game first loads.

Example Usage

function OnRegionEnter()
    DCEI.LoadPropLayer("layer_1", true)
end

DCEI.UnloadPropLayer("layer_1")
DCEI.TriggerAddUnitEnterRegionEvent(DCEI.UnitAny, DCEI.RegionAny, OnRegionEnter)

Related

void UnloadPropLayer(string layerName) {void-UnloadPropLayerstring-layerName}

void UnloadPropLayer(string layerName)

Description

Unloads the given prop layer from memory, preventing it from being displayed. Prop layers unloaded can be reloaded via DCEI.LoadPropLayer(string layerName, bool initialDisplay).

Parameters

  • string layerName the name of the layer.

Example Usage

function OnRegionEnter()
    DCEI.LoadPropLayer("layer_1", true)
end

DCEI.UnloadPropLayer("layer_1")
DCEI.TriggerAddUnitEnterRegionEvent(DCEI.UnitAny, DCEI.RegionAny, OnRegionEnter)

Related

bool GetPropLayerLoadStatus(string layerName) {bool-GetPropLayerLoadStatusstring-layerName}

bool GetPropLayerLoadStatus(string layerName)

Description

Returns true if given prop layer is loaded.

Parameters

  • string layerName the name of the layer.

Example Usage

function OnRegionEnter()
    DCEI.LoadPropLayer("layer_1", true)
    DCEI.LogMessage(tostring(DCEI.GetPropLayerLoadStatus("layer_2")))
end

DCEI.UnloadPropLayer("layer_1")
DCEI.TriggerAddUnitEnterRegionEvent(DCEI.UnitAny, DCEI.RegionAny, OnRegionEnter)

Related

Float3 GetTerrainChunkPosition(string chunkName) {Float3-GetTerrainChunkPositionstring-chunkName}

Float3 GetTerrainChunkPosition(string chunkName)

Description

Returns the 3D position of a terrain chunk.

Parameters

  • string chunkName the name of the terrain chunk.

Example Usage

local terrain_chunk_pos = DCEI.GetTerrainChunkPosition("terrain_chunk_0")
DCEI.LogMessage("X: " .. terrain_chunk_pos.x)
DCEI.LogMessage("Y: " .. terrain_chunk_pos.y)
DCEI.LogMessage("Z: " .. terrain_chunk_pos.z)

bool SetTerrainChunkPosition(string chunkName, Float3 pos) {bool-SetTerrainChunkPositionstring-chunkName-Float3-pos}

bool SetTerrainChunkPosition(string chunkName, Float3 pos)

Description

Sets the position of a terrain chunk. Returns true if the terrain chunk position was set successfully.

Parameters

  • string chunkName the name of the terrain chunk.
  • Float3 pos the new coordinates for the center of the terrain chunk.

Example Usage

DCEI.LogMessage(tostring(DCEI.SetTerrainChunkPosition("terrain_chunk_0", {x = 16, y = -1, z = 16})))

bool SetTerrainChunkPositionWithInterpolation(string chunkName, Float3 pos, float duration) {bool-SetTerrainChunkPositionWithInterpolationstring-chunkName-Float3-pos-float-duration}

bool SetTerrainChunkPositionWithInterpolation(string chunkName, Float3 pos, float duration)

Description

Sets the 3D position of a terrain chunk while animating it to that position. Returns true if the position was set successfully.

Parameters

  • string chunkName the name of the terrain chunk.
  • Float3 pos the new coordinates for the center of the terrain chunk.
  • float duration the time taken for the terrain chunk to reach its destination.

Example Usage

DCEI.LogMessage(tostring(DCEI.SetTerrainChunkPositionWithInterpolation("terrain_chunk_0", {x = 16, y = -1, z = 16}, 5)))

int InstantiateTerrainChunk(string chunkName, Float3 pos) {int-InstantiateTerrainChunkstring-chunkName-Float3-pos}

int InstantiateTerrainChunk(string chunkName, Float3 pos)

Description

Instantiates a terrain chunk at the given location and returns the instanceId of the terrain chunk instance. Returns 0 on failure.

Parameters

  • string chunkName the name of the terrain chunk to create an instance of.
  • Float3 pos the coordinates for the center of the terrain chunk instance.

Example Usage

local terrain_chunk_instance = DCEI.InstantiateTerrainChunk("terrain_chunk_0", {x = 16.5, y = -1.1, z = 16.5})
DCEI.LogMessage("Terrain Chunk instance ID: " .. terrain_chunk_instance)

void DestroyTerrainChunkInstance(int instanceId) {void-DestroyTerrainChunkInstanceint-instanceId}

void DestroyTerrainChunkInstance(int instanceId)

Description

Destroys a terrain chunk instance.

Parameters

  • int instanceId the instanceId assigned to the terrain chunk instance.

Example Usage

DCEI.DestroyTerrainChunkInstance(1)

Float3 GetTerrainChunkInstancePosition(int instanceId) {Float3-GetTerrainChunkInstancePositionint-instanceId}

Float3 GetTerrainChunkInstancePosition(int instanceId)

Description

Returns the 3D position of a terrain chunk instance.

Parameters

  • int instanceId the instanceId assigned to the terrain chunk instance.

Example Usage

local terrain_chunk_position = DCEI.GetTerrainChunkInstancePosition(1)

bool SetTerrainChunkInstancePosition(int instanceId, Float3 pos) {bool-SetTerrainChunkInstancePositionint-instanceId-Float3-pos}

bool SetTerrainChunkInstancePosition(int instanceId, Float3 pos)

Description

Sets the 3D position of a terrain chunk instance. Returns true if the position was set successfully.

Parameters

  • int instanceId the instanceId assigned to the terrain chunk instance.
  • Float3 pos the new coordinates for the center of the terrain chunk instance.

Example Usage

DCEI.LogMessage(tostring(DCEI.SetTerrainChunkInstancePosition(1, {x = 11.5, y = 0.4, z = 14.5})))

bool SetTerrainChunkInstancePositionWithInterpolation(int instanceId, Float3 pos, float duration) {bool-SetTerrainChunkInstancePositionWithInterpolationint-instanceId-Float3-pos-float-duration}

bool SetTerrainChunkInstancePositionWithInterpolation(int instanceId, Float3 pos, float duration)

Description

Sets the 3D position of a terrain chunk instance while animating it to that position. Returns true if the position was set successfully.

Parameters

  • int instanceId the instanceId assigned to the terrain chunk instance.
  • Float3 pos the new coordinates for the center of the terrain chunk instance.
  • float duration the time taken for the terrain chunk instance to reach its destination.

Example Usage

DCEI.LogMessage(tostring(DCEI.SetTerrainChunkInstancePositionWithInterpolation(1, {x = 12.5, y = 3, z = 12.5}, 5)))

int GetWeather() {int-GetWeather}

int GetWeather()

Description

Returns an integer corresponding to the weather. Does not detect the heatwave option. 0 - None 1 - Rain 2 - Snow

Example Usage

local weather = DCEI.GetWeather()

void SetWeather(int weatherStatus, float duration) {void-SetWeatherint-weatherStatus-float-duration}

void SetWeather(int weatherStatus, float duration)

Description

Sets a weather status over the given duration. Use 0 for an instant transition. Cannot set the heatwave option. 0 - None 1 - Rain 2 - Snow

Parameters

  • int weatherStatus the integer corresponding to a weather status.
  • float duration the transition duration.

Example Usage

DCEI.SetWeather(1, 50)

int GetTimeOfTheDay() {int-GetTimeOfTheDay}

int GetTimeOfTheDay()

Description

Returns an integer corresponding to the time of the day. 0 - Noon 1 - Night 2 - Void

Example Usage

local time_lighting = DCEI.DCEI.GetTimeOfTheDay()

void SetTimeOfTheDay(int timeOfTheDay, float duration) {void-SetTimeOfTheDayint-timeOfTheDay-float-duration}

void SetTimeOfTheDay(int timeOfTheDay, float duration)

Description

Sets a time of the day over the given duration. Use 0 for an instant transition. 0 - Noon 1 - Night 2 - Void

Parameters

  • int timeOfTheDay the integer corresponding to a timeOfTheDay.
  • float duration the transition duration.

Example Usage

DCEI.SetTimeOfTheDay(2, 10)

ColorRGB GetCurrentLightColor() {ColorRGB-GetCurrentLightColor}

ColorRGB GetCurrentLightColor()

Description

Example Usage

ColorRGB GetCurrentLightColorRGB() {ColorRGB-GetCurrentLightColorRGB}

ColorRGB GetCurrentLightColorRGB()

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

Description

Get the current light's RGB value

Example Usage

void SetOverrideLightColor(ColorRGB color, float duration) {void-SetOverrideLightColorColorRGB-color-float-duration}

void SetOverrideLightColor(ColorRGB color, float duration)

Description

Parameters

Example Usage

void SetOverrideLightColorRGB(ColorRGB color, float duration) {void-SetOverrideLightColorRGBColorRGB-color-float-duration}

void SetOverrideLightColorRGB(ColorRGB color, float duration)

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

Description

Set light color RGB value for a period of time

Parameters

Example Usage

void SetSkyboxColor(ColorRGB color, float duration) {void-SetSkyboxColorColorRGB-color-float-duration}

void SetSkyboxColor(ColorRGB color, float duration)

Description

Parameters

Example Usage

void SetSkyboxColorRGB(ColorRGB color, float duration) {void-SetSkyboxColorRGBColorRGB-color-float-duration}

void SetSkyboxColorRGB(ColorRGB color, float duration)

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

Description

Set skybox RGB color value for a period of time.

Parameters

Example Usage

void ResetSkyboxColor(float duration) {void-ResetSkyboxColorfloat-duration}

void ResetSkyboxColor(float duration)

Description

Resets the skybox color to the default over the given duration. Use 0 for an instant transition.

Parameters

  • float duration the transition duration.

Example Usage

DCEI.ResetSkyboxColor(10)

int AddLine(Float3 startPos, Float3 endPos, float width, ColorRGBA color, bool rectCap) {int-AddLineFloat3-startPos-Float3-endPos-float-width-ColorRGBA-color-bool-rectCap}

int AddLine(Float3 startPos, Float3 endPos, float width, ColorRGBA color, bool rectCap)

Description

Parameters

Example Usage

int AddLineColorRGBA(Float3 startPos, Float3 endPos, float width, ColorRGBA color, bool rectCap) {int-AddLineColorRGBAFloat3-startPos-Float3-endPos-float-width-ColorRGBA-color-bool-rectCap}

int AddLineColorRGBA(Float3 startPos, Float3 endPos, float width, ColorRGBA color, bool rectCap)

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

Description

Parameters

Example Usage

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