Page 2 of 2

Re: Cannot find dialog behavior I really want for 2d Game

Posted: Sat Nov 26, 2016 3:37 pm
by RojasGoni
In case you haven't managed to get your animated portraits to obey your commands (I had some issues with mine) here is what I discovered, doing a bit of reverse engineering in Toni's example.

When I created my first animated portraits I did the following:
1- Add "Use Animated Portraits" script to Dialogue UI
2- Add "Animated Portraits" scripts to all NPC, assign an animator controller with respective animations to all of the "Animated Portraits" scripts.
3-Assign NPCs to each conversation.
Following these steps, it was all working perfect, one animation playing for the whole length of a speaker's line. But what happened if I wanted to change an animated expression? Or if I wanted my characters to stop speaking after a reasonable lapse?
I used the sequencer command recommended by Tony in the camera settings of my Dialogue Manager. This stops the talking animation after a period related to the speaker's line length.

AnimatorPlay(Talking, NPC Portrait Image);
AnimatorPlay(Idle, NPC Portrait Image)@{{end}}

And that was it. Nothing worked again, I got all kinds of error messages, starting from "-1 is not a valid layer index", could not find the GoTo state in my animations, the animator didn't have a controller, etc. Eventually I got everything working again, but I had to add an animator component to the Portrait Image in my Dialogue UI ( (I assigned one of the animator controllers of my NPCs, it works regardless of which one I use, as long as there is one).

I also had to correct another minute detail. My UI doesn't have NCP Portrait Image, but only Portrait Image, so I adjusted this in the default sequence in the Camera Settings of my Dialogue Manager and that seemed to fix the remaining error messages.

AnimatorPlay(Talking, Portrait Image);
AnimatorPlay(Idle, Portrait Image)@{{end}}


Now, I thought to get the animations to go from one state to another (say for different expressions) I had to use:

AnimatorPlay(State, Character, duration of cross-fade, layer index)

Example:

AnimatorPlay(Angry, Julianne, , -1)

Here I got informed that my NPC (Julianne) doesn't have an animator component. She does, in fact. But I got it to work with:

AnimatorPlay(Angry, Portrait Image,, 0)

This worked just fine for me and I hope this helps you a bit. In any case, I am going to post a more detailed description in my dev's blog (to remember it in the future!):

https://thestchristopherslockdown.wordpress.com/

Re: Cannot find dialog behavior I really want for 2d Game

Posted: Sat Nov 26, 2016 3:52 pm
by Tony Li
Thanks again! I'm going to keep an eye on your dev blog. Your game looks interesting!

(Completely off topic:)
BTW, I skimmed through a couple blog posts, and I see that your programmer created Enable Object and Disable Object actions. (It's amazing that Chris hasn't added this to Adventure Creator himself yet.) I did the same thing for a project, and then I later changed it to support Constant IDs for GameObjects that aren't in the scene yet. Unfortunately this change broke all existing references. Before you get too far into using the Enable Object and Disable Object actions, you might want to evaluate whether you'll need to be able to reference GameObjects by Constant ID and make the change sooner rather than later.

Re: Cannot find dialog behavior I really want for 2d Game

Posted: Sat Nov 26, 2016 4:14 pm
by RojasGoni
Thank you very much, also for checking my blog. As you see we are devoted fans of Dialogue System, though our first steps were as rough as you can imagine, but it has been an amazing tool, as Adventure Creator has been. I can't imagine developing this game without either of you guys. I am going to check right now the issue with Constant IDs, especially since we are doing some really heavy lifting in scenes where groups of NPCs keep changing, particularly since the animated portraits dynamics relate in such an organic way to the hierarchy.