Page 1 of 1

Need advice on displaying additional text and an Image

Posted: Wed Jul 14, 2021 6:33 am
by Bempa
Hello!
First and foremost i would like to thank you for an excellent tool!

The setting in my game that i am using Dialogue system is an sort of event-displayer.
It's pretty straight forward. The conversations consists of one dialogue text that describes an event and then the player gets to choose from up to 3 actions that are presented on response buttons.

Right now the only issues that i am having is that first i need to display a title text that is unique for every conversation/event. Example: "Your crew is starving".
To smoothen the workflow it would be nice to be able to write the text somewhere in the dialogue-editors Conversations-tab.
I thought of using either the Description-field or Menu text-field, in the Conversations-tab, for the title-text and then display it via one Standard UI Subtitle panel.
I have looked through the Standard UI Subtitle panel-script and found the reference for the subtitle text and am thinking of adding a "Title"-text field in there but my next problem is that i cant find the part where DS picks up the actual Conversation-subtitle text.

So i want to add a Title-textfield in the Standard UI subtitle panel and then reference it to display the content in the Description- or Menu text fields in the editors Conversations-tab, but i need some help to get references to the Conversations-tab fields.

Would this be a viable way to solve the issue or is there some more straight forward way of doing it?

Secondly i need to display an image that is unique for every event/conversation.
It would be nice to reference the image from the Conversations-tab.
I do see that under 'All fields' in the Dialogue Entry-inspector window, in the conversations-tab, there is a field called Pictures of type Files. Would this be a viable path to use to display the event-image?


So eventually my 2 questions boils down to 1 and that would perhaps be how i do get references from the data in the Dialogue Entry. I would be glad if you could point me towards a script where theese things happens and/or a tutorial that covers theese topics.

Best regards

Re: Need advice on displaying additional text and an Image

Posted: Wed Jul 14, 2021 8:50 am
by Tony Li
Hi,

Thanks for using the Dialogue System!
Bempa wrote: Wed Jul 14, 2021 6:33 amRight now the only issues that i am having is that first i need to display a title text that is unique for every conversation/event. Example: "Your crew is starving".
What if you add a new subtitle panel to your dialogue UI that's only for the title text? For example, use these steps:
  • Define a new actor in your dialogue database named "Title".
  • In your conversation, link the <START> node to a node assigned to the Title actor. Set the node's Dialogue Text to the title.
  • Then link that node to the event description text.
  • Add a new subtitle panel to your dialogue UI. Assign it to the Standard Dialogue UI component's Conversation UI Elements > Subtitle Panels list, and make a note of its element number. Set the subtitle panel's Visibility to Always From Start.
  • Add an empty GameObject as a child of the Dialogue Manager. Add a Dialogue Actor component. Select the Title actor. Set Dialogue UI Settings > Subtitle Panel Number to the new subtitle panel's number.
That's a way to do it without scripting, but there are alternatives. For example, you could add a script to the Dialogue Manager that has an OnConversationStart() method. In the method, get the conversation's Description and set a custom title text element that you've added to your dialogue UI. If you want to do that and you have questions, let me know and I'll post some code.

Bempa wrote: Wed Jul 14, 2021 6:33 amSecondly i need to display an image that is unique for every event/conversation.
That's a little harder. To keep dialogue databases importable/exportable to text formats without losing data, they don't directly reference other assets such as images. (Portrait images are an exception that the Dialogue System handles specially.) Here's one idea:
  • You could use the Addressables system and mark your images as addressable, or put your images in a Resources folder. Addressable images will have a Key value. Images in Resources folders will have a filename.
  • Store the Key/filename in a custom field in the conversation, or write a custom sequencer command. (For example, the built-in AudioWait() sequencer command does the same thing for audio files.) You can use an OnConversationStart() method to check the conversation's field, or let the custom sequencer command handle the name as a parameter.
  • Use DialogueManager.LoadAsset<Sprite>() to load the image and show it.

Re: Need advice on displaying additional text and an Image

Posted: Wed Jul 14, 2021 10:15 am
by Bempa
Thank you so very much for a swift and thourough answer!
Your suggestions feels like they are very much doable and i will get on it first thing tomorrow!

Thank you again!

Re: Need advice on displaying additional text and an Image

Posted: Wed Jul 14, 2021 10:30 am
by Tony Li
Glad to help! I didn't provide as much detail on the second answer, so if you have questions about either one just let me know.

Re: Need advice on displaying additional text and an Image

Posted: Thu Jul 15, 2021 5:01 am
by Bempa
It's done! :)

I just wanted to get back to you and thank you again.

I resolved the first issue following your first advice and the solution now feels kinda obvious :)

The second issue i finally solved by writing my own methods to load the images from resources and displaying the correct image by getting a reference from the 'current dialogue'-title.
I found the response that you left in https://www.pixelcrushers.com/phpbb/vie ... f=3&t=4191 helpful.

Best regards!

Re: Need advice on displaying additional text and an Image

Posted: Thu Jul 15, 2021 8:10 am
by Tony Li
Glad to help! :-)