DialogTableau
This dialogue tool (former Pro-Dialogue) eases and improves advanced customization for dialog creation, supporting Richtext, player replies, pausing, resuming, etc.
How to use:
The module does its best to be user-friendly, balancing between customization and code cleanliness. With this in mind, background settings and properties are isolated in a single table, so for a bunch of dialogs, this can be compressed into a separate module.
local DialogTableau = require(game.ReplicatedStorage.DialogTableau)
local aPrompt: ProximityPrompt
local configuration = {
Body = { -- The dialogue itself
"Hello!",
"Nice to meet you."
};
actor = "NPC"; -- Name of the npc talking
}
local dialog1 = DialogTableau.new(configuration)
aPrompt.Triggered:Connect(function(player)
dialog1:Begin(player) -- Start the dialogue
dialog1.Completed:Wait() -- Wait until finished
end)
Configuration:
Property | Usage | Class |
---|---|---|
Body | Dialogue table | table |
actor | Name of the NPC | string |
chatChoice | Table of possible replies, empty if nil | table |
typeSpeed | Delay between letters | number |
BetweenChat | Delay between dialog blocks | number |
canSkip | Can the player skip the dialogue? | boolean |
AllowMovement | Can the player move while in-dialogue? | boolean |
TextFont | Font of the dialog | Enum.Font |
typesound | Sound of the speaking | number |
headshot | If not nil, there will be an image next to dialog | number |
customUI | Custom dialogue gui, with the default’s shape | ScreenGui |
Functions:
[ • ] DialogTableau.new(configuration: DialogueConfig)
Constructor that allows access to the module functions, in addition to modifying its properties, DialogueConfig is a type on its own.
DialogTableau.new(player, {
Body = {
"Message1",
"Message2"
},
typeSpeed = 0.08,
BetweenChat = 0.9,
canSkip = false,
AllowMovement = false,
})
This way the dialogue will end at the last message.
If for example the last chat is a question and you want the player to answer it. You can add the variable ‘chatChoice’ in the table, and add the answers to it
chatChoice = {"Response1", "Response2"} -- maximum: 6
returns system
.
[ • ] system:Begin(player: Player)
Dialog with no replies
local DialogTableau = require(game.ReplicatedStorage.DialogTableau)
local config = {
Body = {
"<b>This text is going to be bold</b>",
"<wavy>We will be seeing richtext customization in a minute.</wavy>"
};
actor = "NPC";
}
local dialog = DialogTableau.new(config)
script.Parent.Triggered.Connect(player)
dialog:Begin(player)
dialog.Completed:Wait()
end)
Dialog with replies
local DialogTableau = require(game.ReplicatedStorage.DialogTableau)
local config = {
Body = {
"Hi, nice to meet ya!",
"How are you?"
};
chatChoice = {
"Good",
"Not so good",
"I dont wanna talk about it"
},
actor = "NPC";
}
local config2 = {
Body = {
"Just the answer I was expecting!"
};
actor = "NPC";
}
local dialog = DialogTableau.new(config)
local dialog2 = DialogTableau.new(config2)
script.Parent.Triggered:Connect(function(player)
dialog:Begin(player)
dialog.Completed:Connect(function(response)
if response == "Good" then
dialog2:Begin(player)
dialog2.Completed:Wait()
end
end)
end)
And not only that, there are also other methods such as:
-
dialog:Pause(player: Player, dialogVisible: boolean)
– Pauses the dialog. If resumed, it won’t start again.
– dialogVisible: The Gui is visible while paused.
-
dialog:Resume(player: Player)
– Resumes the dialog after being paused. -
dialog:Stop(player: Player)
– Useful if an important event has to stop all dialogues. -
dialog:Destroy(player: Player)
– Disconnects events and disables the dialogue from being called again-
– Useful for testing purposes.
RichText:
Property | Purpose | Format |
---|---|---|
bold | bolds the text | <b >text</b > |
italic | makes text cursive | <i >text</i > |
underline | underlines the text | <u >text</u > |
strikethrough | cross out the |
<s >text</s > |
color | Colors a specific part of the text | <color(R, G, B) >text</color> |
rainbow | Text color animates between rainbow colors | <rainbow >text</rainbow > |
background | Text will have a background | <bg(R, G, B) >text</bg > |
wavy | The text will slowly animate vertically | <wavy >text</wavy > |
shake | The text will shake violently | <shake >text</shake > |
Testing Video:
.Code
local DialogTableau = require(game.ReplicatedStorage.DialogTableau)
local LeverPressed: BoolValue = script.Parent.LeverPressed
local config = {
actor = "???";
AllowMovement = true;
Body = {
"Look who dared to come...",
"Nice to see you again in this <shake><b><color(145, 255, 255)>Palace</shake></color></b>",
"Your <wavy><rainbow>hope</wavy></rainbow> shall not be over <b>yet</b>",
"This could be the run",
"...",
"...",
"Good luck, wanderer."
}
}
local dialog1 = DialogTableau.new(config)
local pauser
script.Parent.ClickDetector.MouseClick:Connect(function(player)
pauser = LeverPressed.Changed:Connect(function()
if LeverPressed.Value == true then
dialog1:Pause(player, false)
else
dialog1:Resume(player)
end
end)
dialog1:Begin(player)
dialog1.Completed:Wait()
pauser:Disconnect()
end)
Thanks for reading, remember that I will listen to all the suggestions given by the community
The module is fully accessible here: