Rpg Tools

A tool to easily create 2D RPGs

Ability

Ability
AbilityEntry

Ability

displayName

string

Display name of the ability

guid

Guid

Ability guid

iconPath

string

Path to the ability icon

name

string

Name of the ability

soundPath

string

Path to the ability sound


AbilityEntry

ability

Ability

Ability of this entry


AbilityManager

abilities

Ability[]

All Abilities

getAbilityByName

function AbilityManager.getAbilityByName(self: AbilityManager, name: string)
  -> Ability

returns an ability by its name

@param name — Name of the ability


AbilityManager

AbilityManager

AbilityManager.getAbilityByName

returns an ability by its name

@param name — Name of the ability

function AbilityManager.getAbilityByName(self: AbilityManager, name: string)
  -> Ability

AbilityReference

AbilityReference

AbilityReference

ability

Ability

Returns the Ability of this reference

guid

Guid

Guid of the Ability


AnimationMode

{
    Loop: integer = 0,
    LoopBackAndForth: integer = 1,
    PlayOnce: integer = 2,
}

AnimationMode.Loop


AnimationMode.LoopBackAndForth


AnimationMode.PlayOnce


Area

Area

Area

color

Color

Color of the area

getRandomPositionInArea

function Area.getRandomPositionInArea(self: Area)
  -> Vector2

Returns a random position inside this area

isPointInside

function Area.isPointInside(self: Area, x: number, y: number)
  -> boolean

Returns if an area is inside a specified position

@param x — X coordinate

@param y — Y coordinate

name

string

Name of the area


Area.getRandomPositionInArea

Returns a random position inside this area

function Area.getRandomPositionInArea(self: Area)
  -> Vector2

Area.isPointInside

Returns if an area is inside a specified position

@param x — X coordinate

@param y — Y coordinate

function Area.isPointInside(self: Area, x: number, y: number)
  -> boolean

CameraSettings

attachToHero

boolean

Is the camera attached to the hero

object

Object

Object attached to the camera


CameraSettings

CameraSettings

CharacterClass

CharacterClass

CharacterClass

abilities

AbilityEntry[]

Abilties of this class

displayName

string

Display name of the character class

name

string

Name of the character class


CharacterClassReference

guid

Guid

Guid of the character class


CharacterClassReference

CharacterClassReference

Color

a

integer

alpha value of the color(0-255)

b

integer

blue value of the color(0-255)

g

integer

green value of the color(0-255)

r

integer

red value of the color(0-255)


Color

Create Color instance

table

ColumnAlignment

{
    left: integer = 0,
    center: integer = 1,
    right: integer = 2,
}

ColumnAlignment.center


ColumnAlignment.left


ColumnAlignment.right


Container

widgets

Widget[]

Widgets of this container


Container

Container

Cutscene

Cutscene

Cutscene

background

CutsceneBackground

Background of the cutscene

dialogs

CutsceneDialog[]

Dialogs of the cutscene

title

string

Title of the cutscene


CutsceneBackground

hasImage

boolean

Returns if the background has an image

imagePath

string

Image path

levelPath

string

Path to the level to be loaded


CutsceneBackground

CutsceneBackground

CutsceneDialog

background

CutsceneBackground

Background of the dialog

hasVideo

boolean

Returns if this dialog contains a video

isVideoLooped

boolean

Returns if the dialog video is looped

text

string

Text of the dialog

videoPath

string

Path to the video of this dialog


CutsceneDialog

CutsceneDialog

DamageType

DamageType

DamageType

name

string

Name of the stat


DamageTypeManager

DamageTypeManager

DamageTypeManager

damageTypes

DamageType[]

All damage types

getDamageTypeByName

function DamageTypeManager.getDamageTypeByName(self: DamageTypeManager, damageTypeName: string)
  -> DamageType

Returns a damage type by its name

@param damageTypeName — Name of the damage type


DamageTypeManager.getDamageTypeByName

Returns a damage type by its name

@param damageTypeName — Name of the damage type

function DamageTypeManager.getDamageTypeByName(self: DamageTypeManager, damageTypeName: string)
  -> DamageType

Dialog

dialogs

Dialog[]

All dialogs


Dialog

Dialog

DialogManager

DialogManager

DialogManager

getDialogByGuid

function DialogManager.getDialogByGuid(self: DialogManager, dialogGuid: Guid)
  -> Dialog

returns a dialog by its Guid

@param dialogGuid — of the dialog


DialogManager.getDialogByGuid

returns a dialog by its Guid

@param dialogGuid — of the dialog

function DialogManager.getDialogByGuid(self: DialogManager, dialogGuid: Guid)
  -> Dialog

DialogOption

text

string

Text of this dialog option


DialogOption

DialogOption

Equipment

Equipment

Equipment

equipItem

function Equipment.equipItem(self: Equipment, item: Item)
  -> Returns: Item

equip a specific item

@param item — to equip

@return Returns — the item now at the cursor(e.g. the item previously equipped)

unequipItem

function Equipment.unequipItem(self: Equipment, slotIndex: integer)
  -> Returns: Item

unequip a specific item

@param slotIndex — Equipment slot index

@return Returns — the item now at the cursor(the item previously at this slot)


Equipment.equipItem

equip a specific item

@param item — to equip

@return Returns — the item now at the cursor(e.g. the item previously equipped)

function Equipment.equipItem(self: Equipment, item: Item)
  -> Returns: Item

Equipment.unequipItem

unequip a specific item

@param slotIndex — Equipment slot index

@return Returns — the item now at the cursor(the item previously at this slot)

function Equipment.unequipItem(self: Equipment, slotIndex: integer)
  -> Returns: Item

Float2

Float2

Float2

x

number

y

number

GameEvent

GameEvent

GameEvent

addVariable

function GameEvent.addVariable(self: GameEvent, name: string, value: boolean)

sets a named value to a boolean value

@param name — Name of the value

findVariable

function GameEvent.findVariable(self: GameEvent, variableName: string)
  -> ScriptValue

returns a variable by its name

@param variableName — Name of the variable

type

gameEventType

Type of this event

userType

string

User type of this event

variables

ScriptValueContainer

Variables of this event


GameEvent.addVariable

sets a named value to a boolean value

@param name — Name of the value

function GameEvent.addVariable(self: GameEvent, name: string, value: boolean)
function GameEvent.addVariable(self: GameEvent, name: string, value: integer)
function GameEvent.addVariable(self: GameEvent, name: string, value: number)
function GameEvent.addVariable(self: GameEvent, name: string, value: string)
function GameEvent.addVariable(self: GameEvent, name: string, value: Vector2)
function GameEvent.addVariable(self: GameEvent, name: string, value: Color)

GameEvent.findVariable

returns a variable by its name

@param variableName — Name of the variable

function GameEvent.findVariable(self: GameEvent, variableName: string)
  -> ScriptValue

GameEventType

table

GameSettings

musicVolume

number

Music volume

soundVolume

number

Sound volume


GameSettings

GameSettings

Guid

Create a zero guid

Guid

Guid

clear

function Guid.clear(self: Guid)

clear Guid(Zero all values)

isValid

boolean

returns if the guid is valid

isZero

boolean

returns if the guid is zero

toString

function Guid.toString(self: Guid)
  -> Guid: string

returns the guid as a string

@return Guid — as string


Guid.clear

clear Guid(Zero all values)

function Guid.clear(self: Guid)

Guid.toString

returns the guid as a string

@return Guid — as string

function Guid.toString(self: Guid)
  -> Guid: string

GuidReference

guid

Guid

Current GUID


GuidReference

GuidReference

Hero

Hero

Hero

class

string

Character class name

name

string

Name of the hero


ImGui

Begin

function ImGui.Begin(name: string)
  -> Returns: boolean

@param name — Name of the window

@return Returns — if the window is opened

Begins a window

Button

function ImGui.Button(caption: string)
  -> Returns: boolean

@param caption — Caption of the button

@return Returns — if the button was clicked

Renders a Button

Checkbox

function ImGui.Checkbox(caption: string, checkedState: boolean)
  -> Returns: boolean
  2. Returns: boolean

@param caption — Caption of the button

@param checkedState — Checked state

@return Returns — The new state

@return Returns — if the checked state was changed

Renders a Button

End

function ImGui.End()

Ends a window

InputFloat

function ImGui.InputFloat(caption: string, value: number)
  -> Returns: number
  2. Returns: boolean

@param caption — Caption of the edit field

@param value — Current value

@return Returns — The new number

@return Returns — if the checked state was changed

Edits a number

InputFloat2

function ImGui.InputFloat2(caption: string, value: Float2)
  -> Returns: Float2
  2. Returns: boolean

@param caption — Caption of the edit field

@param value — Current value

@return Returns — The new number

@return Returns — if the checked state was changed

Edits a number

PopID

function ImGui.PopID()

Pops an ID from the ImGui stack

PushID

function ImGui.PushID(id: any)

@param id — ID to push

Pushes an ID to the ImGui stack

SameLine

function ImGui.SameLine()

Renders the next widget in the same line

Text

function ImGui.Text(caption: string)

@param caption — Caption of the text

Renders a Text

TreeNode

function ImGui.TreeNode(caption: string)
  -> Returns: boolean

@param caption — Caption of the node

@return Returns — if the tree node is expanded

Renders a Tree Node

TreePop

function ImGui.TreePop()

Pops the current tree node


ImGui

ImGui

ImGui.Begin

@param name — Name of the window

@return Returns — if the window is opened

Begins a window

function ImGui.Begin(name: string)
  -> Returns: boolean

ImGui.Button

@param caption — Caption of the button

@return Returns — if the button was clicked

Renders a Button

function ImGui.Button(caption: string)
  -> Returns: boolean

ImGui.Checkbox

@param caption — Caption of the button

@param checkedState — Checked state

@return Returns — The new state

@return Returns — if the checked state was changed

Renders a Button

function ImGui.Checkbox(caption: string, checkedState: boolean)
  -> Returns: boolean
  2. Returns: boolean

ImGui.End

Ends a window

function ImGui.End()

ImGui.InputFloat

@param caption — Caption of the edit field

@param value — Current value

@return Returns — The new number

@return Returns — if the checked state was changed

Edits a number

function ImGui.InputFloat(caption: string, value: number)
  -> Returns: number
  2. Returns: boolean

ImGui.InputFloat2

@param caption — Caption of the edit field

@param value — Current value

@return Returns — The new number

@return Returns — if the checked state was changed

Edits a number

function ImGui.InputFloat2(caption: string, value: Float2)
  -> Returns: Float2
  2. Returns: boolean

ImGui.PopID

Pops an ID from the ImGui stack

function ImGui.PopID()

ImGui.PushID

@param id — ID to push

Pushes an ID to the ImGui stack

function ImGui.PushID(id: any)

ImGui.SameLine

Renders the next widget in the same line

function ImGui.SameLine()

ImGui.Text

@param caption — Caption of the text

Renders a Text

function ImGui.Text(caption: string)

ImGui.TreeNode

@param caption — Caption of the node

