Dialogue sounds

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
robloxillian
Posts: 27
Joined: Mon Sep 13, 2021 6:55 pm

Dialogue sounds

Post by robloxillian »

I am looking for a way to add dialogue sounds to my game that are played every time a line of dialogue is played. My question is very similar to this one: https://www.pixelcrushers.com/phpbb/vie ... ed11473e78 but differs in that I do not have audio files for every line of dialogue in my game.

For more context: in a previous implementation, I did this by recording short voice clips, each containing a letter of the English alphabet. When text scrolled on the screen, I would play the corresponding clip for each letter as it appeared. This is based on how "animalese" chatter is implemented in Animal Crossing. I was very happy with the results and would like to do something similar with the PixelCrushers dialogue system.

Is there a setting I can use on the dialogue manager so that some code gets called whenever dialogue is scrolling? The audio intentionally sounds like gibberish, so it doesn't have to be synced with the text as long as it starts when the text starts scrolling and ends when it finishes.
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue sounds

Post by Tony Li »

Hi,

Yes. Inspect the dialogue UI's Subtitle Text GameObject(s). They should have typewriter effect components. Assign audio clips to the Audio Clip and Alternate Audio Clips fields.

If you want to play a different set of audio clips for different characters, see this post.

If you want to handle specific characters specially (e.g., '!' character), see this post.
robloxillian
Posts: 27
Joined: Mon Sep 13, 2021 6:55 pm

Re: Dialogue sounds

Post by robloxillian »

Thank you! I was able to get the effect working using the example code to select different "voices" for different NPCs as well as specific clips for different characters. Unfortunately, somewhere in the process, I seem to have messed up the process of selecting the actor for a conversation. I have a conversation with an NPC for which both the actor and the conversant are set to the NPC. However, it is selecting the player. I can see this happening with breakpoints in StandardUISubtitleControls.OpenSubtitelPanelsOnStartConversation():

Code: Select all

...
// Check main Actor & Conversant:
            var mainActorID = conversation.ActorID; // this is the NPC actor ID, which I want
            var mainActor = DialogueManager.masterDatabase.GetActor(DialogueActor.GetActorName(DialogueManager.currentActor)); // this is the player actor ID, which I don't want
            if (mainActor != null) mainActorID = mainActor.id; // the NPC actor ID gets overwritten with the player actor ID
            CheckActorIDOnStartConversation(mainActorID, checkedActorIDs, checkedPanels, ui);
            CheckActorIDOnStartConversation(conversation.ConversantID, checkedActorIDs, checkedPanels, ui);
            ...
            
I don't understand the context in which this code is used, so I may be misunderstanding how it relates to what I'm trying to do when I say I want the NPC actor ID and not the player actor ID. The call stack is:

Code: Select all

StandardUISubtitleControls.OpenSubtitlePanelsOnStartConversation()
StandardUIDialogueControls.OpenSubtitlePanelsOnStart()
StandardDialogueUI.Open()
I could also be mistakenly assuming this code is related at all to which actor the scene is using, since it looks like it's used to load multiple actors. In any case, I see the actor name displayed as "player" when talking to the NPC, which wasn't happening before. Given that I have subclassed the classes shown in the examples you linked, what determines which actor is speaking in a conversation? Let me know if I need to provide more context, as well.
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue sounds

Post by Tony Li »

Hi,

Here are some things to check:

1. Read Character GameObject Assignments.

2. Inspect your conversation in the Dialogue Editor. Select Menu > Conversation Properties. Since the actor and conversant are the NPC, make sure the Actor and Conversant dropdowns are set to the NPC.

3. If you're using a Dialogue System Trigger to start the conversation, assign the NPC to the Conversation Actor and Conversation Conversant fields. Or leave them blank, but add a Dialogue Actor component to your NPC's GameObject and select the NPC actor name from the dropdown.
Post Reply