Ink integration and sequencer commands in choices

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
NotVeryProfessional
Posts: 142
Joined: Mon Nov 23, 2020 6:35 am

Ink integration and sequencer commands in choices

Post by NotVeryProfessional »

If I understand correctly, then sequencer commands on choices should be triggered after the choice has been made, correct?

I want to get the following to work in Ink and Dialogue System:

Code: Select all

NPC: "Hello" {Sequence("AudioWait(NPC_1)")}
* "How are you?" {Sequence("AudioWait(Player_1)")}
* "Get out of my way!" {Sequence("AudioWait(Player_2)")}
+ [leave quietly]
Sadly, it doesn't work. It will always play the "Player_2" audio clip and not show the choices.
Obviously, adding the sequencer command after the choice like this:

Code: Select all

* "How are you?" 
   ~ Sequence("AudioWait(Player_1)")
Also isn't an option (it would typewrite the response and then afterwards play the clip).

So what can I do? Maybe I'm doing this all wrong at all, but I tried writing a custom function to play the audio and that doesn't give me the wait feature, even if I internally call AudioWait.


My Ink integration settings are as follows:
Bildschirmfoto 2021-06-30 um 12.13.18.png
Bildschirmfoto 2021-06-30 um 12.13.18.png (38.44 KiB) Viewed 1318 times
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration and sequencer commands in choices

Post by Tony Li »

I'll investigate this and reply back as soon as I can today.
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration and sequencer commands in choices

Post by Tony Li »

Hi,

Please give this a try. I think it addresses the issue.

DS_InkSupport_2021-06-30.unitypackage
NotVeryProfessional
Posts: 142
Joined: Mon Nov 23, 2020 6:35 am

Re: Ink integration and sequencer commands in choices

Post by NotVeryProfessional »

Works brilliantly!

You should advertise Dialogue System has having 1st class Ink support.


Now, if I can figure out a way to use a custom function instead, I can make it user-configurable to have voice-overs or not. I'll see what I can figure out there. :-)
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration and sequencer commands in choices

Post by Tony Li »

The Cutscene Sequences Tutorials list has a video on writing your own sequencer commands. You could make your own copy of AudioWait.cs and customize it to do what you want.

BTW, the "Mute" variable is an often-overlooked feature. If a Dialogue System variable named "Mute" exists and is true, audio commands such as AudioWait() will wait the correct amount of time but they won't play audio.
jrbourne
Posts: 32
Joined: Wed May 16, 2018 3:08 pm

Re: Ink integration and sequencer commands in choices

Post by jrbourne »

It is great to see that there are folks who are interested in how to run Sequence commands from within INK. I am very interested in what the solutions were to your problems getting ink-embedded sequencer statements to work.

I have tried adding commands such as:
- line of INK text
* choice {SequencerCommandCamera (view, name, time)}
* choice
(etc.)

with the idea in the above example to somehow activate the SequenceCommand Camera in behavior designer.
Tony, if you are reading this post, I could easily define a variable in my INK conversation and it would appear in the dialogue editor and I could use the TASK "GET DIALOGUE INT VARIABLE" to get in integer from the INK conversation, then store the value as a global variable in Behavior Designer and ultimately use that value to direct the program flow. Works nicely for other EXTERNAL functions too. But I'm stumped on how to do something similar with the Sequence commands that Dialogue System has (for example, pointing the camera).

TONY, I see in the comments in this thread that you posted that you say should make this sort of thing work - however, it no longer seems to be available (support package 2021-06-30). "NotVeryProfessional" writes then about his trying but I don't see any followup that would help me get the ink-embedded sequencer commands to work. I guess the question really comes down to: "How to get the available squencercommands (like sequencercommandcamera....) to be executed in behavior designer"

Thanks much to anyone who can help...

Best,

John
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration and sequencer commands in choices

Post by Tony Li »

Hi John,

Make sure to use the "Ink Support" unitypackage in the Third Party Support folder of the latest version of the Dialogue System.

Then you can add sequences to your Ink content like this:

Code: Select all

* Hello world! {Sequence("AudioWait(hello_world)")}
When Ink gets to the line "Hello world!" it will play the sequence: AudioWait(hello_world)
jrbourne
Posts: 32
Joined: Wed May 16, 2018 3:08 pm

Re: Ink integration and sequencer commands in choices

Post by jrbourne »

Hi Tony:

I have DS 2.2.33; is there something later? I did add the Third party support. There are three scripts in the folder for behavior designer support. Do I have to attach the BehaviorTreeLuaBridge to one of objects in the scene? I tried running the code you provided, it seems to run with no errors and wait, but I have no audio (I'm using a Mac). I put the audio clip in a Resources folder in the INK example. But I'm not getting audio when I play the script. I imagine it is playing since the wait delay is the appropriate length. How do I direct the audio to my laptop's audio output (btw, the sound is fine clicking on the audio file in the Resources folder).

Sorry to have to ask such dumb questions.... Also, is there any documentation on the various ways of accessing sequences (or other calls) from ink projects? I've been reading the scripts but still don't have a clear picture of how all this works.

Thanks,
John
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration and sequencer commands in choices

Post by Tony Li »

Hi John,

I suggest familiarizing yourself with sequences just in the Dialogue System, separately from Ink, first:
Cutscene Sequence Tutorials

In Ink, you can simply add the sequence in a Sequence() external function call, as in the example above. (Copied below for reference:)

Code: Select all

* Hello world! {Sequence("AudioWait(hello_world)")}
It's the same sequence syntax as regular Dialogue System without Ink.

Note that the Audio() and AudioWait() sequencer commands play on the audio source on the line's speaker unless you specify a different GameObject. If the speaker doesn't have an audio source, the command will create a default one.

Here's an example of specifying to play the audio clip on a GameObject named "Radio":

Code: Select all

* A nice tune plays on the radio. {Sequence("AudioWait(mellow_song, Radio)")}
You mentioned Behavior Designer. Are you using that, too? I recommend getting Ink and the Dialogue System working together first, and then work Behavior Designer into the mix.
Post Reply