@return Returns — if the tree node is expanded

Renders a Tree Node

function ImGui.TreeNode(caption: string)
  -> Returns: boolean

ImGui.TreePop

Pops the current tree node

function ImGui.TreePop()

Inventory

Inventory

Inventory

items

Item[]

All items in the inventory(nil-entries for empty slots)


Item

displayName

string

Display name of the item

equip

function Item.equip(self: Item)

Equip item

getStat

function Item.getStat(self: Item, stat: ItemStat)
  -> Value: number

returns a stat value of a specified stat

@param stat — Stat

@return Value — of the stat

getStatByName

function Item.getStatByName(self: Item, statName: string)
  -> Value: number

returns a stat value by its stat name

@param statName — name of the stat

@return Value — of the stat

imagePath

string

Path of the item image

name

string

Developer name of the item


Item

Item

Item.equip

Equip item

function Item.equip(self: Item)
function Item.equip(self: Item)

Item.getStat

returns a stat value of a specified stat

@param stat — Stat

@return Value — of the stat

function Item.getStat(self: Item, stat: ItemStat)
  -> Value: number
function Item.getStat(self: Item, stat: ItemStatReference)
  -> Value: number

Item.getStatByName

returns a stat value by its stat name

@param statName — name of the stat

@return Value — of the stat

function Item.getStatByName(self: Item, statName: string)
  -> Value: number

ItemManager

ItemManager

ItemManager

getItemByName

function ItemManager.getItemByName(self: ItemManager, name: string)
  -> Item

returns an item by its name

@param name — Name of the item

items

Item[]

Array with all items


ItemManager.getItemByName

returns an item by its name

@param name — Name of the item

function ItemManager.getItemByName(self: ItemManager, name: string)
  -> Item

ItemReference

ItemReference

ItemReference

guid

Guid

Guid of the item

item

Item

Returns the item of this reference


ItemStack

ItemStack

ItemStack

count

integer

Amount of items in this stack

item

Item

Returns the item of this reference


ItemStat

displayName

string

Display name of the item stat

hasIcon

boolean

Returns if this item stat has an icon

iconPath

string

Icon path of this item stat

id

Guid

ID of the item stat

name

string

Name of the item stat


ItemStat

ItemStat

ItemStatManager

getStatByGuid

function ItemStatManager.getStatByGuid(self: ItemStatManager, guid: Guid)

Returns an item stat by its name

@param guid — Guid of the stat

getStatByName

function ItemStatManager.getStatByName(self: ItemStatManager, name: string)

Returns an item stat by its name

@param name — Name of the stat

stats

ItemStat[]

All item stats


ItemStatManager

ItemStatManager

ItemStatManager.getStatByGuid

Returns an item stat by its name

@param guid — Guid of the stat

function ItemStatManager.getStatByGuid(self: ItemStatManager, guid: Guid)

ItemStatManager.getStatByName

Returns an item stat by its name

@param name — Name of the stat

function ItemStatManager.getStatByName(self: ItemStatManager, name: string)

ItemStatReference

ItemStatReference

ItemStatReference

guid

Guid

Guid of the stat

stat

ItemStat|nil

Returns the item stat of this reference


LoadingScreenData

text

string

Text of the loading screen

texture

string

Path to the loading texture

title

string

Title of the loading screen


LoadingScreenData

LoadingScreenData

LocalizedTextManager

LocalizedTextManager

LocalizedTextManager

currentLanguage

string

Gets/Sets the current language

getTextByGuid

function LocalizedTextManager.getTextByGuid(self: LocalizedTextManager, guid: Guid)
  -> Localized: string

Returns a localized text via Guid

@param guid — Guid of the text

@return Localized — text


LocalizedTextManager.getTextByGuid

Returns a localized text via Guid

@param guid — Guid of the text

@return Localized — text

function LocalizedTextManager.getTextByGuid(self: LocalizedTextManager, guid: Guid)
  -> Localized: string

LocalizedTextReference

LocalizedTextReference

LocalizedTextReference

guid

Guid

Guid of the stat

text

string

Returns the localized text


LootComponent

items

ItemStack[]

Loot items

resources

ResourceContainer

Loot resources


LootComponent

LootComponent

MapLayer

asObjectLayer

function MapLayer.asObjectLayer(self: MapLayer)
  -> ObjectLayer

returns the layer as an ObjectLayer or nil if it is not an object layer

asPathLayer

function MapLayer.asPathLayer(self: MapLayer)
  -> PathLayer

returns the layer as an PathLayer or nil if it is not a path layer

asTileLayer

function MapLayer.asTileLayer(self: MapLayer)
  -> TileLayer

returns the layer as an TileLayer or nil if it is not an tile layer

isScreenLayer

boolean

Set/Get if this layer is a screen space layer

name

string

Name of the layer

visible

boolean

Visible state of the layer


MapLayer

MapLayer

MapLayer.asObjectLayer

returns the layer as an ObjectLayer or nil if it is not an object layer

function MapLayer.asObjectLayer(self: MapLayer)
  -> ObjectLayer

MapLayer.asPathLayer

returns the layer as an PathLayer or nil if it is not a path layer

function MapLayer.asPathLayer(self: MapLayer)
  -> PathLayer

MapLayer.asTileLayer

returns the layer as an TileLayer or nil if it is not an tile layer

function MapLayer.asTileLayer(self: MapLayer)
  -> TileLayer

MeshObjectData

animationIndex

integer

Index of the animation

rotationX

number

Rotation around the x axis

rotationY

number

Rotation around the y axis

rotationZ

number

Rotation around the z axis

z

number

z coordinate(Depth)


MeshObjectData

MeshObjectData

Object

Object

Object

center

Vector2

Center of this object

displayName

string

Display name of the object

fragmentShader

ShaderReference

Fragment shader of this object

id

integer

Unique ID of this object

identifier

string

Identifier of this object. Can be used with special events

interactionCursor

string

Interaction cursor of this object

loot

LootComponent

Returns the Loot component of this object(If this object contains one)

mesh

MeshObjectData

Returns the mesh of this object(If this object is a mesh)

opacity

number

Opacity of this object

origin

Vector2

Origin of this object

physicsBody

PhysicsBodyComponent

Returns the Physics body component of this object(If this object contains one)

position

Vector2

Position of this object

rotation

number

Rotation of this object in degree

runAction

function Object.runAction(self: Object, action: ObjectAction)

runs an action for an object

@param action — Action that should be executed

scale

number

Scale of this object

setImage

function Object.setImage(self: Object, imageId: integer)

sets the image of this object

@param imageId — Image ID

size

Vector2

Size of this object

trader

TraderComponent

Returns the Trader component of this object(If this object contains one)

variables

ScriptValueContainer

Variables of this object

vertexShader

ShaderReference

Vertext shader of this object

x

number

X coordinate

y

number

Y coordinate


Object.runAction

runs an action for an object

@param action — Action that should be executed

function Object.runAction(self: Object, action: ObjectAction)

Object.setImage

sets the image of this object

@param imageId — Image ID

function Object.setImage(self: Object, imageId: integer)
function Object.setImage(self: Object, imageId: integer, animationIndex: integer)

ObjectAction


ObjectAction

ObjectAction

ObjectLayer

ObjectLayer

ObjectLayer

addObject

function ObjectLayer.addObject(self: ObjectLayer)
  -> Object

Adds a new object to the layer

objects

Object[]

Objects in this layer


ObjectLayer.addObject

Adds a new object to the layer

function ObjectLayer.addObject(self: ObjectLayer)
  -> Object

ObjectReference

ObjectReference

ObjectReference

objectId

integer

Object ID


PathLayer

getWorldPositionAt

function PathLayer.getWorldPositionAt(self: PathLayer, x: integer, y: integer)
  -> Vector2

returns the world position for a specified path coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

isWalkable

function PathLayer.isWalkable(self: PathLayer, position: Vector2)
  -> boolean

returns if the specified world position is walkable

@param position — world position

mapSizeX

integer

X map size

mapSizeY

integer

Y map size

setWalkable

function PathLayer.setWalkable(self: PathLayer, x: integer, y: integer, walkable: boolean)

returns if the specified path coordinate is walkable

@param x — X tile coordinate

@param y — Y tile coordinate

@param walkable — New walkable state

tileSizeX

integer

X tile size

tileSizeY

integer

Y tile size


PathLayer

PathLayer

PathLayer.getWorldPositionAt

returns the world position for a specified path coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

function PathLayer.getWorldPositionAt(self: PathLayer, x: integer, y: integer)
  -> Vector2

PathLayer.isWalkable

returns if the specified world position is walkable

@param position — world position

function PathLayer.isWalkable(self: PathLayer, position: Vector2)
  -> boolean
function PathLayer.isWalkable(self: PathLayer, x: integer, y: integer)
  -> boolean

PathLayer.setWalkable

returns if the specified path coordinate is walkable

@param x — X tile coordinate

@param y — Y tile coordinate

@param walkable — New walkable state

function PathLayer.setWalkable(self: PathLayer, x: integer, y: integer, walkable: boolean)

PhysicsBodyComponent

PhysicsBodyComponent

PhysicsBodyComponent

angularVelocity

number

Set the angular velocity of the physics body

applyAngularImpulse

function PhysicsBodyComponent.applyAngularImpulse(self: PhysicsBodyComponent, impulse: number)

Applies an angular impulse to the physics body

@param impulse — Angular impulse

applyForce

function PhysicsBodyComponent.applyForce(self: PhysicsBodyComponent, force: Vector2)

Applies a force to the physics body

@param force — Applied force

applyLinearImpulse

function PhysicsBodyComponent.applyLinearImpulse(self: PhysicsBodyComponent, impulse: Vector2)

Applies a linear impulse to the physics body

@param impulse — Linear impulse

isFixtureInCollision

function PhysicsBodyComponent.isFixtureInCollision(self: PhysicsBodyComponent, fixtureIndex: integer)
  -> boolean

returns if the fixture is currently in collision

@param fixtureIndex — Index of the fixture

linarVelocity

Vector2

Set the linear velocity of the physics body

setVelocity

function PhysicsBodyComponent.setVelocity(self: PhysicsBodyComponent, velocity: Vector2)

sets the velocity of the physics body

@param velocity — New velocity

stop

function PhysicsBodyComponent.stop(self: PhysicsBodyComponent)

stop the Physics body instantly


PhysicsBodyComponent.applyAngularImpulse

Applies an angular impulse to the physics body

@param impulse — Angular impulse

function PhysicsBodyComponent.applyAngularImpulse(self: PhysicsBodyComponent, impulse: number)

PhysicsBodyComponent.applyForce

Applies a force to the physics body

@param force — Applied force

function PhysicsBodyComponent.applyForce(self: PhysicsBodyComponent, force: Vector2)

PhysicsBodyComponent.applyLinearImpulse

Applies a linear impulse to the physics body

@param impulse — Linear impulse

function PhysicsBodyComponent.applyLinearImpulse(self: PhysicsBodyComponent, impulse: Vector2)

