A couple of question regarding event parameters and databases

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Tentakero
Posts: 48
Joined: Wed Sep 23, 2020 12:36 pm

A couple of question regarding event parameters and databases

Post by Tentakero »

Hello and thanks in advance for any help.

I'm looking into possibly incorporating this system into a project I've been working on. However, there's a few roadblocks I'm running into that I'm not quite sure how to solve.

First Question
I currently have a dialogue portrait system in place that takes in multiple method parameters in order to display an animated character in the scene. Kind of how fungus works with their stage and flowchart.

The system in question calls a method that takes in 4 parameters. (GameObject, Enum, String, Bool)
GameObject - Multi layered sprite with all of it's components. Ideally I would assign this prefab from the assets directly into a dialogue block for when the character needs to show up.
Enum for screen position. (Left, middle, right etc.)
String Animation state of the sprite for their expression
Bool to flip the sprite left or right when instantiating.

I've been researching and I'm not sure if I would be able to get this to work using Lua or the Sequence commands that the system uses. The closest thing I saw were the scene independent events, but those take only 1 parameter. Is there something I'm possibly overlooking here aside from rewriting the dialogue portrait system to work with a single parameter somehow?

Second Question
Are there any foreseeable issues with using multiple dialogue databases and swapping between them on the fly? For example, if I have a quest system where each quest encapsulates it's dialogue within it's own database? I would most likely use the dialogue system for it's ability to navigate through text blocks more than anything else honestly since the project I'm working on already has a few things such as Quests/Saving/etc in place.

Thanks again!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: A couple of question regarding event parameters and databases

Post by Tony Li »

Hi,

Portraits

Here are a few ideas for integrating your portrait system. You can choose one that best fits your workflow.

- Make your C# method available to Lua. Then you can use it in dialogue entry nodes' Script fields.
(See: Lua, Registering Functions)

- Or add custom data fields to the dialogue entry node template. Write an OnConversationLine method that checks the field values and sets the portrait accordingly.
(See: Template, Special Script Methods)

- Or define a syntax for embedding portrait information in your dialogue text, similar to the [pic=#] markup tag to switch actors' portraits using the built-in portrait system. Extract the embedded information in OnConversationLine.

- Or write your own UI. As long as it implements a short C# interface called IDialogueUI, the Dialogue System will work happily with it.
(See: Dialogue UIs, IDialogueUI, starter script in Dialogue System / Templates / Scripts)


Multiple Databases

It's fine to use multiple databases. Plenty of projects do this. See Working With Multiple Databases for some notes to consider.
Tentakero
Posts: 48
Joined: Wed Sep 23, 2020 12:36 pm

Re: A couple of question regarding event parameters and databases

Post by Tentakero »

Tony Li wrote: Wed Sep 23, 2020 1:24 pm Hi,

Portraits

Here are a few ideas for integrating your portrait system. You can choose one that best fits your workflow.

- Make your C# method available to Lua. Then you can use it in dialogue entry nodes' Script fields.
(See: Lua, Registering Functions)

- Or add custom data fields to the dialogue entry node template. Write an OnConversationLine method that checks the field values and sets the portrait accordingly.
(See: Template, Special Script Methods)

- Or define a syntax for embedding portrait information in your dialogue text, similar to the [pic=#] markup tag to switch actors' portraits using the built-in portrait system. Extract the embedded information in OnConversationLine.

- Or write your own UI. As long as it implements a short C# interface called IDialogueUI, the Dialogue System will work happily with it.
(See: Dialogue UIs, IDialogueUI, starter script in Dialogue System / Templates / Scripts)


Multiple Databases

It's fine to use multiple databases. Plenty of projects do this. See Working With Multiple Databases for some notes to consider.
I tested some of these suggestions and I think I'll be able to get it to work using Lua and some tweaks to my existing system. Thanks for this info!

Lua commands should work regardless of scene changing and what not as long as the methods are registered onEnable right?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: A couple of question regarding event parameters and databases

Post by Tony Li »

Yes. Typically you'll add the script that registers your Lua functions to the Dialogue Manager so it follows it through scene changes. But alternatively you can register the functions locally in each scene and then unregister them when the scene is unloaded. So, similar to C# events in that regard.
Tentakero
Posts: 48
Joined: Wed Sep 23, 2020 12:36 pm

Re: A couple of question regarding event parameters and databases

Post by Tentakero »

Tony Li wrote: Wed Sep 23, 2020 2:27 pm Yes. Typically you'll add the script that registers your Lua functions to the Dialogue Manager so it follows it through scene changes. But alternatively you can register the functions locally in each scene and then unregister them when the scene is unloaded. So, similar to C# events in that regard.
Gotcha thanks for the rapid responses!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: A couple of question regarding event parameters and databases

Post by Tony Li »

Happy to help!
Post Reply