Trigger API Reference DCEI Functions Terrain0 - BLKTower/TestWiki GitHub Wiki
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()
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)
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)
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)
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)