PhysicsBodyComponent.isFixtureInCollision

returns if the fixture is currently in collision

@param fixtureIndex — Index of the fixture

function PhysicsBodyComponent.isFixtureInCollision(self: PhysicsBodyComponent, fixtureIndex: integer)
  -> boolean

PhysicsBodyComponent.setVelocity

sets the velocity of the physics body

@param velocity — New velocity

function PhysicsBodyComponent.setVelocity(self: PhysicsBodyComponent, velocity: Vector2)

PhysicsBodyComponent.stop

stop the Physics body instantly

function PhysicsBodyComponent.stop(self: PhysicsBodyComponent)

PrefabObjectReference

guid

Guid

Guid of the Prefab


PrefabObjectReference

PrefabObjectReference

Quest

Quest

Quest

autoStart

boolean

Should the quest be started automatically

displayName

string

Display name of the quest

guid

Guid

Guid (Unique ID) of the quest

name

string

Developer name of the quest

showInQuestLog

boolean

Should the quest be displayed in the quest log

text

string

Text of the quest


QuestInstance

QuestInstance

QuestInstance

objectives

QuestObjectiveState[]

Objectives of this quest

quest

Quest

Quest of this quest instance

state

QuestState

State of this quest


QuestInstanceManager

findQuest

function QuestInstanceManager.findQuest(self: QuestInstanceManager, questReference: any)
  -> QuestInstance

Returns a quest by its reference

quests

Quest[]

All quest instances


QuestInstanceManager

QuestInstanceManager

QuestInstanceManager.findQuest

Returns a quest by its reference

function QuestInstanceManager.findQuest(self: QuestInstanceManager, questReference: any)
  -> QuestInstance

QuestObjectiveState

count

integer

Current amount of this objective

neededCount

integer

Needed amount of this objective

text

string

Text of this objective


QuestObjectiveState

QuestObjectiveState

QuestReference

QuestReference

QuestReference

guid

Guid

Guid of the quest

quest

Quest

Returns the quest of this reference


QuestState

{
    Active: integer = 0,
    Reachable: integer = 1,
    Finished: integer = 2,
    Inactive: integer = 3,
}

QuestState.Active


QuestState.Finished


QuestState.Inactive


QuestState.Reachable


Resource

Resource

Resource

displayName

string

Display name of the resource

guid

Guid

Guid of the item

iconPath

string

Path to the resource icon

name

string

Developer name of the resource


ResourceContainer

ResourceContainer

ResourceContainer

addResourceAmount

function ResourceContainer.addResourceAmount(self: ResourceContainer, resourceReference: ResourceReference, amount: integer)

add a specific resource amount

@param resourceReference — Resource type

@param amount — Amount to be added

getResourceAmount

function ResourceContainer.getResourceAmount(self: ResourceContainer, resourceReference: ResourceReference)
  -> integer

Returns the resource amount of a specific type

@param resourceReference — Resource type

setResourceAmount

function ResourceContainer.setResourceAmount(self: ResourceContainer, resourceReference: ResourceReference, amount: integer)

Set a specific resource amount

@param resourceReference — Resource type

@param amount — Amount to be set of this type


ResourceContainer.addResourceAmount

add a specific resource amount

@param resourceReference — Resource type

@param amount — Amount to be added

function ResourceContainer.addResourceAmount(self: ResourceContainer, resourceReference: ResourceReference, amount: integer)

ResourceContainer.getResourceAmount

Returns the resource amount of a specific type

@param resourceReference — Resource type

function ResourceContainer.getResourceAmount(self: ResourceContainer, resourceReference: ResourceReference)
  -> integer

ResourceContainer.setResourceAmount

Set a specific resource amount

@param resourceReference — Resource type

@param amount — Amount to be set of this type

function ResourceContainer.setResourceAmount(self: ResourceContainer, resourceReference: ResourceReference, amount: integer)

ResourceManager

ResourceManager

ResourceManager

getResourceByGuid

function ResourceManager.getResourceByGuid(self: ResourceManager, resourceGuid: Guid)
  -> Resource

returns a resource by its Guid

@param resourceGuid — Guid of the resource

getResourceByName

function ResourceManager.getResourceByName(self: ResourceManager, resourceName: string)
  -> Resource

returns a resource by its name

@param resourceName — Name of the resource

resources

Resource[]

All resources


ResourceManager.getResourceByGuid

returns a resource by its Guid

@param resourceGuid — Guid of the resource

function ResourceManager.getResourceByGuid(self: ResourceManager, resourceGuid: Guid)
  -> Resource

ResourceManager.getResourceByName

returns a resource by its name

@param resourceName — Name of the resource

function ResourceManager.getResourceByName(self: ResourceManager, resourceName: string)
  -> Resource

ResourceReference

guid

Guid

Guid of the resource

resource

Resource

Returns the item of this reference


ResourceReference

ResourceReference

Savegame

Savegame

Savegame

heroLevel

number

Hero level of this savegame

level

string

Path to the current level of this savegame

name

string

Name of this savegame

screenshot

string

Path to the screenshot of this savegame


ScriptValue

description

string

Description of this value

getBoolValue

function ScriptValue.getBoolValue(self: ScriptValue)
  -> boolean

returns the current value as a boolean

getColorValue

function ScriptValue.getColorValue(self: ScriptValue)
  -> Color

returns the current value as a Color value

getDoubleValue

function ScriptValue.getDoubleValue(self: ScriptValue)
  -> number

returns the current value as an number value

getFloatValue

function ScriptValue.getFloatValue(self: ScriptValue)
  -> number

returns the current value as a float value

getIntValue

function ScriptValue.getIntValue(self: ScriptValue)
  -> integer

returns the current value as an integer value

getStringValue

function ScriptValue.getStringValue(self: ScriptValue)
  -> string

returns the current value as a string value

getVector2Value

function ScriptValue.getVector2Value(self: ScriptValue)
  -> Vector2

returns the current value as a Vector2 value

name

string

Name of this value

objectID

integer

returns the value as an object id

setFloatValue

function ScriptValue.setFloatValue(self: ScriptValue, name: string, value: number)

sets a named value to a float value

@param name — Name of the value

setValue

function ScriptValue.setValue(self: ScriptValue, value: boolean)

sets the current value to a boolean value


ScriptValue

ScriptValue

ScriptValue.getBoolValue

returns the current value as a boolean

function ScriptValue.getBoolValue(self: ScriptValue)
  -> boolean

ScriptValue.getColorValue

returns the current value as a Color value

function ScriptValue.getColorValue(self: ScriptValue)
  -> Color

ScriptValue.getDoubleValue

returns the current value as an number value

function ScriptValue.getDoubleValue(self: ScriptValue)
  -> number

ScriptValue.getFloatValue

returns the current value as a float value

function ScriptValue.getFloatValue(self: ScriptValue)
  -> number

ScriptValue.getIntValue

returns the current value as an integer value

function ScriptValue.getIntValue(self: ScriptValue)
  -> integer

ScriptValue.getStringValue

returns the current value as a string value

function ScriptValue.getStringValue(self: ScriptValue)
  -> string

ScriptValue.getVector2Value

returns the current value as a Vector2 value

function ScriptValue.getVector2Value(self: ScriptValue)
  -> Vector2

ScriptValue.setFloatValue

sets a named value to a float value

@param name — Name of the value

function ScriptValue.setFloatValue(self: ScriptValue, name: string, value: number)

ScriptValue.setValue

sets the current value to a boolean value

function ScriptValue.setValue(self: ScriptValue, value: boolean)
function ScriptValue.setValue(self: ScriptValue, value: integer)
function ScriptValue.setValue(self: ScriptValue, value: number)
function ScriptValue.setValue(self: ScriptValue, value: string)
function ScriptValue.setValue(self: ScriptValue, value: Vector2)
function ScriptValue.setValue(self: ScriptValue, value: Color)

ScriptValueContainer

findValue

function ScriptValueContainer.findValue(self: ScriptValueContainer, name: string)
  -> ScriptValue

returns a script value by name

@param name — Name of the value

getBoolParameter

function ScriptValueContainer.getBoolParameter(self: ScriptValueContainer, propertyName: string, defaultValue: any, description: string)
  -> Boolean: boolean

@return Boolean — parameter

@param propertyName — name of the property

@param description — Description of the property

getDoubleParameter

function ScriptValueContainer.getDoubleParameter(self: ScriptValueContainer, propertyName: string, defaultValue: number, description: string)
  -> Number: number

@return Number — parameter

@param propertyName — name of the property

@param defaultValue — Default value

@param description — Description of the property

getFloatParameter

function ScriptValueContainer.getFloatParameter(self: ScriptValueContainer, propertyName: string, defaultValue: number, description: string)
  -> Float: number

@return Float — parameter

@param propertyName — name of the property

@param defaultValue — Default value

@param description — Description of the property

getIntParameter

function ScriptValueContainer.getIntParameter(self: ScriptValueContainer, propertyName: string, defaultValue: integer, description: string)
  -> Integer: integer

@return Integer — parameter

@param propertyName — name of the property

@param defaultValue — Default value

@param description — Description of the property

getItemStatReferenceParameter

function ScriptValueContainer.getItemStatReferenceParameter(self: ScriptValueContainer, propertyName: string, description: string)
  -> ItemStatReference

Returns an ItemStatReference parameter

@param propertyName — name of the property

@param description — Description of the property

getPrefabObjectReferenceParameter

function ScriptValueContainer.getPrefabObjectReferenceParameter(self: ScriptValueContainer, propertyName: string, description: string)
  -> PrefabObjectReference

Returns a PrefabObjectReference parameter

@param propertyName — name of the property

@param description — Description of the property

getStatReferenceParameter

function ScriptValueContainer.getStatReferenceParameter(self: ScriptValueContainer, propertyName: string, description: string)
  -> StatReference

Returns a StatReference parameter

@param propertyName — name of the property

@param description — Description of the property

getStringParameter

function ScriptValueContainer.getStringParameter(self: ScriptValueContainer, propertyName: string, defaultValue: string, description: string)
  -> String: string

Returns a string parameter by its value

@return String — parameter

@param propertyName — name of the property

@param defaultValue — Default value

@param description — Description of the property

getVectorParameter

function ScriptValueContainer.getVectorParameter(self: ScriptValueContainer, propertyName: string, values: ScriptValueContainer, description: string)

Returns a Vector parameter

@param propertyName — name of the property

@param values — Values each vector element should have

@param description — Description of the property

setFloatValue

function ScriptValueContainer.setFloatValue(self: ScriptValueContainer, name: string, value: number)

sets a float value by name

@param name — Name of the value

setValue

function ScriptValueContainer.setValue(self: ScriptValueContainer, name: string, value: boolean)

sets a named value to a boolean value

@param name — Name of the value

values

ScriptValue[]

Array with all script values


ScriptValueContainer

ScriptValueContainer

ScriptValueContainer.findValue

returns a script value by name

@param name — Name of the value

function ScriptValueContainer.findValue(self: ScriptValueContainer, name: string)
  -> ScriptValue

