Random Dialogue System

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
mandi
Posts: 77
Joined: Wed Sep 16, 2015 4:05 am

Random Dialogue System

Post 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!
User avatar
Tony Li
Posts: 20685
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random Dialogue System

Post 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") )]."
mandi
Posts: 77
Joined: Wed Sep 16, 2015 4:05 am

Re: Random Dialogue System

Post by mandi »

Tony,
great thanks, again!
Best!
Post Reply