SimpleDialogue - A Dialogue Module by CrabDevs
SimpleDialogue, is a module made to simplifying making NPC dialogues for your game. With an easy to implement system, using a tree structure to configure the dialogues.
You can easily create branching conversations, both simple and complex dialogues.
Read the documentation here:
SimpleDialogue wiki (Click me)
Get the module here:
Roblox library (Click me)
Examples
Simple Quest Dialogue
local npc = path.to.npc
local dialogue = SimpleDialogue.new(npc)
local dialogueTree = SimpleDialogue.CreateTree({
SimpleDialogue.CreateNode("Hello, traveller!", {
SimpleDialogue.CreateOption("Hey! Can you tell me about the quest?", function()
dialogue:ShowNPCText("Yes of course!", function()
task.wait(2)
dialogue:DisplayNode(2)
end)
end, 0),
SimpleDialogue.CreateOption("Bye!", function()
dialogue:ShowNPCText("Goodbye!")
end)
}),
SimpleDialogue.CreateNode("Please find me 2 cows..", {
SimpleDialogue.CreateOption("I'll do it!", function()
print("Quest started..")
end),
SimpleDialogue.CreateOption("No, thanks!", function()
dialogue:ShowNPCText("Okay, goodbye!")
end)
}),
})
dialogue:SetDialogueTree(dialogueTree)
Conditional Dialogue
local npc = path.to.npc
local dialogue = SimpleDialogue.new(npc)
local questStarted = false
local hasQuestNotStarted = function()
return not questStarted
end
local hasQuestStarted = function()
return questStarted
end
local itemFound = false
local dialogueTree = SimpleDialogue.CreateTree({
SimpleDialogue.CreateNode("Hello, traveller!", {
SimpleDialogue.CreateCondition(
hasQuestNotStarted,
SimpleDialogue.CreateOption("Do you have a quest for me?", function()
questStarted = true
PlayerGui.ScreenGui.QuestLabel.Text = "Quest Started: true"
PlayerGui.ScreenGui.ItemLabel.Visible = true
dialogue:ShowNPCText("Yes I do!", function()
task.wait(2)
dialogue:ShowNPCText("Find the brick item!", function()
task.wait(2)
dialogue:EndDialogue()
end)
end)
end, 0)
),
SimpleDialogue.CreateCondition(
hasQuestStarted,
SimpleDialogue.CreateOption("Finish Quest!", function()
if itemFound then
itemFound = false
questStarted = false
PlayerGui.ScreenGui.QuestLabel.Text = "Quest Started: false"
PlayerGui.ScreenGui.ItemLabel.Visible = false
PlayerGui.ScreenGui.ItemLabel.Text = "Item Found: false"
dialogue:ShowNPCText("Thanks! Goodbye!")
else
dialogue:ShowNPCText("You didn't give me an item!")
end
end)
),
SimpleDialogue.CreateOption("Bye!", function()
dialogue:ShowNPCText("Goodbye!")
end)
})
})
dialogue:SetDialogueTree(dialogueTree)
workspace.BrickItem.ProximityPrompt.Triggered:Connect(function()
if questStarted then
itemFound = true
PlayerGui.ScreenGui.ItemLabel.Text = "Item Found: true"
end
end)
To get started with using SimpleDialogue visit: Getting Started - Installation
Feel free to come with feedback, and/or support me with a coffee → Buy me a coffee (Click me)