ScriptValueContainer.getBoolParameter

@return Boolean — parameter

@param propertyName — name of the property

@param description — Description of the property

function ScriptValueContainer.getBoolParameter(self: ScriptValueContainer, propertyName: string, defaultValue: any, description: string)
  -> Boolean: boolean

ScriptValueContainer.getDoubleParameter

@return Number — parameter

@param propertyName — name of the property

@param defaultValue — Default value

@param description — Description of the property

function ScriptValueContainer.getDoubleParameter(self: ScriptValueContainer, propertyName: string, defaultValue: number, description: string)
  -> Number: number

ScriptValueContainer.getFloatParameter

@return Float — parameter

@param propertyName — name of the property

@param defaultValue — Default value

@param description — Description of the property

function ScriptValueContainer.getFloatParameter(self: ScriptValueContainer, propertyName: string, defaultValue: number, description: string)
  -> Float: number

ScriptValueContainer.getIntParameter

@return Integer — parameter

@param propertyName — name of the property

@param defaultValue — Default value

@param description — Description of the property

function ScriptValueContainer.getIntParameter(self: ScriptValueContainer, propertyName: string, defaultValue: integer, description: string)
  -> Integer: integer

ScriptValueContainer.getItemStatReferenceParameter

Returns an ItemStatReference parameter

@param propertyName — name of the property

@param description — Description of the property

function ScriptValueContainer.getItemStatReferenceParameter(self: ScriptValueContainer, propertyName: string, description: string)
  -> ItemStatReference

ScriptValueContainer.getPrefabObjectReferenceParameter

Returns a PrefabObjectReference parameter

@param propertyName — name of the property

@param description — Description of the property

function ScriptValueContainer.getPrefabObjectReferenceParameter(self: ScriptValueContainer, propertyName: string, description: string)
  -> PrefabObjectReference

ScriptValueContainer.getStatReferenceParameter

Returns a StatReference parameter

@param propertyName — name of the property

@param description — Description of the property

function ScriptValueContainer.getStatReferenceParameter(self: ScriptValueContainer, propertyName: string, description: string)
  -> StatReference

ScriptValueContainer.getStringParameter

Returns a string parameter by its value

@return String — parameter

@param propertyName — name of the property

@param defaultValue — Default value

@param description — Description of the property

function ScriptValueContainer.getStringParameter(self: ScriptValueContainer, propertyName: string, defaultValue: string, description: string)
  -> String: string

ScriptValueContainer.getVectorParameter

Returns a Vector parameter

@param propertyName — name of the property

@param values — Values each vector element should have

@param description — Description of the property

function ScriptValueContainer.getVectorParameter(self: ScriptValueContainer, propertyName: string, values: ScriptValueContainer, description: string)

ScriptValueContainer.setFloatValue

sets a float value by name

@param name — Name of the value

function ScriptValueContainer.setFloatValue(self: ScriptValueContainer, name: string, value: number)

ScriptValueContainer.setValue

sets a named value to a boolean value

@param name — Name of the value

function ScriptValueContainer.setValue(self: ScriptValueContainer, name: string, value: boolean)
function ScriptValueContainer.setValue(self: ScriptValueContainer, name: string, value: integer)
function ScriptValueContainer.setValue(self: ScriptValueContainer, name: string, value: number)
function ScriptValueContainer.setValue(self: ScriptValueContainer, name: string, value: string)
function ScriptValueContainer.setValue(self: ScriptValueContainer, name: string, value: Vector2)
function ScriptValueContainer.setValue(self: ScriptValueContainer, name: string, value: Color)

ScriptValueMetaData

description

string

Description of this value

elements

ScriptValueContainer

ScriptValueMetaData

ScriptValueMetaData

ShaderReference

ShaderReference

ShaderReference

parameters

ScriptValueContainer

Shader parameters


ShowAnimationType

{
    Fade: integer = 0,
    Scale: integer = 1,
    SlideToRight: integer = 2,
    SlideToLeft: integer = 3,
    SlideToBottom: integer = 4,
    SlideToTop: integer = 5,
}

ShowAnimationType.Fade


ShowAnimationType.Scale


ShowAnimationType.SlideToBottom


ShowAnimationType.SlideToLeft


ShowAnimationType.SlideToRight


ShowAnimationType.SlideToTop


Stat

Stat

Stat

displayName

string

Display name of the stat

hasIcon

boolean

Returns if this stat has an icon

iconPath

string

Icon path of this stat

id

Guid

ID of the stat

maxValueStat

Stat

Maximum value stat of this stat

name

string

Name of the stat


StatManager

StatManager

StatManager

getStatByGuid

function StatManager.getStatByGuid(self: StatManager, guid: Guid)

Returns a stat by its name

@param guid — Guid of the stat

getStatByName

function StatManager.getStatByName(self: StatManager, name: string)

Returns a stat by its name

@param name — Name of the stat

stats

Stat[]

All stats


StatManager.getStatByGuid

Returns a stat by its name

@param guid — Guid of the stat

function StatManager.getStatByGuid(self: StatManager, guid: Guid)

StatManager.getStatByName

Returns a stat by its name

@param name — Name of the stat

function StatManager.getStatByName(self: StatManager, name: string)

StatReference

StatReference

StatReference

guid

Guid

Guid of the stat

maxStat

Stat

Returns the max stat of this reference(if the stat has a maximum value stat assigned)

stat

Stat

Returns the stat of this reference


TGUI_Vector2

x

number

x coordinate of the vector

y

number

y coordinate of the vector


TagReferenceList

TagReferenceList

TagReferenceList

containsTag

function TagReferenceList.containsTag(self: TagReferenceList, tag: string)
  -> boolean

Returns if the tag list contains a specific tag

@param tag — Tag name


TagReferenceList.containsTag

Returns if the tag list contains a specific tag

@param tag — Tag name

function TagReferenceList.containsTag(self: TagReferenceList, tag: string)
  -> boolean

TileLayer

fill

function TileLayer.fill(self: TileLayer, tileID: integer)

Fills the map with a specified tile coordinate

@param tileID — New tile ID

getHeightOffset

function TileLayer.getHeightOffset(self: TileLayer, x: integer, y: integer)
  -> integer

returns the height offset for a specified tile coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

getTile

function TileLayer.getTile(self: TileLayer, x: integer, y: integer)
  -> integer

returns a tile ID for a specified tile coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

setHeightOffset

function TileLayer.setHeightOffset(self: TileLayer, x: integer, y: integer, heightOffset: integer)

sets the height offset for a specified tile coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

@param heightOffset — New height offset

setTile

function TileLayer.setTile(self: TileLayer, x: integer, y: integer, tileID: integer)

sets a tile ID for a specified tile coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

@param tileID — New tile ID

tileHeight

integer

Tile height

tileWidth

integer

Tile width


TileLayer

TileLayer

TileLayer.fill

Fills the map with a specified tile coordinate

@param tileID — New tile ID

function TileLayer.fill(self: TileLayer, tileID: integer)

TileLayer.getHeightOffset

returns the height offset for a specified tile coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

function TileLayer.getHeightOffset(self: TileLayer, x: integer, y: integer)
  -> integer

TileLayer.getTile

returns a tile ID for a specified tile coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

function TileLayer.getTile(self: TileLayer, x: integer, y: integer)
  -> integer

TileLayer.setHeightOffset

sets the height offset for a specified tile coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

@param heightOffset — New height offset

function TileLayer.setHeightOffset(self: TileLayer, x: integer, y: integer, heightOffset: integer)

TileLayer.setTile

sets a tile ID for a specified tile coordinate

@param x — X tile coordinate

@param y — Y tile coordinate

@param tileID — New tile ID

function TileLayer.setTile(self: TileLayer, x: integer, y: integer, tileID: integer)

TileMap

TileMap

TileMap

getAreaByName

function TileMap.getAreaByName(self: TileMap, name: string)
  -> Area

returns an area by its name

@param name — Name of the area

getLayer

function TileMap.getLayer(self: TileMap, index: integer)
  -> MapLayer

returns a layer by its index

@param index — Index of the layer

getLayerByName

function TileMap.getLayerByName(self: TileMap, name: string)
  -> MapLayer

returns a layer by its name

@param name — Name of the layer

layers

MapLayer[]

Layers of the map

pathLayer

PathLayer

returns the path layer

pixelSizeX

integer

Map x size in pixels

pixelSizeY

integer

Map y size in pixels

tileLayer

TileLayer

returns the first tile layer

tilesX

integer

Tiles in the x coordinate

tilesY

integer

Tiles in the y coordinate

unitLayer

ObjectLayer

returns the unit layer


TileMap.getAreaByName

returns an area by its name

@param name — Name of the area

function TileMap.getAreaByName(self: TileMap, name: string)
  -> Area

TileMap.getLayer

returns a layer by its index

@param index — Index of the layer

function TileMap.getLayer(self: TileMap, index: integer)
  -> MapLayer

TileMap.getLayerByName

returns a layer by its name

@param name — Name of the layer

function TileMap.getLayerByName(self: TileMap, name: string)
  -> MapLayer

Time

isValid

boolean

returns if the guid is valid

isZero

boolean

returns if the guid is zero


Time

Create a zero guid

Time

TraderComponent

items

ItemStack[]

Loot items


TraderComponent

TraderComponent

Unit

Unit

Unit

abortCurrentCommand

function Unit.abortCurrentCommand(self: Unit)

addExperience

function Unit.addExperience(self: Unit, experience: integer)

Add experience to this unit

@param experience — experience points to add

addItem

function Unit.addItem(self: Unit, item: Item)

add an item to the unit

@param item — item that should be added

addItemByName

function Unit.addItemByName(self: Unit, itemName: string)

add an item to the unit

@param itemName — Name of the item that should be added

angle

number

Angle of this unit

attack

function Unit.attack(self: Unit)

tell the unit to attack at the current position

attackUnit

function Unit.attackUnit(self: Unit, unit: Unit)

tell the unit to attack a unit

@param unit — Unit that should be attacked

buyTraderItemAt

function Unit.buyTraderItemAt(self: Unit, itemIndex: integer)
  -> Returns: boolean

buy an item from the curren trader

@param itemIndex — Index of the item

@return Returns — if the item was bought

canExecuteReply

function Unit.canExecuteReply(self: Unit, replyIndex: integer)
  -> boolean

Returns if the dialog reply can be executed

@param replyIndex — Index of the reply

canPayTraderItemAt

function Unit.canPayTraderItemAt(self: Unit, itemIndex: integer)
  -> Returns: boolean

Check if an item can be bought from the curren trader

@param itemIndex — Index of the item

@return Returns — if the item was bought

canUnlockAbility

function Unit.canUnlockAbility(self: Unit, ability: Ability)
  -> boolean

Returns if the specified ability can be unlocked

@param ability — Ability that should be unlocked

castSpell

function Unit.castSpell(self: Unit, position: Vector2)

Cast the currently selected spell at a target position

@param position — Target position of the spell

class

CharacterClass

Character class of this unit

