Skip to content

ShowPlayerDialogue

Shows a dialogue page on a player’s screen - who speaks, their line and the choices.

Opens a page, or replaces the one open on the player. options is a list of 1 to 8 rows, top to bottom; a row is a string, or a table {text = "...", enabled = false} for a choice shown greyed out that cannot be picked. With actor the talk is with that actor: the speaker’s name defaults to its name (pass ""), and the page closes when the player walks 5 m from it or it dies or goes. The player’s answer comes to OnDialogueResponse with dialogid. Texts are cut at 1000 characters for the line, 200 for a choice.

ShowPlayerDialogue(pid, dialogid, speaker, text, options [, actor])
Parameter Type
pid number the player
dialogid number the page’s number, of the mode’s choosing - it comes back with the answer
speaker string the name over the line; "" = the actor’s name (or none)
text string the speaker’s line; "" = the choices alone
options table 1-8 rows - strings, or {text = "...", enabled = false}
actor number the actor spoken to; nil = none (optional)

true, or false, reason ("a page needs at least one choice", "the player is dead" …)

-- a watchman with a Talk prompt
local watchman = CreateActor("guard_a", 752, 3346, 142.3, 0, "Watchman")
SetActorPrompt(watchman, "Talk")
function OnPlayerInteractActor(pid, id)
if id == watchman then
SetPlayerData(pid, "talking_to", id)
ShowPlayerDialogue(pid, 1, "", "Halt! What business have you in Suchdol?", {
"I live here.",
{text = "I carry a letter for the lord.", enabled = GetPlayerData(pid, "courier") == true},
"Nothing. Farewell.",
}, id)
end
end

OnDialogueResponse · HidePlayerDialogue · SetActorPrompt · the Dialogue group of the index