Cinemachine Zoom

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Shinos
Posts: 59
Joined: Tue Jan 17, 2023 10:51 am

Re: Cinemachine Zoom

Post by Shinos »

Tony Li wrote: Wed Mar 08, 2023 8:14 pm Hi,

The How To Write Sequences section of the manual explains the "@" timing syntax. You can tell a command to wait for a specific time (e.g., Audio(hello)@5) or wait for a message string (e.g., Audio(hello)@Message(sayHello)).

Nothing sends the message string "Continued". This means "required SetDialoguePanel(true)@Message(Continued)" will wait forever. However, if you were using continue buttons, the "required" keyword guarantees that the command will run when the continue button is clicked, even though it hasn't received the message string yet. You can simulate a continue button click like this:

Code: Select all

{{default}};
SetDialoguePanel(false, immediate);
CinemachineZoom(CM vcam2, 7)->Message(DoneZooming);
Continue()@Message(DoneZooming);
required SetDialoguePanel(true)@Message(Continued);

For timelines, use a dialogue UI that doesn't have a visible continue button. Set the conversation's properties > Continue Button to Always. Then you can use Continue Conversation clips to advance each node.
Hi tony thank you for the first part of your answer but with the second one
For timelines, use a dialogue UI that doesn't have a visible continue button. Set the conversation's properties > Continue Button to Always. Then you can use Continue Conversation clips to advance each node.
i think you missed what i was asking, please read again this:
Also i noticed that the timeline speed works but there is one problem, i put the Continue to never, because i want the timeline to be able to manage my dialogue entries with "continue" in the timeline and not by player input, but when i put the timeline speed to 0 obviously it can't go to the "continue" blocks anymore so to open the response menu i have the player to do a click on the screen to continue, so it stops to be an "automatic" flow is there a way to fix
also there is the second part of my question that is more important at the moment because it revealed to be a CRITICAL problem for my workflow at the moment, i need to solve this but i cannot find how.
also there is an other "logic" problem, i think i need to switch position of where i am in the timeline based on the response of the player, because if one of the answers gets to a short conversation, i should have the player to get to the bottom of the timeline, instead he continues to go through the "continue" buttons, and we have also the reverse problem where if i have a short branch and a long one, for example let's say i have this : a cutscene that's just like "a conversation between two character where at the end one of them jumps from a roof" in one of the conversation branch there is the player that with only 3 dialogues lines quickly ends the conversation so the timeline would be composed of a start conversation and 3 continueconversationclips, but if i have an other branch of the conversation which is much longer let's say one with 7 dialogue lines i don't have enough continueconversationclips in my timeline, unless i project it taking in mind the longest conversation , but again i need now a way to make the timeline jump to the continueconversationclips i need.
i made an image to explain myself further:

In the image above there are two branches a "green" one longer, and a "purple" one shorter
(PS:Also correct me if i am wrong but i noticed that if i do not have the dialogue manager put on a "Continue" button approach and i put a quick zoom transition in the sequence like with Zoom2D(//,0.2) and i do not put a Delay(end) the dialogue gets over quickly when the zoom is over, is this expected behavior or i am doing something wrong)
i made a video showing both these problems

in the first part you'll see that if i do not click on the screen it will not advance itself to the choice menu, at 0:19 you'll see that unless a do a click it does not advance to the choice menu, i need it to be an automatic process.
in the second part you'll see that if i choose the "tutto bene" answer( "the shortest path") the timeline of course when it resume will still follow the way leading to more "continueclip" but i need a way to make it behave in a different way like to switch it when it resume to the end of the timeline because that's how it should be , while in this current iteration even if i finished the conversation it has to wait till all the "continueclip" go on and on even if it is not needed in the shortest branch of the dialogues. Like this the Timeline and cutscenes are unusable if you have the player to make choices in between the dialogues of the Timeline, unless they all have the same amount of dialogue lines and "continueclips", or unless you make the choice to continue dialogues only with player input and not automatically
User avatar
Tony Li
Posts: 22134
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cinemachine Zoom

Post by Tony Li »

Hi,

You can set the timeline speed to zero in the Response Menu Sequence before the response menu nodes.

Instead of jumping to a position in the timeline, why don't you break up the timeline into multiple timelines and configure each response node to start the appropriate timeline.
User avatar
Shinos
Posts: 59
Joined: Tue Jan 17, 2023 10:51 am

Re: Cinemachine Zoom

Post by Shinos »

Tony Li wrote: Wed Mar 08, 2023 10:50 pm Hi,

You can set the timeline speed to zero in the Response Menu Sequence before the response menu nodes.

Instead of jumping to a position in the timeline, why don't you break up the timeline into multiple timelines and configure each response node to start the appropriate timeline.

You are right i totally forgot about the response menu sequence section, i put the command there and it worked.
awdaw.png
awdaw.png (9.26 KiB) Viewed 1030 times
Now
also the solution you mentioned for the timeline would surely work but i need a simpler way to be able to go fast forward when i just don't need to have changes in the timeline but just to avoid those errors i mentioned earlier, doing as you said i would just do many timelines almost identical to the others but shorter, and doing that everytime would be a waste of time.
I actually found a way to Jump to different positions (markers) in a Timeline with one timeline:
i put this code on a gameobject

Code: Select all

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
using System.Linq;




public class timelineMarker : MonoBehaviour

{
    public PlayableDirector playableDirector;
    // The # of the Marker you want to go to
    public int markerNum;


    void OnMouseUp()
    {

        var timelineAsset = playableDirector.playableAsset as TimelineAsset;
    
        var markers = timelineAsset.markerTrack.GetMarkers().OrderBy((marker) => marker.time).ToArray(); //to order the markers by time 
        playableDirector.Play();
        playableDirector.time = markers[markerNum].time;

    }
}
and whenever i click on this "button" which holds reference to a specific timeline , it makes jumps to different markers based on the markerNum , this works really well but as you can imagine i need your help to transform this into a Command for the sequencer, i think it should be possibile, by doing something like TimelineJump(NameofTimeline,NumberOfMarkertojump) and we could put it in a blank dialogue before the end of a branch to skip to the end of the timeline, but i don't know how to translate this code to something like this. i think there is a way to maybe hold a reference to the markers by their name but i thought that maybe it was easier for now to have them rather by their chronological order in the timeline
You can use this code to go both fast forward in the timeline or to go back.

(ps: even if i think that "going back in time" used with the logic we use for the Dialogue System in the timeline would only be useful if you are going to the start of a conversation, because even going back would not reset dialogues, but i am digressing )

this is the timeline
1231232.png
1231232.png (29.88 KiB) Viewed 1030 times
here's an example of the script at work
User avatar
Tony Li
Posts: 22134
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cinemachine Zoom

Post by Tony Li »

You could write a custom sequencer command to jump to a specified time in the timeline using that code.
User avatar
Shinos
Posts: 59
Joined: Tue Jan 17, 2023 10:51 am

Re: Cinemachine Zoom

Post by Shinos »

Tony Li wrote: Thu Mar 09, 2023 2:35 pm You could write a custom sequencer command to jump to a specified time in the timeline using that code.
Hi i did this sequencer command which utilizes my code and it works good, thanks for your help, i figured it out at last, if you see something that could be improved in this code let me know

Code: Select all

using System.Linq;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;

namespace PixelCrushers.DialogueSystem.SequencerCommands
{

    public class SequencerCommandTimelineJump : SequencerCommand
    {

        PlayableDirector playableDirector;

        int markerNum;

        void Start()
        {
            string directorName = GetParameter(0);
            markerNum = GetParameterAsInt(1);
         
            playableDirector = GameObject.Find(directorName).GetComponent<PlayableDirector>();
         
            var timelineAsset = playableDirector.playableAsset as TimelineAsset;
            var markers = timelineAsset.markerTrack.GetMarkers().OrderBy((marker) => marker.time).ToArray();
            
            playableDirector.Play();
            playableDirector.time = markers[markerNum].time;

            Stop();

        }
    }
}
I only noticed that since i'm using Timeline(speed,//,0) when i get the speed to 1 again i get this warning , is this normal behaviour?
qwdqwd.png
qwdqwd.png (18.83 KiB) Viewed 1019 times
PS: also i'm a little worried about all the string reference that are implied in the management of the sequencer commands, like i lost 5 minutes figuring out why my previous section was not working anymore and i remembered that i changed the name of a playbleDirector from "Timeline" to "TimelineDir" and thus i would have to change it in all the sequencer Commands, isn't there a way to avoid this kind of problems ? Still it remains a really powerful asset and it is helping me really much, so thank you
User avatar
Tony Li
Posts: 22134
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cinemachine Zoom

Post by Tony Li »

Hi,

If the PlayableDirector is on the dialogue entry node's speaker (actor dropdown) or listener (conversant dropdown), you can use the special keywords "speaker" or "listener" instead of a GameObject name. This way you don't have to worry if the GameObject name changes.

For the two warnings, you'll need to figure out what is trying to start a second conversation or bark while a conversation is already active. These are just warnings; they won't break anything. But if you really do intend to start 'Domande Copy', for example, it won't start unless you've stopped the other conversation first, or if you tick the Dialogue Manager's Allow Simultaneous Conversations checkbox.
User avatar
Shinos
Posts: 59
Joined: Tue Jan 17, 2023 10:51 am

Re: Cinemachine Zoom

Post by Shinos »

Tony Li wrote: Fri Mar 10, 2023 3:59 pm Hi,

If the PlayableDirector is on the dialogue entry node's speaker (actor dropdown) or listener (conversant dropdown), you can use the special keywords "speaker" or "listener" instead of a GameObject name. This way you don't have to worry if the GameObject name changes.

For the two warnings, you'll need to figure out what is trying to start a second conversation or bark while a conversation is already active. These are just warnings; they won't break anything. But if you really do intend to start 'Domande Copy', for example, it won't start unless you've stopped the other conversation first, or if you tick the Dialogue Manager's Allow Simultaneous Conversations checkbox.
Hi,
Thank you i figured it out, the barking warning was because due to the player animation in the timeline was getting close to an object wich held a bark, while the other conversation warning was because i have a response menu sequence as we said earlier in the timeline, and i didn't disabled yet the option to start a conversation by clicking on screen when near an npc , so i have this scenario where due to the cutscene i am close to the npc which has the "domande_copy" conversation and when the response menu sequence from the timeline start i click on the screen and it thinks that i want to start also that other conversation

While for the speaker/listener advice to get it to work in this scenario you mean that i should put the Playable director object on the speaker/listener npc ? what do you mean by
If the PlayableDirector is on the dialogue entry node's speaker (actor dropdown) or listener (conversant dropdown)
User avatar
Tony Li
Posts: 22134
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cinemachine Zoom

Post by Tony Li »

Shinos wrote: Fri Mar 10, 2023 8:02 pmWhile for the speaker/listener advice to get it to work in this scenario you mean that i should put the Playable director object on the speaker/listener npc ?
Yes. That way you don't have to use a GameObject name in the Timeline() commands.
User avatar
Shinos
Posts: 59
Joined: Tue Jan 17, 2023 10:51 am

Re: Cinemachine Zoom

Post by Shinos »

Tony Li wrote: Fri Mar 10, 2023 9:05 pm
Shinos wrote: Fri Mar 10, 2023 8:02 pmWhile for the speaker/listener advice to get it to work in this scenario you mean that i should put the Playable director object on the speaker/listener npc ?
Yes. That way you don't have to use a GameObject name in the Timeline() commands.
Thank you!
User avatar
Tony Li
Posts: 22134
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cinemachine Zoom

Post by Tony Li »

Glad to help!
Post Reply