currentDialogOption

DialogOption

returns the current dialog option

dialog

Dialog

returns the current dialog

direction

integer

diretion index of this unit

displayColoredText

function Unit.displayColoredText(self: Unit, text: string, duration: number, color: Color)

displays a colored text above this unit for a fixed duration

@param text — Text to display

@param duration — How long the text should be displayed

@param color — Color of the text

displayText

function Unit.displayText(self: Unit, text: string, duration: number)

displays a text above this unit for a fixed duration

@param text — Text to display

@param duration — How long the text should be displayed

dropInventoryItem

function Unit.dropInventoryItem(self: Unit, index: integer)

Drop an inventory item

@param index — index of the item

equipment

Equipment

returns the equipment of this unit

executeDialogReply

function Unit.executeDialogReply(self: Unit, replyIndex: integer)

Execute a specific dialog reply

@param replyIndex — Index of the reply

findNearestEnemy

function Unit.findNearestEnemy(self: Unit, distance: number)
  -> closest: Unit

@param distance — Maximum distance

@return closest — enemy

finishDialog

function Unit.finishDialog(self: Unit, dialogOption: DialogOption)

Finish a specific dialog option

@param dialogOption — Dialog option that should be finished

getStat

function Unit.getStat(self: Unit, stat: Stat)
  -> Value: number

returns a stat value of a specified stat

@param stat — Stat

@return Value — of the stat

getStatByName

function Unit.getStatByName(self: Unit, statName: string)
  -> Value: number

returns a stat value by its stat name

@param statName — name of the stat

@return Value — of the stat

hasAbility

function Unit.hasAbility(self: Unit, ability: Ability)
  -> boolean

Returns if the unit already has the specified ability

@param ability — Ability

heal

function Unit.heal(self: Unit, health: number)

@param health — Hitpoints added

hit

function Unit.hit(self: Unit, damage: number)

@param damage — Damage dealt

increaseStat

function Unit.increaseStat(self: Unit, stat: StatReference, offset: number)

Adds an offset to a specified stat

@param stat — Stat reference

@param offset — Offset added to the stat

interactionObject

Object

returns the current interaction object

interactionUnit

Unit

returns the current interaction unit

inventory

Inventory

returns the inventory of this unit

isAlive

boolean

is this unit alive

isAnimationFinished

boolean

is the current animation finished

isAttacking

boolean

is this unit currently attacking

isMoving

boolean

is this unit currently moving

isRunning

boolean

is this unit currently running

isSelectedHero

boolean

is this unit a selected hero

lookAt

function Unit.lookAt(self: Unit, position: Vector2)

Look at a world posiiton

@param position — Posiiton to look at

moveBodyByWithVelocity

function Unit.moveBodyByWithVelocity(self: Unit, x: number, y: number)

tell the unit to move using a defined velocity

@param x — velocity (x axis)

@param y — velocity (y axis)

moveBy

function Unit.moveBy(self: Unit, x: number, y: number)

tell the unit to move by a specific position

@param x — relative x coordinate

@param y — relative y coordinate

moveTo

function Unit.moveTo(self: Unit, x: number, y: number)

tell the unit to move to a specific position

@param x — x coordinate

@param y — y coordinate

moveToArea

function Unit.moveToArea(self: Unit, area: string)

tell the unit to move to an area

@param area — area name

object

Object

returns the object of this unit

pauseCommands

function Unit.pauseCommands(self: Unit, duration: Time)

pauses all commands

@param duration — How long commands should be paused

position

Vector2

position of this unit

resetNextDialog

function Unit.resetNextDialog(self: Unit)

Reset the next dialog of this unit

resources

ResourceContainer

returns the resources of this unit

respawn

function Unit.respawn(self: Unit)

Respawn this unit

selectAbilityAt

function Unit.selectAbilityAt(self: Unit, index: integer)

Selects an ability

@param index — index of the ability

selectNextAbility

function Unit.selectNextAbility(self: Unit)

selects the next ability in the list of abilities

selectPreviousAbility

function Unit.selectPreviousAbility(self: Unit)

selects the previous ability in the list of abilities

selectedAbilityIndex

integer

the current ability index

setPosition

function Unit.setPosition(self: Unit, x: number, y: number)

set the position of this unit

@param x — X coordinate

@param y — Y coordinate

speed

integer

movement speed

startAnimation

function Unit.startAnimation(self: Unit, animation: string, mode: AnimationMode, duration: integer)

starts an animation

@param animation — Name of the animation

@param mode — Animation mode

@param duration — Duration(ms)

startDefaultAnimation

function Unit.startDefaultAnimation(self: Unit)

start the default animation for this unit

startRunning

function Unit.startRunning(self: Unit)

start running mode

startWalkAnimation

function Unit.startWalkAnimation(self: Unit)

start the walk animation of this unit

stop

function Unit.stop(self: Unit)

stop movement

stopCommandPause

function Unit.stopCommandPause(self: Unit)

stops the pause of the commands

stopInteraction

function Unit.stopInteraction(self: Unit)

Stops interaction with the current object

stopRunning

function Unit.stopRunning(self: Unit)

stop running mode

takeAllLootItems

function Unit.takeAllLootItems(self: Unit)

Take all loot items of the currently active loot object

takeLootItemStack

function Unit.takeLootItemStack(self: Unit, stackIndex: integer)

Take a single loot stack of the currently looted object

@param stackIndex — index of the stack that should be taken

talkWithObject

function Unit.talkWithObject(self: Unit, object: Object)

Talk with a specified object

@param object — Object to talk with or nil to stop talking

team

UnitTeam

team of this unit

unlockAbility

function Unit.unlockAbility(self: Unit, ability: Ability)

unlock a specific ability

@param ability — Ability that should be unlocked

useAbilityAtIndex

function Unit.useAbilityAtIndex(self: Unit, abilityIndex: integer, position: Vector2)

Use an ability with a specified target position

@param abilityIndex — index of the ability

@param position — Target position of the ability

useInventoryItem

function Unit.useInventoryItem(self: Unit, index: integer)

Use an inventory item

@param index — index of the item

useSelectedAbilityAt

function Unit.useSelectedAbilityAt(self: Unit, position: Vector2)

Use the currently selected ability with a specified target position

@param position — Target position of the ability

weapon

Item|nil

Returns the first weapon in the unit equipment


Unit.abortCurrentCommand

function Unit.abortCurrentCommand(self: Unit)

Unit.addExperience

Add experience to this unit

@param experience — experience points to add

function Unit.addExperience(self: Unit, experience: integer)

Unit.addItem

add an item to the unit

@param item — item that should be added

function Unit.addItem(self: Unit, item: Item)

Unit.addItemByName

add an item to the unit

@param itemName — Name of the item that should be added

function Unit.addItemByName(self: Unit, itemName: string)

Unit.attack

tell the unit to attack at the current position

function Unit.attack(self: Unit)

Unit.attackUnit

tell the unit to attack a unit

@param unit — Unit that should be attacked

function Unit.attackUnit(self: Unit, unit: Unit)

Unit.buyTraderItemAt

buy an item from the curren trader

@param itemIndex — Index of the item

@return Returns — if the item was bought

function Unit.buyTraderItemAt(self: Unit, itemIndex: integer)
  -> Returns: boolean

Unit.canExecuteReply

Returns if the dialog reply can be executed

@param replyIndex — Index of the reply

function Unit.canExecuteReply(self: Unit, replyIndex: integer)
  -> boolean

Unit.canPayTraderItemAt

Check if an item can be bought from the curren trader

@param itemIndex — Index of the item

@return Returns — if the item was bought

function Unit.canPayTraderItemAt(self: Unit, itemIndex: integer)
  -> Returns: boolean

Unit.canUnlockAbility

Returns if the specified ability can be unlocked

@param ability — Ability that should be unlocked

function Unit.canUnlockAbility(self: Unit, ability: Ability)
  -> boolean

Unit.castSpell

Cast the currently selected spell at a target position

@param position — Target position of the spell

function Unit.castSpell(self: Unit, position: Vector2)

Unit.displayColoredText

displays a colored text above this unit for a fixed duration

@param text — Text to display

@param duration — How long the text should be displayed

@param color — Color of the text

function Unit.displayColoredText(self: Unit, text: string, duration: number, color: Color)

Unit.displayText

displays a text above this unit for a fixed duration

@param text — Text to display

@param duration — How long the text should be displayed

function Unit.displayText(self: Unit, text: string, duration: number)

Unit.dropInventoryItem

Drop an inventory item

@param index — index of the item

function Unit.dropInventoryItem(self: Unit, index: integer)

Unit.executeDialogReply

Execute a specific dialog reply

@param replyIndex — Index of the reply

function Unit.executeDialogReply(self: Unit, replyIndex: integer)

Unit.findNearestEnemy

@param distance — Maximum distance

@return closest — enemy

function Unit.findNearestEnemy(self: Unit, distance: number)
  -> closest: Unit

Unit.finishDialog

Finish a specific dialog option

@param dialogOption — Dialog option that should be finished

function Unit.finishDialog(self: Unit, dialogOption: DialogOption)

Unit.getStat

returns a stat value of a specified stat

@param stat — Stat

@return Value — of the stat

function Unit.getStat(self: Unit, stat: Stat)
  -> Value: number
function Unit.getStat(self: Unit, stat: StatReference)
  -> Value: number

Unit.getStatByName

returns a stat value by its stat name

@param statName — name of the stat

@return Value — of the stat

function Unit.getStatByName(self: Unit, statName: string)
  -> Value: number

Unit.hasAbility

Returns if the unit already has the specified ability

@param ability — Ability

function Unit.hasAbility(self: Unit, ability: Ability)
  -> boolean

Unit.heal

@param health — Hitpoints added

function Unit.heal(self: Unit, health: number)

Unit.hit

@param damage — Damage dealt

function Unit.hit(self: Unit, damage: number)

Unit.increaseStat

Adds an offset to a specified stat

@param stat — Stat reference

@param offset — Offset added to the stat

function Unit.increaseStat(self: Unit, stat: StatReference, offset: number)
function Unit.increaseStat(self: Unit, stat: Stat, offset: number)

Unit.lookAt

Look at a world posiiton

@param position — Posiiton to look at

function Unit.lookAt(self: Unit, position: Vector2)

Unit.moveBodyByWithVelocity

tell the unit to move using a defined velocity

@param x — velocity (x axis)

@param y — velocity (y axis)

function Unit.moveBodyByWithVelocity(self: Unit, x: number, y: number)

Unit.moveBy

tell the unit to move by a specific position

@param x — relative x coordinate

@param y — relative y coordinate

function Unit.moveBy(self: Unit, x: number, y: number)

Unit.moveTo

tell the unit to move to a specific position

@param x — x coordinate

@param y — y coordinate

function Unit.moveTo(self: Unit, x: number, y: number)

Unit.moveToArea

tell the unit to move to an area

@param area — area name

function Unit.moveToArea(self: Unit, area: string)

Unit.pauseCommands

pauses all commands

