-
What do you want to achieve? Keep it simple and clear!
When I run my Dialogue System, it runs perfectly fine. However, when I pick the same Dialogue after talking once to the NPC, it abruptly ends. -
What is the issue? Include screenshots / videos if possible!
The first time talking to the NPC
https://gyazo.com/4a1785632570ee5d754a9011d66f2f83
The second time talking to the NPC
https://gyazo.com/22ad3e71f8f0a1b7b9dddf4879bca76d
The Dialogue ends even though it’s meant to go to the next part of the Dialogue.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I don’t think there are any questions that are closely related to mine, but I have spent 20 minutes figuring out what was wrong. As you can see, I ran out of ideas.
-- Module Script
local module = {}
module.Nyarlathotep = {
[1] = {
Type = "Question",
Text = "What's up",
Responses = {
[1] = {"Nothin' much", EndConvo = true},
[2] = {"Good, how about you?", 2}
}
},
[2] = {
Type = "Question",
Text = "Nothin' much",
Responses = {
[1] = {"Is that so?", EndConvo = true},
[2] = {"Bye!", EndConvo = true}
}
}
}
return module
-- Local Script
local function TalkTo(NPC)
local num = 1
while inConvo do
print("Dialogue Number: "..num)
local v = DialogueData[NPC][num]
TextFX.typewrite(Dialogue, v.Text)
if v.Type == 'Dialogue' then
num = num + 1
if Response1.Text ~= " " then
Response1.Text = " "
Response2.Text = " "
end
elseif v.Type == 'Farewell' then
Hide()
inConvo = false
else
ShowChoices()
Response1.Text = v.Responses[1][1]
Response2.Text = v.Responses[2][1]
Response1.MouseButton1Click:Connect(function()
AnimateClickResponse1()
if v.Responses[1].EndConvo == true then
Hide()
inConvo = false
else
print('continue the dialogue')
Continue = true
num = v.Responses[1][2]
end
end)
Response2.MouseButton1Click:Connect(function()
AnimateClickResponse2()
if v.Responses[2].EndConvo == true then
Hide()
inConvo = false
else
print('continue the dialogue')
Continue = true
num = v.Responses[2][2]
end
end)
end
repeat wait() until Continue
Continue = false
end
end
The reason why i’ve added print('continue the dialogue')
is because to check if the 2nd argument for v.Responses[x][2]
was selected as a number. Not as v.Responses[x].EndConvo
. It’s seen in the if statement above.
As you can see in the output, `print(‘continue the dialogue’) is being printed (many times even! which makes no sense if we’re only calling the event once!) yet the dialogue ends. Which is what I need your help with. I have no clue how to fix this at all.
https://gyazo.com/b1d89effcf52ca6a4d045c32cc4c0d01
Note: It also prints continue the dialogue
even if the dialogue is meant to end. Which makes no sense to me at all!
If you have any questions to ask to further help you find a solution for my problem, ask right away. If you do not understand this thread, please also ask right away.