dialoguestep
dialoguestep
The dialoguestep class represents a single step or decision node in a dialogue sequence. Supports interactive player choices (options), branch conditions, media, and transitions.
Overview
Properties (15)
| Property | Type | Summary |
|---|---|---|
entities
|
table
|
Table of associated entities. |
entity
|
entity
|
The speaking entity associated with this step. |
extraPosition
|
vector3
|
3D camera pan position. |
falseNext
|
number
|
Target step index when condition evaluates false. |
hasOptions
|
boolean
|
Checks if step has choice options. |
media
|
string
|
Sound or music resource path. |
next
|
number
|
Target step index for primary connection. |
optionCount
|
number
|
Number of choice options on step. |
position
|
vector2
|
Graph editor 2D position. |
script
|
string
|
Lua script executed on step activation. |
text
|
string
|
The text line or script content. |
title
|
string
|
Title or label of the step. |
trueNext
|
number
|
Target step index when condition evaluates true. |
type
|
number
|
The step type ID (see dialoguesteptype). |
typeName
|
string
|
The step type name string. |
Methods (36)
| Method Signature | Returns | Summary |
|---|---|---|
dialoguestep:addBranch(valueOrWeight, [target], [action])
|
dialoguestep
|
Adds a branch for switch or random step. |
dialoguestep:addEntity(entityVal)
|
dialoguestep
|
Adds an entity to the step. |
dialoguestep:addOption(arg1, [arg2], [arg3], [arg4])
|
dialoguestep
|
Adds an interactive choice option button. |
dialoguestep:clearOptions()
|
dialoguestep
|
Clears all choice options from this step. |
dialoguestep:clone()
|
dialoguestep
|
Creates a deep copy of this dialogue step. |
dialoguestep:connect(nextVal)
|
dialoguestep
|
Connects primary exit connection to next step. |
dialoguestep:connectFalse(nextVal)
|
dialoguestep
|
Connects FALSE condition exit connection. |
dialoguestep:connectTrue(nextVal)
|
dialoguestep
|
Connects TRUE condition exit connection. |
dialoguestep.createCamera(target)
|
dialoguestep
|
Static factory for camera pan step. |
dialoguestep.createCondition(script, [trueTarget], [falseTarget])
|
dialoguestep
|
Static factory for condition step. |
dialoguestep.createDelay(seconds)
|
dialoguestep
|
Static factory for timed delay step. |
dialoguestep.createEntity(entity, text)
|
dialoguestep
|
Static factory for NPC dialogue step. |
dialoguestep.createMusic(media)
|
dialoguestep
|
Static factory for music step. |
dialoguestep.createNarrative(text)
|
dialoguestep
|
Static factory for narrative text step. |
dialoguestep.createPlayer(text)
|
dialoguestep
|
Static factory for player dialogue step. |
dialoguestep.createRadio(entity, text)
|
dialoguestep
|
Static factory for radio dialogue step. |
dialoguestep.createRandom()
|
dialoguestep
|
Static factory for random branch step. |
dialoguestep.createSwitch(script)
|
dialoguestep
|
Static factory for switch step. |
dialoguestep:getOption(index)
|
table
|
Gets data for a choice option. |
dialoguestep:getOptions()
|
table
|
Gets all choice options. |
dialoguestep.new([type], [text], [entity])
|
dialoguestep
|
Constructs a new dialogue step. |
dialoguestep:removeOption(index)
|
boolean
|
Removes a choice option by index. |
dialoguestep:setEntities(entitiesVal)
|
dialoguestep
|
Sets associated entities. |
dialoguestep:setEntity(entityVal)
|
dialoguestep
|
Sets speaking entity. |
dialoguestep:setExtraPosition(arg1, [y], [z])
|
dialoguestep
|
Sets 3D extra camera position. |
dialoguestep:setMedia(media)
|
dialoguestep
|
Sets media resource path. |
dialoguestep:setOptionAction(index, action)
|
boolean
|
Sets the Lua callback function executed when option is clicked. |
dialoguestep:setOptionCondition(index, conditionScript)
|
boolean
|
Sets the display condition script for an option. |
dialoguestep:setOptionNext(index, target)
|
boolean
|
Updates the destination step of an option. |
dialoguestep:setOptionText(index, text)
|
boolean
|
Updates the label text of an option. |
dialoguestep:setPosition(arg1, [y])
|
dialoguestep
|
Sets 2D graph editor position. |
dialoguestep:setScript(script)
|
dialoguestep
|
Sets activation script. |
dialoguestep:setText(text)
|
dialoguestep
|
Sets dialogue text line. |
dialoguestep:setTitle(title)
|
dialoguestep
|
Sets step title. |
dialoguestep:setType(typeVal)
|
dialoguestep
|
Sets step type. |
dialoguestep:show()
|
void
|
Displays this step immediately in the dialogue UI. |
Detailed Reference
dialoguestep.entitiestableArray of associated entities.
Gets or sets array of associated entities.
dialoguestep.entityentitySpeaking entity or nil.
Gets or sets the speaking entity.
dialoguestep.extraPositionvector33D camera pan position.
Target coordinates for camera panning.
dialoguestep.falseNextnumberFalse branch step index.
Target step when condition fails.
dialoguestep.hasOptionsbooleanTrue if options exist.
Returns true if interactive choices are configured.
dialoguestep.mediastringMedia resource path.
Gets or sets audio media path.
dialoguestep.nextnumberNext step index.
Next step index.
dialoguestep.optionCountnumberOption count.
Returns count of choices.
dialoguestep.positionvector2Graph position.
Position in node graph editor.
dialoguestep.scriptstringScript string.
Gets or sets trigger script.
dialoguestep.textstringDialogue text line.
Gets or sets the dialogue speech text or script string.
dialoguestep.titlestringStep title.
Gets or sets step title.
dialoguestep.trueNextnumberTrue branch step index.
Target step when condition passes.
dialoguestep.typenumberDialogue step type integer ID.
Gets or sets the step type.
dialoguestep.typeNamestringStep type name string.
Returns step type name (e.g. "NarrativeText", "EntityDialogue", "Condition").
dialoguestep:addBranch(valueOrWeight, [target], [action])| Parameter | Type | Default | Description |
|---|---|---|---|
valueOrWeight | string|number | Value key or random weight. | |
target | dialoguestep|number | optional | Destination step. |
action | function | optional | Callback. |
dialoguestepSelf.
Appends a case or weight branch.
dialoguestep:addEntity(entityVal)| Parameter | Type | Default | Description |
|---|---|---|---|
entityVal | entity|number | Entity to add. |
dialoguestepSelf.
Appends entity to step entities.
dialoguestep:addOption(arg1, [arg2], [arg3], [arg4])| Parameter | Type | Default | Description |
|---|---|---|---|
arg1 | string|table | Option text or table with {text, next, action, condition}. | |
arg2 | dialoguestep|number|function|string | optional | Next step, action callback, or condition script. |
arg3 | dialoguestep|number|function|string | optional | Additional option parameter. |
arg4 | dialoguestep|number|function|string | optional | Additional option parameter. |
dialoguestepSelf.
Adds a player response button to this dialogue step.
step:addOption("Sure, I can help!", nextStep, function()
print("Player agreed to quest!")
end)dialoguestep:clearOptions()dialoguestepSelf.
Removes all options.
dialoguestep:clone()dialoguestepCloned step.
Duplicates the step.
dialoguestep:connect(nextVal)| Parameter | Type | Default | Description |
|---|---|---|---|
nextVal | dialoguestep|number|nil | Destination step. |
dialoguestepSelf.
Wires transition to nextVal.
dialoguestep:connectFalse(nextVal)| Parameter | Type | Default | Description |
|---|---|---|---|
nextVal | dialoguestep|number|nil | Destination step if false. |
dialoguestepSelf.
Wires false branch to nextVal.
dialoguestep:connectTrue(nextVal)| Parameter | Type | Default | Description |
|---|---|---|---|
nextVal | dialoguestep|number|nil | Destination step if true. |
dialoguestepSelf.
Wires true branch to nextVal.
dialoguestep.createCamera(target)| Parameter | Type | Default | Description |
|---|---|---|---|
target | entity|vector3 | Camera target. |
dialoguestepCreated step.
Creates a camera panning step.
dialoguestep.createCondition(script, [trueTarget], [falseTarget])| Parameter | Type | Default | Description |
|---|---|---|---|
script | string | Condition script. | |
trueTarget | dialoguestep|number | optional | True branch. |
falseTarget | dialoguestep|number | optional | False branch. |
dialoguestepCreated step.
Creates a conditional branch step.
dialoguestep.createDelay(seconds)| Parameter | Type | Default | Description |
|---|---|---|---|
seconds | number | Seconds to wait. |
dialoguestepCreated step.
Creates a pause step.
dialoguestep.createEntity(entity, text)| Parameter | Type | Default | Description |
|---|---|---|---|
entity | entity|number | Speaking NPC. | |
text | string | NPC speech line. |
dialoguestepCreated step.
Creates an NPC speech step.
dialoguestep.createMusic(media)| Parameter | Type | Default | Description |
|---|---|---|---|
media | string | Music path. |
dialoguestepCreated step.
Creates a background music step.
dialoguestep.createNarrative(text)| Parameter | Type | Default | Description |
|---|---|---|---|
text | string | Narrative caption. |
dialoguestepCreated step.
Creates a narrative caption step.
dialoguestep.createPlayer(text)| Parameter | Type | Default | Description |
|---|---|---|---|
text | string | Player line. |
dialoguestepCreated step.
Creates a player speech step.
dialoguestep.createRadio(entity, text)| Parameter | Type | Default | Description |
|---|---|---|---|
entity | entity|number | Radio transmission source. | |
text | string | Message. |
dialoguestepCreated step.
Creates a radio transmission step.
dialoguestep.createRandom()dialoguestepCreated step.
Creates a random choice step.
dialoguestep.createSwitch(script)| Parameter | Type | Default | Description |
|---|---|---|---|
script | string | Switch script. |
dialoguestepCreated step.
Creates a multi-case switch step.
dialoguestep:getOption(index)| Parameter | Type | Default | Description |
|---|---|---|---|
index | number | 1-based option index. |
tableOption details table {text, connection, action, condition, target}.
Returns table of option configuration.
dialoguestep:getOptions()table1-based array of option tables.
Returns an array of option tables.
dialoguestep.new([type], [text], [entity])| Parameter | Type | Default | Description |
|---|---|---|---|
type | number|string|table | optional | Step type or config table. |
text | string | "" | Text line. |
entity | entity|number | optional | Speaking entity. |
dialoguestepCreated step.
Creates a dialogue step with specified attributes.
dialoguestep:removeOption(index)| Parameter | Type | Default | Description |
|---|---|---|---|
index | number | 1-based option index. |
booleanTrue if removed.
Deletes option at index.
dialoguestep:setEntities(entitiesVal)| Parameter | Type | Default | Description |
|---|---|---|---|
entitiesVal | table|entity|number | Associated entities. |
dialoguestepSelf.
Updates associated entities.
dialoguestep:setEntity(entityVal)| Parameter | Type | Default | Description |
|---|---|---|---|
entityVal | entity|number|string|nil | Speaking entity. |
dialoguestepSelf.
Sets speaker entity.
dialoguestep:setExtraPosition(arg1, [y], [z])| Parameter | Type | Default | Description |
|---|---|---|---|
arg1 | vector3|number | Position vector or X. | |
y | number | 0 | Y coordinate. |
z | number | 0 | Z coordinate. |
dialoguestepSelf.
Updates 3D target coordinates.
dialoguestep:setMedia(media)| Parameter | Type | Default | Description |
|---|---|---|---|
media | string | Audio path. |
dialoguestepSelf.
Updates media path.
dialoguestep:setOptionAction(index, action)| Parameter | Type | Default | Description |
|---|---|---|---|
index | number | 1-based option index. | |
action | function|nil | Lua callback function. |
booleanTrue if updated.
Assigns action callback.
dialoguestep:setOptionCondition(index, conditionScript)| Parameter | Type | Default | Description |
|---|---|---|---|
index | number | 1-based option index. | |
conditionScript | string | Script returning boolean to show option. |
booleanTrue if updated.
Controls whether option button appears based on condition.
dialoguestep:setOptionNext(index, target)| Parameter | Type | Default | Description |
|---|---|---|---|
index | number | 1-based option index. | |
target | dialoguestep|number|nil | Destination step. |
booleanTrue if updated.
Wires option to target.
dialoguestep:setOptionText(index, text)| Parameter | Type | Default | Description |
|---|---|---|---|
index | number | 1-based option index. | |
text | string | New option label. |
booleanTrue if updated.
Modifies option button text.
dialoguestep:setPosition(arg1, [y])| Parameter | Type | Default | Description |
|---|---|---|---|
arg1 | vector2|number | Position vector or X. | |
y | number | 0 | Y coordinate. |
dialoguestepSelf.
Updates position in graph.
dialoguestep:setScript(script)| Parameter | Type | Default | Description |
|---|---|---|---|
script | string | Lua script. |
dialoguestepSelf.
Updates script.
dialoguestep:setText(text)| Parameter | Type | Default | Description |
|---|---|---|---|
text | string | Text content. |
dialoguestepSelf.
Updates line text.
dialoguestep:setTitle(title)| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Title string. |
dialoguestepSelf.
Updates step title.
dialoguestep:setType(typeVal)| Parameter | Type | Default | Description |
|---|---|---|---|
typeVal | number|string | Type ID or name. |
dialoguestepSelf.
Updates step type.
dialoguestep:show()Opens dialogue screen and renders this step.