Dialogue

The Dialogue module provides a client-side NPC dialogue system with branching conversations.

Client Functions

GetResourceName

Returns the dialogue resource name.

local name = Bridge.Dialogue.GetResourceName()
-- Returns: string (always "default")

Description: Returns the name of the Dialogue module resource. Used for internal identification. Always returns "default" for the built-in Dialogue module.

Open

Opens a dialogue with an NPC or character.

Bridge.Dialogue.Open(name, dialogue, characterOptions, dialogueOptions, onSelected)
ParameterTypeDescription
namestringUnique dialogue name
dialoguetableArray of dialogue entries (see below)
characterOptionstableCharacter display options (optional)
dialogueOptionstableDialogue UI options (optional)
onSelectedfunctionCallback when player selects a response

Dialogue Entry Format

{
    {
        text = 'Hello, how can I help you?',
        responses = {
            { text = 'Tell me about the job', next = 2 },
            { text = 'Goodbye', action = 'close' }
        }
    },
    {
        text = 'The job pays well and has good hours.',
        responses = {
            { text = 'I am interested', action = 'accept' },
            { text = 'No thanks', action = 'close' }
        }
    }
}

Close

Closes an active dialogue.

Bridge.Dialogue.Close(name)
ParameterTypeDescription
namestringDialogue name to close