Page 1 of 1
Textline sounds
Posted: Tue Mar 05, 2019 7:11 am
by Tetralogia
Hi,
How can I play sounds when receiving and sending texts in the Textline Package? I noticed that in the sample scene "3 Gameplay", an audio source is attached to the Player and the NPC when playing the game, but I can't find the script that does that.
Thanks!
Re: Textline sounds
Posted: Tue Mar 05, 2019 9:20 am
by Tony Li
Hi,
It uses the Dialogue System's
cutscene sequencer. Inspect the Dialogue Manager. Set
Display Settings > Camera & Cutscene Settings > Default Sequence for when the NPC sends a text. Set
Default Player Sequence for when the player sends a text.
The initial value of
Default Sequence is: Audio(ReceiveText)
This plays the audio clip named "ReceiveText" located in a Resources folder. (It's in Assets / Dialogue System Extras / Textline / Data / Resources.) You can replace this audio clip or add a new one and update the Default Sequence.
(Side note: Technically you can use asset bundles instead of a Resources folder. But since the audio clip is generally a small file, it would be way too much hassle for no benefit.)
Re: Textline sounds
Posted: Wed Mar 06, 2019 7:43 am
by Tetralogia
I see, thank you. I've got three issues with this:
1) I'm using a pre delay of 2 seconds for the NPC subtitle lines to be played, with the "NPC PreDelay Icon" of the textline package.
If I just write "Audio(ReceiveText)" it plays the sound immediately when the pre delay icon appears ; so I wrote "Audio(ReceiveText) @2". Is there a way to ask to wait for the message to be actually sent to play the sound?
2) I have multiple conversations in one scene, so I'm using OnRecordPersistentData() and OnApplyPersistentData() to switch between them. Whenever I open a conversation, it plays the sequence of the last entry in the record. So I have a sound whenever I open a conversation.
3) It never plays the audio clip on the last entry of the conversation, wether it's from the PC or the NPC.
Re: Textline sounds
Posted: Wed Mar 06, 2019 8:33 am
by Tony Li
Hi,
Textline is getting some updates soon. In the meantime, you can download this interim update:
Textline_2019-03-06.unitypackage
If you've customized some of the files, you really only need to import TextlineDialogueUI.cs. This way you won't lose your customizations.
Tetralogia wrote: ↑Wed Mar 06, 2019 7:43 am1) I'm using a pre delay of 2 seconds for the NPC subtitle lines to be played, with the "NPC PreDelay Icon" of the textline package.
If I just write "Audio(ReceiveText)" it plays the sound immediately when the pre delay icon appears ; so I wrote "Audio(ReceiveText) @2". Is there a way to ask to wait for the message to be actually sent to play the sound?
The update now sends a sequencer message "Received" when an NPC subtitle actually plays, and "Sent" when a PC subtitle plays. After importing the update, change the Dialogue Manager's Default Sequence to:
Code: Select all
Audio(ReceiveText)@Message(Received)
Tetralogia wrote: ↑Wed Mar 06, 2019 7:43 am2) I have multiple conversations in one scene, so I'm using OnRecordPersistentData() and OnApplyPersistentData() to switch between them. Whenever I open a conversation, it plays the sequence of the last entry in the record. So I have a sound whenever I open a conversation.
Set the TextlineDialogueUI's dontRepeatLastSequence before OnApplyPersistentData(). Example:
Code: Select all
var ui = FindObjectOfType<TextlineDialogueUI>();
ui.dontRepeatLastSequence = true;
ui.OnApplyPersistentData();
Tetralogia wrote: ↑Wed Mar 06, 2019 7:43 am3) It never plays the audio clip on the last entry of the conversation, wether it's from the PC or the NPC.
Is this in a regular conversation playthrough, or when loading an old conversation that has ended?
Temporarily set the Dialogue Manager's Debug Level to Info. Play through, and verify that it runs the last entry's Sequence. BTW, in the example conversation, the last entry's Sequence doesn't play audio; it returns to the main menu.
Re: Textline sounds
Posted: Wed Mar 06, 2019 10:12 am
by Tetralogia
The update now sends a sequencer message "Received" when an NPC subtitle actually plays, and "Sent" when a PC subtitle plays. After importing the update, change the Dialogue Manager's Default Sequence to:
Code: Select all
Audio(ReceiveText)@Message(Received)
Perfect, thanks!
Set the TextlineDialogueUI's dontRepeatLastSequence before OnApplyPersistentData(). Example:
Code: Select all
var ui = FindObjectOfType<TextlineDialogueUI>();
ui.dontRepeatLastSequence = true;
ui.OnApplyPersistentData();
If I do that, the last message just straight up disappears when I open/re-open the conversation.
Is this in a regular conversation playthrough, or when loading an old conversation that has ended?
It's in a regular playthrough. I think I know why that's so: the last entries of my conversations have the sequence WaitForMessage(Forever) so it doesn't close the conversation when all the nodes have been played:
Code: Select all
Dialogue System: J says 'Let me know :)'
Dialogue System: Sequencer.Play( WaitForMessage(Forever)@0 )
Dialogue System: Sequencer: WaitForMessage(Forever)
Re: Textline sounds
Posted: Wed Mar 06, 2019 1:14 pm
by Tony Li
Tetralogia wrote: ↑Wed Mar 06, 2019 10:12 amSet the TextlineDialogueUI's dontRepeatLastSequence before OnApplyPersistentData(). Example:
Code: Select all
var ui = FindObjectOfType<TextlineDialogueUI>();
ui.dontRepeatLastSequence = true;
ui.OnApplyPersistentData();
If I do that, the last message just straight up disappears when I open/re-open the conversation.
What shows up in the Console if you temporarily set the Dialogue Manager's Debug Level to Info first?
Tetralogia wrote: ↑Wed Mar 06, 2019 10:12 amI think I know why that's so: the last entries of my conversations have the sequence WaitForMessage(Forever) so it doesn't close the conversation when all the nodes have been played:
Code: Select all
Dialogue System: J says 'Let me know :)'
Dialogue System: Sequencer.Play( WaitForMessage(Forever)@0 )
Dialogue System: Sequencer: WaitForMessage(Forever)
Set the Sequence to:
Code: Select all
{{default}}; WaitForMessage(Forever)
The {{default}} keyword will be replaced by the Dialogue Manager's Default Sequence (i.e., play the audio).
Re: Textline sounds
Posted: Wed Mar 06, 2019 6:30 pm
by Tetralogia
What shows up in the Console if you temporarily set the Dialogue Manager's Debug Level to Info first?
Code: Select all
TextlineDialogueUI.OnApplyPersistentData: Restoring current conversation from DialogueEntryRecords_J: 3;1;46;1;47;1;3
Resuming 'J' at entry 3
Dialogue System: Ending conversation.
Dialogue System: Starting conversation 'J', actor=Player (UnityEngine.Transform), conversant=J (UnityEngine.Transform).
Dialogue System: Add Link (Player): ID=1:5 'Hey!' (True)
Dialogue System: J says 'Hi :)'
Dialogue System: Sequencer.Play( None()@0 )
Set the Sequence to:
Code: Select all
{{default}}; WaitForMessage(Forever)
It's working, thanks!