@param duration — How long commands should be paused

function Unit.pauseCommands(self: Unit, duration: Time)

Unit.resetNextDialog

Reset the next dialog of this unit

function Unit.resetNextDialog(self: Unit)

Unit.respawn

Respawn this unit

function Unit.respawn(self: Unit)

Unit.selectAbilityAt

Selects an ability

@param index — index of the ability

function Unit.selectAbilityAt(self: Unit, index: integer)

Unit.selectNextAbility

selects the next ability in the list of abilities

function Unit.selectNextAbility(self: Unit)

Unit.selectPreviousAbility

selects the previous ability in the list of abilities

function Unit.selectPreviousAbility(self: Unit)

Unit.setPosition

set the position of this unit

@param x — X coordinate

@param y — Y coordinate

function Unit.setPosition(self: Unit, x: number, y: number)

Unit.startAnimation

starts an animation

@param animation — Name of the animation

@param mode — Animation mode

@param duration — Duration(ms)

function Unit.startAnimation(self: Unit, animation: string, mode: AnimationMode, duration: integer)

Unit.startDefaultAnimation

start the default animation for this unit

function Unit.startDefaultAnimation(self: Unit)

Unit.startRunning

start running mode

function Unit.startRunning(self: Unit)

Unit.startWalkAnimation

start the walk animation of this unit

function Unit.startWalkAnimation(self: Unit)

Unit.stop

stop movement

function Unit.stop(self: Unit)

Unit.stopCommandPause

stops the pause of the commands

function Unit.stopCommandPause(self: Unit)

Unit.stopInteraction

Stops interaction with the current object

function Unit.stopInteraction(self: Unit)

Unit.stopRunning

stop running mode

function Unit.stopRunning(self: Unit)

Unit.takeAllLootItems

Take all loot items of the currently active loot object

function Unit.takeAllLootItems(self: Unit)

Unit.takeLootItemStack

Take a single loot stack of the currently looted object

@param stackIndex — index of the stack that should be taken

function Unit.takeLootItemStack(self: Unit, stackIndex: integer)

Unit.talkWithObject

Talk with a specified object

@param object — Object to talk with or nil to stop talking

function Unit.talkWithObject(self: Unit, object: Object)

Unit.unlockAbility

unlock a specific ability

@param ability — Ability that should be unlocked

function Unit.unlockAbility(self: Unit, ability: Ability)

Unit.useAbilityAtIndex

Use an ability with a specified target position

@param abilityIndex — index of the ability

@param position — Target position of the ability

function Unit.useAbilityAtIndex(self: Unit, abilityIndex: integer, position: Vector2)

Unit.useInventoryItem

Use an inventory item

@param index — index of the item

function Unit.useInventoryItem(self: Unit, index: integer)

Unit.useSelectedAbilityAt

Use the currently selected ability with a specified target position

@param position — Target position of the ability

function Unit.useSelectedAbilityAt(self: Unit, position: Vector2)

UnitEffect

UnitEffect

UnitEffect

displayName

string

Display name of the UnitEffect

guid

Guid

UnitEffect guid

iconPath

string

Path to the UnitEffect icon

name

string

Name of the UnitEffect


UnitEffectManager

UnitEffectManager

UnitEffectManager

getUnitEffectByName

function UnitEffectManager.getUnitEffectByName(self: UnitEffectManager, name: string)
  -> UnitEffect

returns an UnitEffect by its name

@param name — Name of the UnitEffect

unitEffects

UnitEffect[]

All Abilities


UnitEffectManager.getUnitEffectByName

returns an UnitEffect by its name

@param name — Name of the UnitEffect

function UnitEffectManager.getUnitEffectByName(self: UnitEffectManager, name: string)
  -> UnitEffect
function UnitEffectManager.getUnitEffectByName(self: UnitEffectManager, guid: Guid)
  -> UnitEffect

UnitEffectReference

UnitEffectReference

UnitEffectReference

UnitEffect

UnitEffect

Returns the UnitEffect of this reference

guid

Guid

Guid of the UnitEffect


UnitTeam

{
    Neutral: integer = 0,
    Enemy: integer = 1,
    Player: integer = 2,
}

UnitTeam.Enemy


UnitTeam.Neutral


UnitTeam.Player


Vector2

angle

number

angle of the vector

clear

function Vector2.clear(self: Vector2)

clear vector

length

number

length of the vector

x

number

x coordinate of the vector

y

number

y coordinate of the vector


Vector2

Create Vector2 instance

Vector2

Vector2.clear

clear vector

function Vector2.clear(self: Vector2)

Widget

Widget

Widget

addChild

function Widget.addChild(self: Widget, child: Widget)

Adds a child to this widget

@param child — Child to be added

addColumn

function Widget.addColumn(self: Widget, text: string)

adds a column via text

@param text — Text of the new column

addItem

function Widget.addItem(self: Widget, itemText: string)

adds an item via text

@param itemText — Text of the item to be added

addLine

function Widget.addLine(self: Widget, text: string)

adds a new text to a ChatBox widget

@param text — Text to be added

clearColumns

function Widget.clearColumns(self: Widget)

Clear all columns of the widget

clearItems

function Widget.clearItems(self: Widget)

Clears all items of the widget

clone

function Widget.clone(self: Widget)
  -> Widget

Clones this widget and returns the copy

enabled

boolean

Enabled state of the widget

findWidget

function Widget.findWidget(self: Widget, name: string)
  -> Widget

Returns a widget by its name

@param name — Name of the widget

focusable

boolean

Focusable state of the widget

focused

boolean

Focused state of the widget

hideWithEffect

function Widget.hideWithEffect(self: Widget, animationType: ShowAnimationType, duration: number)

Hides the widget using an effect

@param animationType — animation type

@param duration — Duration of the effect(seconds)

isAnimationPlaying

boolean

Is this widget currently playing an animation

isContainer

boolean

Returns if the widget is a container

itemHeight

number

Item height of this widget(For ListView / ListBox widgets)

loadIcon

function Widget.loadIcon(self: Widget, texture: string)

Load an icon texture of a widget

@param texture — Path to the texture relative to the folder data/icons

loadItemIcon

function Widget.loadItemIcon(self: Widget, index: integer, texture: string)

Loads an item icon via index

@param index — Index of the item

@param texture — Path to the icon texture

loadTexture

function Widget.loadTexture(self: Widget, texture: string)

Load a texture of a widget

@param texture — Path to the texture relative to the ui textures folder data/ui/textures

maximum

number

Maximum value of the widget. Implemented for ProgressBar and Slider widgets

minimum

number

Minimum value of the widget. Implemented for ProgressBar and Slider widgets

name

string

Name of the widget

onAnimationFinished

function

Callback function called the widget animation is finished

onClick

function

Callback function called when the user clicks on this widget

onFocus

function

Callback function called when the widget gets focused

onMouseEnter

function

Callback function called when the user enters the widget with the mouse cursor

onMouseLeave

function

Callback function called when the user leaves the widget with the mouse cursor

onRightClick

function

Callback function called when the user right clicks on this widget

onUnfocus

function

Callback function called when the widget gets unfocused

onValueChange

function

Callback function called the value of the widget was changed

opacity

number

Opacity(0-1)

parent

Widget

Returns the parent widget

playVideo

function Widget.playVideo(self: Widget, video: string, loop: boolean)

Play a video(For VideoWidget)

@param video — Path of the video

@param loop — Should the video be looped

position

TGUI_Vector2

Position of the widget

removeAllWidgets

function Widget.removeAllWidgets(self: Widget)

Removes all children from a widget

removeChild

function Widget.removeChild(self: Widget, child: Widget)

Removes a child from this widget

@param child — Child to be added

renderModelAnimation

function Widget.renderModelAnimation(self: Widget, unit: Unit, animation: string)
  -> Returns: boolean

Renders a model animation(For Canvas or Picture widgets)

@param unit — to be rendered

@param animation — Animation name

@return Returns — if the rendering is complete

selectedItemIndex

integer

Currently selected item index(For ListView / ListBox widgets)

setHeight

function Widget.setHeight(self: Widget, height: number)

Sets the height of this widget

@param height — New height of the widget(Pixels)

setIconSize

function Widget.setIconSize(self: Widget, sizeX: integer, sizeY: integer)

sets the icon size for this widget

@param sizeX — Horizontal icon size(Pixels)

@param sizeY — Vertical icon size(Pixels)

setSize

function Widget.setSize(self: Widget, width: number, height: number)

Sets the size of this widget

@param width — New width of the widget(Pixels)

@param height — New height of the widget(Pixels)

setWidth

function Widget.setWidth(self: Widget, width: number)

Sets the width of this widget

@param width — New width of the widget(Pixels)

showWithEffect

function Widget.showWithEffect(self: Widget, animationType: ShowAnimationType, duration: number)

Shows the widget using an effect

@param animationType — animation type

@param duration — Duration of the effect(seconds)

size

TGUI_Vector2

size of the widget

text

string

Text of the widget

textSize

integer

Text size(Pixels)

tooltip

Widget

Tooltip of this widget

value

number

Value of the widget. Implemented for ProgressBar and Slider widgets

visible

boolean

Visible state of the widget


Widget.addChild

Adds a child to this widget

@param child — Child to be added

function Widget.addChild(self: Widget, child: Widget)

Widget.addColumn

adds a column via text

@param text — Text of the new column

function Widget.addColumn(self: Widget, text: string)
function Widget.addColumn(self: Widget, text: string, width: number, alignment: ColumnAlignment)

Widget.addItem

adds an item via text

@param itemText — Text of the item to be added

function Widget.addItem(self: Widget, itemText: string)
function Widget.addItem(self: Widget, itemText1: string, itemText2: string)

Widget.addLine

adds a new text to a ChatBox widget

@param text — Text to be added

function Widget.addLine(self: Widget, text: string)

Widget.clearColumns

Clear all columns of the widget

function Widget.clearColumns(self: Widget)

Widget.clearItems

Clears all items of the widget

function Widget.clearItems(self: Widget)

Widget.clone

Clones this widget and returns the copy

function Widget.clone(self: Widget)
  -> Widget

Widget.findWidget

Returns a widget by its name

@param name — Name of the widget

function Widget.findWidget(self: Widget, name: string)
  -> Widget

Widget.hideWithEffect

Hides the widget using an effect

@param animationType — animation type

@param duration — Duration of the effect(seconds)

function Widget.hideWithEffect(self: Widget, animationType: ShowAnimationType, duration: number)

Widget.loadIcon

Load an icon texture of a widget

@param texture — Path to the texture relative to the folder data/icons

function Widget.loadIcon(self: Widget, texture: string)

Widget.loadItemIcon

Loads an item icon via index

@param index — Index of the item

@param texture — Path to the icon texture

function Widget.loadItemIcon(self: Widget, index: integer, texture: string)

Widget.loadTexture

Load a texture of a widget

@param texture — Path to the texture relative to the ui textures folder data/ui/textures

function Widget.loadTexture(self: Widget, texture: string)

Widget.playVideo

