cutscene with characters touching

Announcements, support questions, and discussion for the Dialogue System.
gellosart
Posts: 10
Joined: Thu Dec 24, 2020 9:41 am

cutscene with characters touching

Post by gellosart »

Hello!
I have a scene at the end of my game where two of the characters hug and I'm unsure of how to set up the animations in unity using the dialogue system since there is corresponding text. I used sequence commands to set up the animations for another NPC but I feel like this one might be a little harder.
My animator and I are beginners at game making so we don't know how to go about this.
Should the characters be on separate images? I'm worried about things lining up.
This is what the scene looks like.
Image
pls help i dont know what im doing :cry:
I can explain further if it doesn't make sense.
User avatar
Tony Li
Posts: 22166
Joined: Thu Jul 18, 2013 1:27 pm

Re: cutscene with characters touching

Post by Tony Li »

Hi,

2D animation?

The character's don't just touch; they overlap. It'll be easiest if you draw them as a single animation containing both characters. Here's an example of what I mean:



It's pixel art, but the same concept can apply to non-pixel art.

The woman and the dog are separate sprites. When they meet, we hide the dog sprite and make the woman play an animation whose frames include the woman and the dog together. This allows one hand to be in front of the dog while the other is behind, without having to struggle with layering issues.

They key is to get them in the correct position from each other before hiding the dog. Otherwise, if the dog sprite is a little too far or close, the dog will appear to pop into position instead of smoothly going into the petting animation.

Fortunately that's fairly easy to do with the Dialogue System. But it depends on how you're managing your characters.

One solution is to use the MoveTo() and AnimatorPlay() sequencer commands to move the characters into position before kicking off the hug sequence. For the hug sequence, use the SetActive() or SetEnabled(SpriteRenderer) sequencer commands to hide one of the characters, and AnimatorPlayWait() to play the animation on the other.

Alternatively, you can sequence it all in Unity Timeline or a third party interactive sequencer editor system such as SLATE. Then use the Timeline()/SLATE() sequencer command to kick it off.

I'm happy to provide more specific guidance on how to set that up if desired. Just let me know how you generally want to proceed with it.
gellosart
Posts: 10
Joined: Thu Dec 24, 2020 9:41 am

Re: cutscene with characters touching

Post by gellosart »

Yes, 2D animation.

That example is so sweet!

That definitely helps us out a lot!

I just managed to line up the animation of the different sprites since the hug sprite was a different size from the normal kangaroo sprite. I changed the pivot points and it's matching up well now so that's one obstacle passed.

We will definitely be managing this with the dialogue system since we've found it to be very reliable so far.

More specific guidance would be great, thank you!

We're also looking to have these play automatically and take the control away from the player for this scene.
User avatar
Tony Li
Posts: 22166
Joined: Thu Jul 18, 2013 1:27 pm

Re: cutscene with characters touching

Post by Tony Li »

To take control away from the player during the conversation, use a Dialogue System Events component as covered in the Interaction Tutorial.

If I can provide specific guidance on anything in particular, please let me know what you'd like to know.
gellosart
Posts: 10
Joined: Thu Dec 24, 2020 9:41 am

Re: cutscene with characters touching

Post by gellosart »

Hello again!

I was able to set it up with your advice! Now I'd like to polish up a little.

I'd like to play some animations without the dialogue panel and have them automatically move on to the next one after playing through once. I tried to do this myself by using SetDiagluePanel but the continue button was needed to move to the next piece of sequence/dialogue.

I'd also like to disable the continue button until all the dialogue text is displayed.

I used MoveTo() in the START node which worked great to get the character in the same position every time and to take it further I'd like to pair it with our walk animation. I found another post on this forum which did explain a bit on how to do this but the walk animation didn't get played when I tried to set it up.

Here's how it's looking so far.
https://vimeo.com/513808894

Thank you for your help so far!
User avatar
Tony Li
Posts: 22166
Joined: Thu Jul 18, 2013 1:27 pm

Re: cutscene with characters touching

Post by Tony Li »

Hi,

