Page 1 of 1

Random Dialogue System

Posted: Tue Jul 12, 2016 11:55 am
by mandi
Hello Tony,
I am considering using randomly choosen dialogues for some of my NPCs. This should be short conversations that would add some nice touch to the game and make it feel less "generic". What is the best way to start with this? My guess: make a large conversation in a dedicated DB, and choose a proper dialogue thread based on a randomly selected Lua variable value. But what about other DBs present in the current scene, then?
Best!

Re: Random Dialogue System

Posted: Tue Jul 12, 2016 12:58 pm
by Tony Li
In the Dialogue Editor, it's not possible to link from one DB to another DB. But you can certainly load as many DBs as you want at runtime. Make sure their IDs don't conflict by running them through the Unique ID Tool.

You can load the DB at runtime using DialogueManager.AddDatabase() or the Extra Databases component. I use the Extra Databases component often. It's more convenient than writing code.

You can also customize the dialogue text further by using the [lua(code)] tag. For example, you can give each actor a custom field named "FavoriteColor" and then use Dialogue Text like this:
  • Dialogue Text: "My favorite color is [lua( Actor[Variable["Conversant"]].FavoriteColor )]."
And you can add even more randomness with the RandomElement() Lua function:
  • Dialogue Text: "Hello, my [lua( RandomElement("friend|buddy|amigo") )]."

Re: Random Dialogue System

Posted: Tue Jul 12, 2016 2:53 pm
by mandi
Tony,
great thanks, again!
Best!