Play a video(For VideoWidget)

@param video — Path of the video

@param loop — Should the video be looped

function Widget.playVideo(self: Widget, video: string, loop: boolean)

Widget.removeAllWidgets

Removes all children from a widget

function Widget.removeAllWidgets(self: Widget)

Widget.removeChild

Removes a child from this widget

@param child — Child to be added

function Widget.removeChild(self: Widget, child: Widget)

Widget.renderModelAnimation

Renders a model animation(For Canvas or Picture widgets)

@param unit — to be rendered

@param animation — Animation name

@return Returns — if the rendering is complete

function Widget.renderModelAnimation(self: Widget, unit: Unit, animation: string)
  -> Returns: boolean

Widget.setHeight

Sets the height of this widget

@param height — New height of the widget(Pixels)

function Widget.setHeight(self: Widget, height: number)

Widget.setIconSize

sets the icon size for this widget

@param sizeX — Horizontal icon size(Pixels)

@param sizeY — Vertical icon size(Pixels)

function Widget.setIconSize(self: Widget, sizeX: integer, sizeY: integer)

Widget.setSize

Sets the size of this widget

@param width — New width of the widget(Pixels)

@param height — New height of the widget(Pixels)

function Widget.setSize(self: Widget, width: number, height: number)

Widget.setWidth

Sets the width of this widget

@param width — New width of the widget(Pixels)

function Widget.setWidth(self: Widget, width: number)

Widget.showWithEffect

Shows the widget using an effect

@param animationType — animation type

@param duration — Duration of the effect(seconds)

function Widget.showWithEffect(self: Widget, animationType: ShowAnimationType, duration: number)

abilityManager

nil

action

table

action.fadeIn

Create an action which fades an object in

@param duration — Duration of the action

function action.fadeIn(duration: Time)
  -> ObjectAction

action.fadeOut

Create an action which fades an object out

@param duration — Duration of the action

function action.fadeOut(duration: Time)
  -> ObjectAction
function action.fadeOut(animationName: string)
  -> ObjectAction

action.moveBy

Create an action which moves an object by a specific offset

@param offset — Move offset

@param duration — Duration of the action

function action.moveBy(offset: Vector2, duration: Time)
  -> ObjectAction

action.moveTo

Create an action which moves an object to a specific position

@param target — Target position

@param duration — Duration of the action

function action.moveTo(target: Vector2, duration: Time)
  -> ObjectAction

action.parallel

Creates an action with a list of actions which are executed in parallel

@param ... — Actions to execute in parallel

function action.parallel(...ObjectAction)
  -> ObjectAction

action.scale

Create an action which scales an object to a defined scale(1=Default scale)

@param targetScale — Target scale

@param duration — Duration of the action

function action.scale(targetScale: number, duration: Time)
  -> ObjectAction

action.sequence

Creates an action with a sequence of actions

@param ... — Actions to execute as a sequence

function action.sequence(...ObjectAction)
  -> ObjectAction

action.wait

Create an action which waits for a specific duration

@param duration — Duration of the action

function action.wait(duration: Time)
  -> ObjectAction

addCharacter

Spawns a new unit by a character name

@param name — Name of the character

@param x — X coordinate

@param y — Y coordinate

function addCharacter(name: string, x: number, y: number)

addCharacterClass

Spawns a new unit by a character class

@param characterClass — Character class used for spawning

@param x — X coordinate

@param y — Y coordinate

function addCharacterClass(characterClass: CharacterClassReference, x: number, y: number)

addLight

adds a new light and returns the light ID

function addLight()
  -> integer

addUnit

Spawns a new unit

@param name — Name of the unit

@param x — X coordinate

@param y — Y coordinate

function addUnit(name: string, x: number, y: number)

animationMode

table

applyGameSettings

Applies the game settings to the game

@param settings — Settings of the game

function applyGameSettings(settings: GameSettings)

assert

Raises an error if the value of its argument v is false (i.e., nil or false); otherwise, returns all its arguments. In case of error, message is the error object; when absent, it defaults to "assertion failed!"

View documents

function assert(v?: <T>, message?: any, ...any)
  -> <T>
  2. ...any

attacker

Attacker of the current damage script

nil

autoSave

Executes an auto save of the game

function autoSave()

camera

nil

columnAlignment

table

damageTypeManager

nil

deleteSavegame

Deletes a savegame by its name

@param name — Name of the savegame

function deleteSavegame(name: string)

dialogManager

nil

enableGameUpdate

Enable or disable the game update

@param enabled — Should the game update be enabled

function enableGameUpdate(enabled: boolean)

endGamePause

Ends the game pause

function endGamePause()

gameEventType

{
    Custom: integer = 0,
    QuestStarted: integer = 1,
    QuestStateChanged: integer = 2,
    QuestObjectiveStateChanged: integer = 3,
    HeroStatChanged: integer = 4,
    UnitDied: integer = 5,
    PlayVideo: integer = 6,
    VideoFinished: integer = 7,
    HeroSelectionChanged: integer = 8,
    LoadLevelStarted: integer = 9,
}

gameEventType.Custom


gameEventType.HeroSelectionChanged


gameEventType.HeroStatChanged


gameEventType.LoadLevelStarted


gameEventType.PlayVideo


gameEventType.QuestObjectiveStateChanged


gameEventType.QuestStarted


gameEventType.QuestStateChanged


gameEventType.UnitDied


gameEventType.VideoFinished


getCurrentCutscene

Returns the current cutscene

function getCurrentCutscene()
  -> Cutscene

getCurrentCutsceneDialog

Returns the current cutscene dialog

function getCurrentCutsceneDialog()
  -> CutsceneDialog

getCurrentDeltaTime

returns the delta time of the current frame

function getCurrentDeltaTime()
  -> number

getCurrentHero

returns the current hero

function getCurrentHero()
  -> Unit

getGameSettings

Returns the current game settings

function getGameSettings()
  -> GameSettings

getHeroAt

returns a hero by its index

@param heroIndex — Index of the hero

function getHeroAt(heroIndex: integer)
  -> Unit

getLoadingScreenData

Returns the loading screen data

function getLoadingScreenData()
  -> LoadingScreenData

getOnScreenText

Returns the current onscreen text

@return Returns — the current onscreen text as a string

function getOnScreenText()
  -> Returns: string

getSavegames

Returns all savegames

function getSavegames()
  -> Savegame[]

getStringVariable

returns a global string variable

@param name — Name of the variable

function getStringVariable(name: string)
  -> string

getTileID

returns a tile ID by its relative path

@param relativePath — Relative image path

@return tile — ID

function getTileID(relativePath: string)
  -> tile: integer

getUnit

returns a unit by its ID

@param unitId — Unit ID

function getUnit(unitID: integer)
  -> Unit|nil
function getUnit(unitId: integer)
  -> Unit

getUnitAt

returns a unit by its position

@param position — Position of the unit

function getUnitAt(position: Vector2)
  -> Unit|nil

getVariable

returns a global number variable

@param name — Name of the variable

function getVariable(name: string)
  -> number

getfenv

Returns the current environment in use by the function. f can be a Lua function or a number that specifies the function at that stack level.

View documents

function getfenv(f?: integer|fun(...any):...unknown)
  -> table

getmetatable

If object does not have a metatable, returns nil. Otherwise, if the object’s metatable has a __metatable field, returns the associated value. Otherwise, returns the metatable of the given object.

View documents

function getmetatable(object: any)
  -> metatable: table

globalVariables

nil

hasNextCutsceneDialog

Returns if the current cutscene contains a next dialog

function hasNextCutsceneDialog()
  -> boolean

hasPreviousCutsceneDialog

Returns if the current cutscene contains a previous dialog

function hasPreviousCutsceneDialog()
  -> boolean

io

View documents

iolib

io.close

Close file or default output file.

View documents

exitcode:
    | "exit"
    | "signal"
function io.close(file?: file*)
  -> suc: boolean?
  2. exitcode: ("exit"|"signal")?
  3. code: integer?

io.flush

Saves any written data to default output file.

View documents

function io.flush()

io.input

Sets file as the default input file.

View documents

function io.input(file: string|file*)

io.lines


for c in io.lines(filename, ...) do
    body
end

View documents

...(param):
    | "n" -- Reads a numeral and returns it as number.
    | "a" -- Reads the whole file.
   -> "l" -- Reads the next line skipping the end of line.
    | "L" -- Reads the next line keeping the end of line.
function io.lines(filename?: string, ...string|integer|"L"|"a"|"l"...(+1))
  -> fun():any, ...unknown

io.open

Opens a file, in the mode specified in the string mode.

View documents

mode:
   -> "r" -- Read mode.
    | "w" -- Write mode.
    | "a" -- Append mode.
    | "r+" -- Update mode, all previous data is preserved.
    | "w+" -- Update mode, all previous data is erased.
    | "a+" -- Append update mode, previous data is preserved, writing is only allowed at the end of file.
    | "rb" -- Read mode. (in binary mode.)
    | "wb" -- Write mode. (in binary mode.)
    | "ab" -- Append mode. (in binary mode.)
    | "r+b" -- Update mode, all previous data is preserved. (in binary mode.)
    | "w+b" -- Update mode, all previous data is erased. (in binary mode.)
    | "a+b" -- Append update mode, previous data is preserved, writing is only allowed at the end of file. (in binary mode.)
function io.open(filename: string, mode?: "a"|"a+"|"a+b"|"ab"|"r"...(+7))
  -> file*?
  2. errmsg: string?

io.output

Sets file as the default output file.

View documents

function io.output(file: string|file*)

io.popen

Starts program prog in a separated process.

View documents

mode:
    | "r" -- Read data from this program by `file`.
    | "w" -- Write data to this program by `file`.
function io.popen(prog: string, mode?: "r"|"w")
  -> file*?
  2. errmsg: string?

io.read

Reads the file, according to the given formats, which specify what to read.

View documents

...(param):
    | "n" -- Reads a numeral and returns it as number.
    | "a" -- Reads the whole file.
   -> "l" -- Reads the next line skipping the end of line.
    | "L" -- Reads the next line keeping the end of line.
function io.read(...string|integer|"L"|"a"|"l"...(+1))
  -> any
  2. ...any

io.tmpfile

In case of success, returns a handle for a temporary file.

View documents

function io.tmpfile()
  -> file*

io.type

Checks whether obj is a valid file handle.

View documents

return #1:
    | "file" -- Is an open file handle.
    | "closed file" -- Is a closed file handle.
    | `nil` -- Is not a file handle.
function io.type(file: file*)
  -> "closed file"|"file"|`nil`

io.write

Writes the value of each of its arguments to default output file.

View documents

function io.write(...any)
  -> file*
  2. errmsg: string?

ipairs

Returns three values (an iterator function, the table t, and 0) so that the construction

    for i,v in ipairs(t) do body end

will iterate over the key–value pairs (1,t[1]), (2,t[2]), ..., up to the first absent index.

View documents

function ipairs(t: <T:table>)
  -> fun(table: <V>[], i?: integer):integer, <V>
  2. <T:table>
  3. i: integer