Looks great! (I can tell I'm going to have something in my eye when I play the game.)

Use these sequencer commands:
  • SetDialoguePanel() -- shows or hides the dialogue UI
  • SetContinueMode() -- shows or hides the continue button
  • Continue() -- simulates a continue button press so the player doesn't need to click a continue button
For example, if you want to hide the dialogue panel and auto-advance after 3 seconds, set the node's Sequence to:

Code: Select all

SetDialoguePanel(false);
SetContinueMode(false);
Continue()@3
Sequencer commands can also send and receive messages, which are arbitrary strings of your choosing. For example, say you want to advance after playing an Hug animation named Hug on the node's speaker:

Code: Select all

SetDialoguePanel(false);
SetContinueMode(false);
AnimatorPlayWait(Hug)->Message(Hugged);
Continue()@Message(Hugged)
gellosart
Posts: 10
Joined: Thu Dec 24, 2020 9:41 am

Re: cutscene with characters touching

Post by gellosart »

Hi, I'm testing out playing our game from start to finish and I've run into a problem with the continue button not showing up at this end scenes dialogue.

In my sequencer nodes, I didn't use SetContinueMode at all but the continue button doesn't show up anyway.
And then when I do use SetContinueMode I get this long error message.


NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.Sequencer.HandleSetContinueModeInternally (System.String commandName, System.String[] args) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:2426)

PixelCrushers.DialogueSystem.Sequencer.HandleCommandInternally (System.String commandName, System.String[] args, System.Single& duration) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:1079)

PixelCrushers.DialogueSystem.Sequencer.ActivateCommand (System.String commandName, System.String endMessage, UnityEngine.Transform speaker, UnityEngine.Transform listener, System.String[] args) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:721)

PixelCrushers.DialogueSystem.Sequencer.PlayCommand (PixelCrushers.DialogueSystem.SequencerCommands.QueuedSequencerCommand commandRecord, System.String commandName, System.Boolean required, System.Single time, System.String message, System.String endMessage, System.String[] args) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:682)

PixelCrushers.DialogueSystem.Sequencer.PlayCommand (PixelCrushers.DialogueSystem.SequencerCommands.QueuedSequencerCommand commandRecord) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:651)

PixelCrushers.DialogueSystem.Sequencer.PlaySequence (System.String sequence) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:585)

PixelCrushers.DialogueSystem.Sequencer.PlaySequence (System.String sequence, System.Boolean informParticipants, System.Boolean destroyWhenDone) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:595)

PixelCrushers.DialogueSystem.ConversationView.StartSubtitle (PixelCrushers.DialogueSystem.Subtitle subtitle, System.Boolean isPCResponseMenuNext, System.Boolean isPCAutoResponseNext) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:172)

PixelCrushers.DialogueSystem.ConversationController.GotoState (PixelCrushers.DialogueSystem.ConversationState state) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:208)

PixelCrushers.DialogueSystem.ConversationController.OnFinishedSubtitle (System.Object sender, System.EventArgs e) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:264)

PixelCrushers.DialogueSystem.ConversationView.FinishSubtitle () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:397)

PixelCrushers.DialogueSystem.ConversationView.HandleContinueButtonClick () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:369)

PixelCrushers.DialogueSystem.ConversationView.OnConversationContinueAll () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:361)

UnityEngine.Component:BroadcastMessage(String, SendMessageOptions)
PixelCrushers.DialogueSystem.Sequencer:HandleContinueInternally() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:2440)

PixelCrushers.DialogueSystem.Sequencer:HandleCommandInternally(String, String[], Single&) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:1083)

PixelCrushers.DialogueSystem.Sequencer:ActivateCommand(String, String, Transform, Transform, String[]) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:721)

PixelCrushers.DialogueSystem.Sequencer:CheckQueuedCommands() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:846)

PixelCrushers.DialogueSystem.Sequencer:Update() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:495)


It worked when I would load up the scene without having played through all the other levels and conversations.
There is an active quest while this end dialogue is playing and I have ticked Allow Simultaneous Conversations to be on.
User avatar
Tony Li
Posts: 22166
Joined: Thu Jul 18, 2013 1:27 pm

Re: cutscene with characters touching

Post by Tony Li »

Hi,

Check the settings on the first Dialogue Manager that appears when playing through from the beginning.

The Dialogue Manager GameObject survives scene changes. When it survives a scene change and enters a new scene, it replaces any Dialogue Manager GameObject that may have been put in that scene at design time.

