How do I structure a dialog system?

I’m kinda struggling to find a good way to have dialog be stored if that makes sense.

Let me just start with something basic:

Here’s what the UI would basically look like for the initial conversation:



Character Name

+ Insert Text Here +

Good Bad



That’s easy. But, obviously each reply has a different “path” so if you answered “Bad” you’d get completely different dialog.

It sounded kinda easy to put together but now I’m unsure.

I don’t really know what’s the most efficient way, and so I’m kinda asking for insight.

--[[ What if I have 2
different scenarios
for index 2?
]]
local Dialog = {
   [1] = {
      ["Text"] = "Insert Text Here",
   },
   [2] = {
      -- "Good" was chosen
      ["Text"] = "Some Random Text"
      --[[ how do I include
      the "Bad" dialog now?
      ]]
   }
}

Thanks in advance!

(i have done some searching prior to making this post but nothing really helped)

1 Like

Couldnt you just use a table that stores the options and also the text?

1 Like

Well yeah but I just don’t know how to structure it yk

It’s a bit confusing if you try to think about it

1 Like

You wouldnt definitely have to do some sort of recursion and also it would help if you split up the dialogue into like the main dialogue module which will control the flow and then separate nodes that have options @Doomcolp

1 Like