Using DS with Timeline & Cinemachine

Announcements, support questions, and discussion for the Dialogue System.
albuarki
Posts: 18
Joined: Mon Dec 28, 2020 12:23 pm

Using DS with Timeline & Cinemachine

Post by albuarki »

Hi,

I’m using DS to make a text game that has visuals reacting to what’s happening in the dialogue. Basically, the game is answering calls (conversations) and using pretendered graphics or camera movements and 3D assets based on our interactions.

An example from the game: the caller is in trouble in the mountains and we have to help him. The system tries to locate him but it fails. After that it tries its best guess as the camera zooms in and gives a “no signal detected” error. We keep talking to the caller and he mentions a name, a profile pops up after the name is mentioned. The AI guesses it’s near that person’s location so the camera shifts and zooms in there. And so on.

For all these cutscenes, I think using timelines is the best option and from the DS we can play each the timelines that we want. It would also control the HUD elements and animations.
I already have the game talking to the system and sharing variables but it’s difficult to sequence multiple events like that.

This is one example of one call. Those elements mentioned in the example above are not shared with other calls.

I’m sorry for making this post longer than it should but my question is, how to achieve these cutscenes in DS so that the dialogue can play timelines and still continue working as the timeline is playing?

My cinemachine camera keeps resetting when I try it and it doesn’t hold its position when the timeline ends but the dialogue doesn’t.

Also: is it possible to change the subtitle and responses fields at runtime?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using DS with Timeline & Cinemachine

Post by Tony Li »

Hi,
albuarki wrote: Tue Mar 30, 2021 12:59 pmI’m sorry for making this post longer than it should but my question is, how to achieve these cutscenes in DS so that the dialogue can play timelines and still continue working as the timeline is playing?
You may find the Cutscene Sequence Tutorials to be helpful. You can use the Timeline() sequencer command to control timelines in dialogue entries. To make a dialogue entry kick off a timeline that runs without being tied to the progress of the conversation, use the nowait parameter.
albuarki wrote: Tue Mar 30, 2021 12:59 pmMy cinemachine camera keeps resetting when I try it and it doesn’t hold its position when the timeline ends but the dialogue doesn’t.
Make sure a camera is tagged MainCamera. If you're using Cinemachine, don't use any Camera() sequencer commands. Instead, control it through the timeline and/or Cinemachine sequencer commands (CinemachineTarget() and CinemachinePriority()).
albuarki wrote: Tue Mar 30, 2021 12:59 pmAlso: is it possible to change the subtitle and responses fields at runtime?
Yes. The specifics depends on what you need to do.

To insert variable values in text, use the [var=variable] markup tag -- or the [lua(code)] tag to insert Lua expressions or the return values of C# methods.

To replace/change text content, use OnConversationLine/OnConversationResponseMenu script methods.

If you just need to branch based on conditions, you don't need to do anything special. That's just regular conversation tree stuff.
albuarki
Posts: 18
Joined: Mon Dec 28, 2020 12:23 pm

Re: Using DS with Timeline & Cinemachine

Post by albuarki »

Make sure a camera is tagged MainCamera. If you're using Cinemachine, don't use any Camera() sequencer commands. Instead, control it through the timeline and/or Cinemachine sequencer commands (CinemachineTarget() and CinemachinePriority()).
Thanks, this does control the cameras during the conversation and the camera stays at its last location which is great! However, if I use the timeline sequence command to play a timeline, the camera resets to main camera when I use (continue conversation) in the time line. Can I use the continue conversation without changing the camera?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using DS with Timeline & Cinemachine

Post by Tony Li »

The Continue Conversation timeline clip doesn't do anything with the camera. Is the conversation still active when the camera resets? Are you using any other Dialogue System functionality that controls Cinemachine, such as Cinemachine sequencer commands? Is your main camera controlled by Cinemachine?
albuarki
Posts: 18
Joined: Mon Dec 28, 2020 12:23 pm

Re: Using DS with Timeline & Cinemachine

Post by albuarki »

Tony Li wrote: Wed Mar 31, 2021 8:30 am The Continue Conversation timeline clip doesn't do anything with the camera. Is the conversation still active when the camera resets? Are you using any other Dialogue System functionality that controls Cinemachine, such as Cinemachine sequencer commands? Is your main camera controlled by Cinemachine?
No I was just using the timeline and the conversation was still active. I found a way around that by using the timeline for everything except cinemachine and controlling it with the sequencer comands instead. I'd prefer using the timeline, though. My main camera is controlled by Cinemachine.

I'm sorry but I have another question: I want to have a main conversation in the game, in a main scene, and have that conversation load other conversations in other scenes. The problem is that each scene has a different look and UI elements, cameras, etc. I tried the LoadLevel() command and initially I had another Dialogue manager in Level1 and another Dialogue manager in the main scene. Is it possible to switch between them? Or is there another way?

In my game now I have a UI image for the background in Level1 and none in the main scene, so when it loads using the command, the image in Level1 covers the dialogue panel.
albuarki
Posts: 18
Joined: Mon Dec 28, 2020 12:23 pm

Re: Using DS with Timeline & Cinemachine

Post by albuarki »

I used the option to untick the don't destroy on load option so now each scene can have it's own manager. While the main scene we will use to get back and forth to and from, each time triggering a different conversation. Is not using the don't destroy on load + using multiple managers is fine?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using DS with Timeline & Cinemachine

Post by Tony Li »

Hi,

It's fine to use different Dialogue Managers. If you need to carry data such as DS variable values across scene changes, you'll need to set up the save system in this case because the Dialogue Manager won't survive the scene change.

Regarding your Timeline/Cinemachine issue, double check that a camera is tagged MainCamera. If that doesn't help, I may need a reproduction project.
albuarki
Posts: 18
Joined: Mon Dec 28, 2020 12:23 pm

Re: Using DS with Timeline & Cinemachine

Post by albuarki »

Tony Li wrote: Thu Apr 01, 2021 10:57 am Hi,

It's fine to use different Dialogue Managers. If you need to carry data such as DS variable values across scene changes, you'll need to set up the save system in this case because the Dialogue Manager won't survive the scene change.

Regarding your Timeline/Cinemachine issue, double check that a camera is tagged MainCamera. If that doesn't help, I may need a reproduction project.
Hi Tony,

I'm not sure what was the problem but the camera is no longer resetting. I have one last question about using Timelines and the continue button. If I want to control the dialogue during cutscenes I have to set the Continue Button to Always, but if I want to set the Continue Button in the regular dialogue (the same convorsation) to Never, should I use the Simulate Continue Button command on every node or is there a way to switch it between Never and Always during in the TImeline or using a sequence command?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using DS with Timeline & Cinemachine

Post by Tony Li »

Hi,

You can use the SetContinueMode(true/false) sequencer command to turn the continue button on or off. SetContinueMode(true) sets it to Always. SetContinueMode(false) sets it to Never.

There are a few ways to interpret your question. If you always want every dialogue entry to wait for a "continue" instruction, don't use SetContinueMode(). Instead, keep the continue button UI element hidden in cutscenes where you're using the Continue Conversation clip to advance the conversation. Show the continue button UI element (so the player can click it) in the parts of the conversation where the player is allowed to manually advance. You could use the SetActive() sequencer command to set the continue button active or inactive.
albuarki
Posts: 18
Joined: Mon Dec 28, 2020 12:23 pm

Re: Using DS with Timeline & Cinemachine

Post by albuarki »

Hi,

I wanted to control when the dialogue is displayed during cutscenes and I didn’t want to use the continue button outside of cutscenes. So the SetContinueMode command is exactly what I need. Thank you!
Post Reply