Adding sound to dialogues

Announcements, support questions, and discussion for the Dialogue System.
FunD
Posts: 27
Joined: Tue Feb 12, 2019 6:14 am

Re: Adding sound to dialogues

Post by FunD »

Ah, I see, thanks so much! Works perfectly now.

And I just found a solution for the 'continue' button too. I just disactivated the child of the gameobject and that works.

Thanks again for the great support! have a nice day
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding sound to dialogues

Post by Tony Li »

Glad to help! :-)
FunD
Posts: 27
Joined: Tue Feb 12, 2019 6:14 am

Re: Adding sound to dialogues

Post by FunD »

Oh, I do have one additional question that just came up (sorry).

Ever since I previously changed the 'Dialogue Manager' Settings like recommended earlier:
2. Tick Subtitle Settings > Show PC Subtitles During Line
3. Untick Input Settings > Always Force Response Menu

..which fixed the issue of player sounds playing too late, while NPC comments were running already. But since I did that change, all actions in the Sequence get executed on first click, whereas before they would execute once that bit of dialogue was completed.

So for ex. if I had a 'SetActive' action on the last dialogue box of a conversation, it would execute after the final click, when the dialogue boxes closed and disappared from the screen. Now the actions execute on the click before the final click, so while the convo is still technically opened on the screen. Do you see what I mean?

There is for ex. text that is supposed to appear on the screen once the dialogues are completed, that is a UI object I activate with SetActive, but now it displays while the final dialogue box of the convo is running.

Is there a way around this?
Thanks again
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding sound to dialogues

Post by Tony Li »

You can add timing to the SetActive() command. Here is the more complicated but most accurate way:

Let's say you want to play this audio file:

AudioWait(Voice Overs/Bacterias 1/1)

and you want to set a GameObject named "Foo" active:

SetActive(Foo)

Use this to set "Foo" active after the audio has finished:

AudioWait(Voice Overs/Bacterias 1/1)->Message(Done);
SetActive(Foo)@Message(Done)


This will play the audio file. When the audio file is done, it will send a message "Done". (This can be any string of your choosing.) The next line will wait until it receives the message "Done". Then it will run the SetActive() command.
FunD
Posts: 27
Joined: Tue Feb 12, 2019 6:14 am

Re: Adding sound to dialogues

Post by FunD »

Thanks for your answer.
Unfortunately this does not work. It does not activate the UI object with this code
https://ibb.co/55MNQ8P

It would be even better though, if the gameobject would be set active after clicking away from the convo, but there is no way of doing that in the Sequence without changing the Dialogue Manager Settings I currently have?

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

Re: Adding sound to dialogues

Post by Tony Li »

FunD wrote: Wed May 29, 2019 1:53 pmUnfortunately this does not work. It does not activate the UI object with this code
https://ibb.co/55MNQ8P
(See my other answer below. If you prefer that solution, you can skip this.)

Are there any warnings in the Console?

Is the GameObject "UI Text" spelled exactly like that, including capitalization? And is its root GameObject active?
FunD wrote: Wed May 29, 2019 1:53 pmIt would be even better though, if the gameobject would be set active after clicking away from the convo, but there is no way of doing that in the Sequence without changing the Dialogue Manager Settings I currently have?
You can add a Dialogue System Trigger to conversation's actor or conversant. If the GameObject already has a Dialogue System Trigger, this will simply be second Dialogue System Trigger on the same GameObject. Set it to OnConversationEnd. Select Add Action > OnExecute() event. Configure the OnExecute() event to activate the UI Text GameObject.
FunD
Posts: 27
Joined: Tue Feb 12, 2019 6:14 am

Re: Adding sound to dialogues

Post by FunD »

Hi,

There are no errors in the console appearing. Just the object doesn't get activated like it should. And yes, it's spelled correctly, as soon as I remove @Message(Done) it works again

I think you've sort of lost me on the second part. My conversations are triggered via Playmaker. It gets launched with a trigger, yes.

Set it to OnConversationEnd -> are we still talking about Sequence? or where do I put this?

Add Action > OnExecute() event. Configure the OnExecute() event to activate the UI Text GameObject. -> where do I select 'add action'? I've only used the Sequence so far
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding sound to dialogues

Post by Tony Li »

Hi,
FunD wrote: Wed May 29, 2019 5:59 pmThere are no errors in the console appearing. Just the object doesn't get activated like it should. And yes, it's spelled correctly, as soon as I remove @Message(Done) it works again
Maybe there's an issue in the first line of the sequence. Here is the sequence in a better font:

Code: Select all

AudioWait(Voice Overs/Bacterias 1/1)->Message(Done);
SetActive(Foo)@Message(Done)
FunD wrote: Wed May 29, 2019 5:59 pmI think you've sort of lost me on the second part. My conversations are triggered via Playmaker. It gets launched with a trigger, yes.

Set it to OnConversationEnd -> are we still talking about Sequence? or where do I put this?

Add Action > OnExecute() event. Configure the OnExecute() event to activate the UI Text GameObject. -> where do I select 'add action'? I've only used the Sequence so far
Here's an example:

Image

In this example, the conversation "Private Hart" is triggered by a Dialogue System Trigger that's set to On Use, not by a PlayMaker action. But that's not important.

The important piece is the second Dialogue System Trigger, which is set to On Conversation End. When the conversation ends, it will activate the UI Text GameObject.

However, this will only work if the Dialogue System Trigger's GameObject is assigned as the Conversation Actor or Conversation Conversant. In your PlayMaker action, make sure the GameObject is assigned to one or the other of these fields. (In the example above, you may notice that the On Use Dialogue System Trigger's Conversation Conversant is unassigned. When this field is unassigned, the Dialogue System Trigger uses its own GameObject as the Conversation Conversant.)
FunD
Posts: 27
Joined: Tue Feb 12, 2019 6:14 am

Re: Adding sound to dialogues

Post by FunD »

Yes, the second approach works!! yay!

Thanks so much, for the clear instructions :)
This approach was new to me, I haven't used 'Dialogue System Trigger (Script)' before, since I was using Playmaker, but this is really useful!

Have a nice day :)
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding sound to dialogues

Post by Tony Li »

Glad to help!

I should have also mentioned that you could accomplish the same thing with a PlayMaker Events component instead of a Dialogue System Trigger set to On Conversation End. But personally in this case I think it's simpler to use a Dialogue System Trigger.
Post Reply