isGamePaused

Returns if the game is paused

function isGamePaused()
  -> boolean

isHeroSelected

returns if a specific hero is selected

@param heroIndex — Index of the hero

function isHeroSelected(heroIndex: integer)
  -> boolean

isInputActionActive

returns if a specific input action is active

@param inputAction — Name of the input action

function isInputActionActive(inputAction: string)
  -> boolean

isLoadingLevel

Returns if a level is currently being loaded

function isLoadingLevel()

isLoadingTextures

Returns if the game is currently loading textures

function isLoadingTextures()

isLocalHeroSelected

returns if a specific hero is locally selected

@param heroIndex — Index of the hero

function isLocalHeroSelected(heroIndex: integer)
  -> boolean

isOnScreenTextVisible

Returns if any onscreen text is currently visible

function isOnScreenTextVisible()

isSinglePlayer

Returns if this is a single player game

function isSinglePlayer()
  -> boolean

itemManager

nil

load

Loads a chunk.

If chunk is a string, the chunk is this string. If chunk is a function, load calls it repeatedly to get the chunk pieces. Each call to chunk must return a string that concatenates with previous results. A return of an empty string, nil, or no value signals the end of the chunk.

View documents

mode:
    | "b" -- Only binary chunks.
    | "t" -- Only text chunks.
   -> "bt" -- Both binary and text.
function load(chunk: string|function, chunkname?: string, mode?: "b"|"bt"|"t", env?: table)
  -> function?
  2. error_message: string?

loadGame

Loads a savegame by its name

@param name — Name of the savegame

function loadGame(name: string)

loadLevel

Loads a new level

@param fileName — File name of the level

@param area — Area name where the hero should spawn

function loadLevel(fileName: string, area: string)

loadWidgetContainer

Load a widget container from a file name

@param fileName — Filename used to load the widget

function loadWidgetContainer(fileName: string)
  -> Widget

loadfile

Loads a chunk from file filename or from the standard input, if no file name is given.

View documents

mode:
    | "b" -- Only binary chunks.
    | "t" -- Only text chunks.
   -> "bt" -- Both binary and text.
function loadfile(filename?: string, mode?: "b"|"bt"|"t", env?: table)
  -> function?
  2. error_message: string?

loadstring

Loads a chunk from the given string.

View documents

function loadstring(text: string, chunkname?: string)
  -> function?
  2. error_message: string?

localizedTextManager

nil

log

log a message

@param message — Log message

function log(message: string)

logError

log an error message

@param message — Error message

function logError(message: string)

logMessage

Logs a game message

@param message — Message to log

function logMessage(message: string)

map

nil

math

View documents

mathlib

math.abs

Returns the absolute value of x.

View documents

function math.abs(x: <Number:number>)
  -> <Number:number>

math.acos

Returns the arc cosine of x (in radians).

View documents

function math.acos(x: number)
  -> number

math.asin

Returns the arc sine of x (in radians).

View documents

function math.asin(x: number)
  -> number

math.atan

Returns the arc tangent of y/x (in radians).

View documents

function math.atan(y: number, x?: number)
  -> number

math.atan2

Returns the arc tangent of y/x (in radians).

View documents

function math.atan2(y: number, x: number)
  -> number

math.ceil

Returns the smallest integral value larger than or equal to x.

View documents

function math.ceil(x: number)
  -> integer

math.cos

Returns the cosine of x (assumed to be in radians).

View documents

function math.cos(x: number)
  -> number

math.cosh

Returns the hyperbolic cosine of x (assumed to be in radians).

View documents

function math.cosh(x: number)
  -> number

math.deg

Converts the angle x from radians to degrees.

View documents

function math.deg(x: number)
  -> number

math.exp

Returns the value e^x (where e is the base of natural logarithms).

View documents

function math.exp(x: number)
  -> number

math.floor

Returns the largest integral value smaller than or equal to x.

View documents

function math.floor(x: number)
  -> integer

math.fmod

Returns the remainder of the division of x by y that rounds the quotient towards zero.

View documents

function math.fmod(x: number, y: number)
  -> number

math.frexp

Decompose x into tails and exponents. Returns m and e such that x = m * (2 ^ e), e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when x is zero).

View documents

function math.frexp(x: number)
  -> m: number
  2. e: number

math.ldexp

Returns m * (2 ^ e) .

View documents

function math.ldexp(m: number, e: number)
  -> number

math.log

Returns the logarithm of x in the given base.

View documents

function math.log(x: number, base?: integer)
  -> number

math.log10

Returns the base-10 logarithm of x.

View documents

function math.log10(x: number)
  -> number

math.max

Returns the argument with the maximum value, according to the Lua operator <.

View documents

function math.max(x: <Number:number>, ...<Number:number>)
  -> <Number:number>

math.min

Returns the argument with the minimum value, according to the Lua operator <.

View documents

function math.min(x: <Number:number>, ...<Number:number>)
  -> <Number:number>

math.modf

Returns the integral part of x and the fractional part of x.

View documents

function math.modf(x: number)
  -> integer
  2. number

math.pow

Returns x ^ y .

View documents

function math.pow(x: number, y: number)
  -> number

math.rad

Converts the angle x from degrees to radians.

View documents

function math.rad(x: number)
  -> number

math.random

View documents

function math.random(m: integer, n: integer)
  -> integer

math.randomseed

View documents

function math.randomseed(x?: integer, y?: integer)

math.sin

Returns the sine of x (assumed to be in radians).

View documents

function math.sin(x: number)
  -> number

math.sinh

Returns the hyperbolic sine of x (assumed to be in radians).

View documents

function math.sinh(x: number)
  -> number

math.sqrt

Returns the square root of x.

View documents

function math.sqrt(x: number)
  -> number

math.tan

Returns the tangent of x (assumed to be in radians).

View documents

function math.tan(x: number)
  -> number

math.tanh

Returns the hyperbolic tangent of x (assumed to be in radians).

View documents

function math.tanh(x: number)
  -> number

math.tointeger

If the value x is convertible to an integer, returns that integer.

View documents

function math.tointeger(x: any)
  -> integer?

math.type

Returns "integer" if x is an integer, "float" if it is a float, or nil if x is not a number.

View documents

return #1:
    | "integer"
    | "float"
    | 'nil'
function math.type(x: any)
  -> "float"|"integer"|'nil'

math.ult

Returns true if and only if m is below n when they are compared as unsigned integers.

View documents

function math.ult(m: integer, n: integer)
  -> boolean

module

Creates a module.

View documents

function module(name: string, ...any)

newproxy

function newproxy(proxy: boolean|table|userdata)
  -> userdata

next

Allows a program to traverse all fields of a table. Its first argument is a table and its second argument is an index in this table. A call to next returns the next index of the table and its associated value. When called with nil as its second argument, next returns an initial index and its associated value. When called with the last index, or with nil in an empty table, next returns nil. If the second argument is absent, then it is interpreted as nil. In particular, you can use next(t) to check whether a table is empty.

The order in which the indices are enumerated is not specified, even for numeric indices. (To traverse a table in numerical order, use a numerical for.)

The behavior of next is undefined if, during the traversal, you assign any value to a non-existent field in the table. You may however modify existing fields. In particular, you may set existing fields to nil.

View documents

function next(table: table<<K>, <V>>, index?: <K>)
  -> <K>?
  2. <V>?

object

object Object of the current script

nil

onGameEvent

Simulates that an event is triggered

function onGameEvent(event: GameEvent)

playMusic

Play a music track

@param fileName — File name of the music

@param loop — Should the music track be looped

function playMusic(fileName: string, loop: boolean)

playSound

Play a sound

@param fileName — File name of the sound

function playSound(fileName: string)

popUserInterfaceState

Pops(removes) the top element from the user interface state stack

function popUserInterfaceState()


pushUserInterfaceState

Pushes a user interface state to the state stack

function pushUserInterfaceState(state: any)

questManager

nil

questState

table

quickSave

Executes a quick save of the game

function quickSave()

rawequal

Checks whether v1 is equal to v2, without invoking the __eq metamethod.

View documents


replaceText

Replaces all text tags in the specified text and returns the processed text

@param text — Text to be processed

function replaceText(text: string)

resourceManager

nil

saveGame

Saves a savegame by its name

@param name — Name of the savegame

function saveGame(name: string)

seconds

Create a Time object with the specified anount of seconds

@param seconds — Time in seconds

function seconds(seconds: number)
  -> Time

selectHeroAt

Selects a specific hero by its index

@param heroIndex — Index of the hero

function selectHeroAt(heroIndex: integer)

setAmbientColor

sets the ambient color

@param red — Red(0-1)

@param green — Green(0-1)

@param blue — Blue(0-1)

@param alpha — Alpha(0-1)

function setAmbientColor(red: number, green: number, blue: number, alpha: number)

setLevelLoadingEnabled

Enables or disables level loading

@param enable — Enabled/Disabled state

function setLevelLoadingEnabled(enable: boolean)

setLightAlpha

sets the alpha value of a light

@param lightID — ID of the light

@param alpha — Alpha value(0-1)

function setLightAlpha(lightID: integer, alpha: number)

setLightPosition

sets a light position

@param lightID — ID of the light

@param x — X position

@param y — Y position

function setLightPosition(lightID: integer, x: number, y: number)

setLightZ

sets a light’s z coordinate

@param lightID — ID of the light

@param z — Z coordinate of the light

function setLightZ(lightID: integer, z: number)

setUserInterfaceState

Sets the current user interface state

@param state — State to be set

function setUserInterfaceState(state: string)

setVariable

sets a global variable

@param name — Name of the variable

@param value — Variable value

function setVariable(name: string, value: string)
function setVariable(name: string, value: number)

showAnimationType

table

sleep

sleep for a specifed duration(ms)

@param duration — Duration(ms)

function sleep(duration: integer)

spawnPrefabObject

Spawns a new object using a prefab

@param prefab — Prefab

@param position — Spawn position

function spawnPrefabObject(prefab: PrefabObjectReference, position: Vector2)

spawnPrefabObjectInArea

Spawns a new object using a prefab in an area

@param prefab — Prefab

@param area — Area name

function spawnPrefabObjectInArea(prefab: PrefabObjectReference, area: string)

startGamePause

Starts the game pause

function startGamePause()

startNextCutsceneDialog

Starts the next cutscene dialog

function startNextCutsceneDialog()

startPreviousCutsceneDialog

Starts the previous cutscene dialog

function startPreviousCutsceneDialog()

statManager

nil

stopCutscene

Stops the current cutscene

function stopCutscene()

stopScript

stops the current script

function stopScript()

targetPosition

Target position of an ability

nil

toggleGamePause

Toggles the game pause

function toggleGamePause()

unit

Unit of the current unit script

nil

unit.direction

integer
integer

unit.position.x

integer
integer

unit.team

integer

unitEffectManager

nil

unitTeam

table

units

nil

updateSavegames

Updates all savegames

function updateSavegames()

widget

Widget of the current script

nil