For example, say you have scenes Scene1 and Scene2. Both scenes have a Dialogue Manager, so you can play each one individually in the editor, and it will use the Dialogue Manager that you placed in that scene.

However, if you play Scene1 and transition to Scene2, the Scene1 Dialogue Manager will survive the scene change and supplant the one that's in Scene2. This means Scene2 will now, at runtime, have Scene1's Dialogue Manager, including all of its settings and dialogue UI assignment.

I suspect that's related to the issue.

If not, can you please back up your project, update to DS version 2.2.15, reproduce the error, and send me the same error messages? That way we'll be on the same page when to comes to the line numbers that the error messages report.
gellosart
Posts: 10
Joined: Thu Dec 24, 2020 9:41 am

Re: cutscene with characters touching

Post by gellosart »

I've now updated to the latest version and it's still giving me errors.
I did check the dialogue managers in both scenes and they should be the same.

I also tried to backtrack to see if I started playing though different scenes if I would still get an error. So I went through each scene and didn't get an error until I played through a scene where I used the sequencer node in that scene to load another scene using LoadLevel(). So my theory is that whenever I load a scene using that method instead of going through one of the doors I've created something happens to the dialogue manager which is effecting the continue button and whatever else is in these error messages.

I also just tested this theory on the first scene in the game which also has dialogue and it also caused it to not work but this time I didn't get an error. It's just frozen after I pressed continue.

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.Sequencer.HandleSetContinueModeInternally (System.String commandName, System.String[] args) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:2475)

PixelCrushers.DialogueSystem.Sequencer.HandleCommandInternally (System.String commandName, System.String[] args, System.Single& duration) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:1084)

PixelCrushers.DialogueSystem.Sequencer.ActivateCommand (System.String commandName, System.String endMessage, UnityEngine.Transform speaker, UnityEngine.Transform listener, System.String[] args) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:721)

PixelCrushers.DialogueSystem.Sequencer.PlayCommand (PixelCrushers.DialogueSystem.SequencerCommands.QueuedSequencerCommand commandRecord, System.String commandName, System.Boolean required, System.Single time, System.String message, System.String endMessage, System.String[] args) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:682)

PixelCrushers.DialogueSystem.Sequencer.PlayCommand (PixelCrushers.DialogueSystem.SequencerCommands.QueuedSequencerCommand commandRecord) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:651)
PixelCrushers.DialogueSystem.Sequencer.PlaySequence (System.String sequence) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:585)

PixelCrushers.DialogueSystem.Sequencer.PlaySequence (System.String sequence, System.Boolean informParticipants, System.Boolean destroyWhenDone) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:595)

PixelCrushers.DialogueSystem.ConversationView.StartSubtitle (PixelCrushers.DialogueSystem.Subtitle subtitle, System.Boolean isPCResponseMenuNext, System.Boolean isPCAutoResponseNext) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:172)

PixelCrushers.DialogueSystem.ConversationController.GotoState (PixelCrushers.DialogueSystem.ConversationState state) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:208)

PixelCrushers.DialogueSystem.ConversationController.OnFinishedSubtitle (System.Object sender, System.EventArgs e) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:265)

PixelCrushers.DialogueSystem.ConversationView.FinishSubtitle () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:399)

PixelCrushers.DialogueSystem.ConversationView.HandleContinueButtonClick () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:371)

PixelCrushers.DialogueSystem.ConversationView.OnConversationContinueAll () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:363)

UnityEngine.Component:BroadcastMessage(String, SendMessageOptions)
PixelCrushers.DialogueSystem.Sequencer:HandleContinueInternally() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:2489)

PixelCrushers.DialogueSystem.Sequencer:HandleCommandInternally(String, String[], Single&) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:1088)

PixelCrushers.DialogueSystem.Sequencer:ActivateCommand(String, String, Transform, Transform, String[]) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:721)
PixelCrushers.DialogueSystem.Sequencer:CheckQueuedCommands() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:846)

PixelCrushers.DialogueSystem.Sequencer:Update() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:495)
User avatar
Tony Li
Posts: 22166
Joined: Thu Jul 18, 2013 1:27 pm

Re: cutscene with characters touching

Post by Tony Li »

Hi,

Would you please import this patch and let me know if it resolves one or both issues?

DS_SequencerPatch_2021-02-19.unitypackage
Post Reply