Animator on VN + Combining Player/ Response Portrait

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
c166
Posts: 38
Joined: Fri Oct 14, 2022 11:08 pm

Animator on VN + Combining Player/ Response Portrait

Post by c166 »

Hey PixelCrusher Team,

I downloaded the animated change pose portrait example ("DS_AnimatedChangePoseExample_2022-01-14") from here; (https://www.pixelcrushers.com/dialogue- ... em-extras/) but I can't quite figure out how the animator itself is attached/ accessed via the dialogue manager.

From my understanding, at each step during the conversation; the sequence will be played which calls on the Animator to play code i.e.:

Code: Select all

{{default}};
AnimatorPlay(IdleAnim, Portrait Image 0);
which would then activate the named animation (e.g. IdleAnim) attached to the controller for each conversant (e.g. one for player + one for npc).

I am not sure how to attach the animation controller so that it can be picked up by the dialogue controller. In the demo scene "Mufasa" does not appear to have a controller attached directly to the gameobject/ character. And I haven't been able to find out where that is set.

Secondary question, is "what does the "potrait image 0" refer to?/ How do I change that (do I need to?? or does it just refer to the default image as a placeholder for the function)

Last question is; is there additional documentation where I'd be able to try to figure this stuff out (stuff in the "extras")? Or is the intended learning mechanism here at the forums?

Best Regards,
C
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator on VN + Combining Player/ Response Portrait

Post by Tony Li »

Hi,

The GameObject named "Mustafa" has a Dialogue Actor component. This component links the GameObject to the Mustafa actor in the dialogue database. (More info: Character GameObject Assignments.) It also lets the GameObject specify an animator controller that will be assigned to the subtitle panel's Portrait Image > Animator component when Mustafa speaks. That animator controller has animation clips that switch images with a fade.

BTW, since that example was created, the Dialogue System added special keywords "speakerportrait" and "listenerportrait". You can use these keywords instead of explicitly specifying a Portrait Image GameObject by GameObject name. For example, you could change the sequence to:

Code: Select all

{{default}};
AnimatorPlay(IdleAnim, speakerportrait);
c166
Posts: 38
Joined: Fri Oct 14, 2022 11:08 pm

Re: Animator on VN + Combining Player/ Response Portrait

Post by c166 »

Thanks for that, didn't realise that there was a spot to link the animator controller inside the Dialogue Actor (didn't see the drop down), though that location makes perfect sense.

I also found this which was pretty useful: https://www.pixelcrushers.com/dialogue_ ... Portraits
However, after reading that - it seems that the animated portrait requires a textbox to be ticked in the subtitle panel. The response panel doesn't seem to have the same option.

I am trying to get to something like in your video https://www.youtube.com/watch?v=jC451AT ... lCrushers - with addition of the graying out of characters when they are not the primary speakers (which is in the default VN template).

How would I best get to that? Is a "response" panel necessary in that set-up? Or does it get "replaced" by one of the subtitle panels? How do I best "combine/ replace" the response panel with the subtitle panel so that I can get animations for the responder? (Characters do not need to move position, just their sprite needs to focus/ unfocus)

Is the code for that example available somewhere?
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator on VN + Combining Player/ Response Portrait

Post by Tony Li »

Hi,

The response menu (StandardUIMenuPanel script) doesn't do animated portraits.

One option is to keep the player's subtitle panel portrait visible and focused. Use the response menu panel's OnFocus() or OnOpen() event to un-gray the subtitle panel portrait image.

Another option is to make a subclass of StandardUIMenuPanel and override ShowResponses() to add support for a separate animated portrait.
c166
Posts: 38
Joined: Fri Oct 14, 2022 11:08 pm

Re: Animator on VN + Combining Player/ Response Portrait

Post by c166 »

Hey Tony,

Thanks for that, I've managed to get the desired effect by setting the OnFocus()/ OnUnfocus() of the response panel to call the `StandardSubTitlePanel` Focus()/ Unfocus() methods + setting the response panel portrait image (image component) + portrait name (text component) to be inactive so that only one set of images is called.

Do you think that general approach is appropriate?

Am unsure whether that has unintended consequences, I think that setting the whole gameobject (portrait image/name) would cause problems which is why I've set the respective components inactive instead; and it seems to be working for now.

Best Regards,
C
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator on VN + Combining Player/ Response Portrait

Post by Tony Li »

Hi,

That should be fine.
Post Reply