Trigger API Reference DCEI Functions Terrain0 - funovus/editor-wiki 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)
* [Float2 GetMapSize()](#float2-getmapsize)
* [Float2 GetMapCenterPoint()](#float2-getmapcenterpoint)
* [int GetTerrainTypeAtPoint(float x, float z)](#int-getterraintypeatpointfloat-x-float-z)
* [float GetTerrainHeightAtPoint(float x, float z)](#float-getterrainheightatpointfloat-x-float-z)
* [void ChangePropLayerDisplay(string layerName, bool display)](#void-changeproplayerdisplaystring-layername-bool-display)
* [void LoadPropLayer(string layerName, bool initialDisplay)](#void-loadproplayerstring-layername-bool-initialdisplay)
* [void UnloadPropLayer(string layerName)](#void-unloadproplayerstring-layername)
* [bool GetPropLayerLoadStatus(string layerName)](#bool-getproplayerloadstatusstring-layername)
* [Float3 GetTerrainChunkPosition(string chunkName)](#float3-getterrainchunkpositionstring-chunkname)
* [bool SetTerrainChunkPosition(string chunkName, Float3 pos)](#bool-setterrainchunkpositionstring-chunkname-float3-pos)
* [bool SetTerrainChunkPositionWithInterpolation(string chunkName, Float3 pos, float duration)](#bool-setterrainchunkpositionwithinterpolationstring-chunkname-float3-pos-float-duration)
* [int InstantiateTerrainChunk(string chunkName, Float3 pos)](#int-instantiateterrainchunkstring-chunkname-float3-pos)
* [void DestroyTerrainChunkInstance(int instanceId)](#void-destroyterrainchunkinstanceint-instanceid)
* [Float3 GetTerrainChunkInstancePosition(int instanceId)](#float3-getterrainchunkinstancepositionint-instanceid)
* [bool SetTerrainChunkInstancePosition(int instanceId, Float3 pos)](#bool-setterrainchunkinstancepositionint-instanceid-float3-pos)
* [bool SetTerrainChunkInstancePositionWithInterpolation(int instanceId, Float3 pos, float duration)](#bool-setterrainchunkinstancepositionwithinterpolationint-instanceid-float3-pos-float-duration)
* [int GetWeather()](#int-getweather)
* [void SetWeather(int weatherStatus, float duration)](#void-setweatherint-weatherstatus-float-duration)
* [int GetTimeOfTheDay()](#int-gettimeoftheday)
* [void SetTimeOfTheDay(int timeOfTheDay, float duration)](#void-settimeofthedayint-timeoftheday-float-duration)
* [ColorRGB GetCurrentLightColor()](#colorrgb-getcurrentlightcolor)
* [ColorRGB GetCurrentLightColorRGB()](#colorrgb-getcurrentlightcolorrgb)
* [void SetOverrideLightColor(ColorRGB color, float duration)](#void-setoverridelightcolorcolorrgb-color-float-duration)
* [void SetOverrideLightColorRGB(ColorRGB color, float duration)](#void-setoverridelightcolorrgbcolorrgb-color-float-duration)
* [void SetSkyboxColor(ColorRGB color, float duration)](#void-setskyboxcolorcolorrgb-color-float-duration)
* [void SetSkyboxColorRGB(ColorRGB color, float duration)](#void-setskyboxcolorrgbcolorrgb-color-float-duration)
* [void ResetSkyboxColor(float duration)](#void-resetskyboxcolorfloat-duration)
* [int AddLine(Float3 startPos, Float3 endPos, float width, ColorRGBA color, bool rectCap)](#int-addlinefloat3-startpos-float3-endpos-float-width-colorrgba-color-bool-rectcap)
* [int AddLineColorRGBA(Float3 startPos, Float3 endPos, float width, ColorRGBA color, bool rectCap)](#int-addlinecolorrgbafloat3-startpos-float3-endpos-float-width-colorrgba-color-bool-rectcap)
|
Trigger API Reference\DCEI Functions\Terrain (1/2) {Trigger-API-ReferenceDCEI-FunctionsTerrain-12}
void EnableRoute(string routeName, bool enable)
Enable/disable a waypoints route according to route name.
DCEI.EnableRoute("test_route", true)
Float2 GetMapSize()
Returns the X and Z dimensions of the map.
local map_dim = DCEI.GetMapSize()
DCEI.LogMessage("Map Dim X: " .. map_dim.x .. " Map Dim Z: " .. map_dim.y)
Float2 GetMapCenterPoint()
Returns the X and Z coordinates of the center of the map.
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)
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.
local terrain_type = DCEI.GetTerrainTypeAtPoint(16, 16)
float GetTerrainHeightAtPoint(float x, float z)
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.
local terrain_height = DCEI.GetTerrainHeightAtPoint(16, 16)
void ChangePropLayerDisplay(string layerName, bool display) {void-ChangePropLayerDisplaystring-layerName-bool-display}
void ChangePropLayerDisplay(string layerName, bool display)
Enables or disables the display of a prop player.
-
string
layerName
the name of the layer. -
bool
display
if true, display the prop layer, otherwise hide the prop layer.
DCEI.ChangePropLayerDisplay("layer_1", false)
void LoadPropLayer(string layerName, bool initialDisplay) {void-LoadPropLayerstring-layerName-bool-initialDisplay}
void LoadPropLayer(string layerName, bool initialDisplay)
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.
-
string
layerName
the name of the layer. -
bool
InitialDisplay
if true, display the prop layer when the game first loads.
function OnRegionEnter()
DCEI.LoadPropLayer("layer_1", true)
end
DCEI.UnloadPropLayer("layer_1")
DCEI.TriggerAddUnitEnterRegionEvent(DCEI.UnitAny, DCEI.RegionAny, OnRegionEnter)
void UnloadPropLayer(string layerName)
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).
function OnRegionEnter()
DCEI.LoadPropLayer("layer_1", true)
end
DCEI.UnloadPropLayer("layer_1")
DCEI.TriggerAddUnitEnterRegionEvent(DCEI.UnitAny, DCEI.RegionAny, OnRegionEnter)
bool GetPropLayerLoadStatus(string layerName)
Returns true if given prop layer is loaded.
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)
Float3 GetTerrainChunkPosition(string chunkName)
Returns the 3D position of a terrain chunk.
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)
Sets the position of a terrain chunk. Returns true if the terrain chunk position was set successfully.
-
string
chunkName
the name of the terrain chunk. -
Float3
pos
the new coordinates for the center of the terrain chunk.
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)
Sets the 3D position of a terrain chunk while animating it to that position. Returns true if the position was set successfully.
-
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.
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)
Instantiates a terrain chunk at the given location and returns the instanceId of the terrain chunk instance. Returns 0 on failure.
-
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.
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)
Destroys a terrain chunk instance.
DCEI.DestroyTerrainChunkInstance(1)
Float3 GetTerrainChunkInstancePosition(int instanceId) {Float3-GetTerrainChunkInstancePositionint-instanceId}
Float3 GetTerrainChunkInstancePosition(int instanceId)
Returns the 3D position of a terrain chunk instance.
local terrain_chunk_position = DCEI.GetTerrainChunkInstancePosition(1)
bool SetTerrainChunkInstancePosition(int instanceId, Float3 pos) {bool-SetTerrainChunkInstancePositionint-instanceId-Float3-pos}
bool SetTerrainChunkInstancePosition(int instanceId, Float3 pos)
Sets the 3D position of a terrain chunk instance. Returns true if the position was set successfully.
-
int
instanceId
the instanceId assigned to the terrain chunk instance. -
Float3
pos
the new coordinates for the center of the terrain chunk instance.
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)
Sets the 3D position of a terrain chunk instance while animating it to that position. Returns true if the position was set successfully.
-
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.
DCEI.LogMessage(tostring(DCEI.SetTerrainChunkInstancePositionWithInterpolation(1, {x = 12.5, y = 3, z = 12.5}, 5)))
int GetWeather()
Returns an integer corresponding to the weather. Does not detect the heatwave option. 0 - None 1 - Rain 2 - Snow
local weather = DCEI.GetWeather()
void SetWeather(int weatherStatus, float duration) {void-SetWeatherint-weatherStatus-float-duration}
void SetWeather(int weatherStatus, float duration)
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
-
int
weatherStatus
the integer corresponding to a weather status. -
float
duration
the transition duration.
DCEI.SetWeather(1, 50)
int GetTimeOfTheDay()
Returns an integer corresponding to the time of the day. 0 - Noon 1 - Night 2 - Void
local time_lighting = DCEI.DCEI.GetTimeOfTheDay()
void SetTimeOfTheDay(int timeOfTheDay, float duration) {void-SetTimeOfTheDayint-timeOfTheDay-float-duration}
void SetTimeOfTheDay(int timeOfTheDay, float duration)
Sets a time of the day over the given duration. Use 0 for an instant transition. 0 - Noon 1 - Night 2 - Void
-
int
timeOfTheDay
the integer corresponding to a timeOfTheDay. -
float
duration
the transition duration.
DCEI.SetTimeOfTheDay(2, 10)
ColorRGB GetCurrentLightColor()
Get the current light's RGB value
ColorRGB GetCurrentLightColorRGB()
Get the current light's RGB value
void SetOverrideLightColor(ColorRGB color, float duration) {void-SetOverrideLightColorColorRGB-color-float-duration}
void SetOverrideLightColor(ColorRGB color, float duration)
Set light color RGB value for a period of time
void SetOverrideLightColorRGB(ColorRGB color, float duration) {void-SetOverrideLightColorRGBColorRGB-color-float-duration}
void SetOverrideLightColorRGB(ColorRGB color, float duration)
Set light color RGB value for a period of time
void SetSkyboxColor(ColorRGB color, float duration) {void-SetSkyboxColorColorRGB-color-float-duration}
void SetSkyboxColor(ColorRGB color, float duration)
Set skybox RGB color value for a period of time.
void SetSkyboxColorRGB(ColorRGB color, float duration) {void-SetSkyboxColorRGBColorRGB-color-float-duration}
void SetSkyboxColorRGB(ColorRGB color, float duration)
Set skybox RGB color value for a period of time.
void ResetSkyboxColor(float duration)
Resets the skybox color to the default over the given duration. Use 0 for an instant transition.
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)
Draws a line on the terrain, with color! Returns the lineId of the created line if successful.
-
Float3
startPos
the starting coordinates for the line. -
Float3
endPos
the ending coordinates for the line. -
float
width
the width of the line, in terms of tiles. -
ColorRGBA
color
the RGBA values for the line. -
bool
rectCap
if true, the ends of the line are rectangular instead of rounded.
DCEI.AddLine({x = 1, y = 1, z = 15}, {x = 30, y = 1, z = 15}, 1, {r = 0.5, g = 0.5, b = 0, a = 0.5}, false)
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)
Draws a line on the terrain, with color! Returns the lineId of the created line if successful.
-
Float3
startPos
the starting coordinates for the line. -
Float3
endPos
the ending coordinates for the line. -
float
width
the width of the line, in terms of tiles. -
ColorRGBA
color
the RGBA values for the line. -
bool
rectCap
if true, the ends of the line are rectangular instead of rounded.
DCEI.AddLine({x = 1, y = 1, z = 15}, {x = 30, y = 1, z = 15}, 1, {r = 0.5, g = 0.5, b = 0, a = 0.5}, false)