Forum rules - please read before posting.

Two Portraits / Remember Last Portrait?

Hello everybody,

First off, A big thank-you to Chris for his assistance with my previous question (https://www.adventurecreator.org/forum/discussion/9380/updating-a-connect-the-dots-logic-puzzle-where-some-dots-have-multiple-possible-states-and-more/p1?new=1). Following his suggestions, I was able to implement exactly what I was after. You can see it in action (with placeholder graphics) here: https://webm.red/qh6A.webm

Secondly, apologies if I was not supposed to create a new thread for a new question. I figured it was better for future readers with a similar question, but I'll do otherwise in future if this was incorrect.

Finally, the question: Is there a way to "Remember the last portrait displayed", or something similar? I assume it would be a custom action, but I'm not sure where to begin (other than reading the scripting guide, which I've done, but could still use a kick in the right direction). Essentially, I'd like to game to look similar to this:
but with more room between the portraits.

I know I can have 2 separate subtitles menus and switch between them to provide 2 different spots for the portraits to appear. Now if I can just keep the most recently-displayed portrait displayed when another character talks, it'll be perfect.

Thanks in advance.
BB

Comments

  • I figured it was better for future readers with a similar question,

    Exactly right. Unrelated questions should be in separate posts for the benefit of others.

    Now if I can just keep the most recently-displayed portrait displayed when another character talks, it'll be perfect.

    The "Dialog Portrait" option for Graphic elements only applies to the currently-speaking character. However, a Graphic element with a Graphic type set to Normal can have its texture graphic set through script, and a character's portrait graphic can also be accessed through script.

    You could try something like the following, whereby a Graphic element is updated whenever a character stops speaking:

    using UnityEngine;
    using AC;
    
    public class SetLastPortrait : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            EventManager.OnStopSpeech += StopSpeech;
        }
    
        private void OnDisable ()
        {
            EventManager.OnStopSpeech -= StopSpeech;
        }
    
        private void StopSpeech (AC.Char character)
        {
            MenuGraphic lastPortrait = (PlayerMenus.GetElementWithName ("Subtitles", "LastPortrait")) as MenuGraphic;
            lastPortrait.SetNormalGraphicTexture (character.GetPortrait ().texture);
        }
    
    }
    

    This works by hooking into the OnStopSpeech custom event, and then accesses the Graphic element by naming convention (edit Subtitles and LastPortrait accordingly). More on these functions can be found in the "Speech scripting" and "Menu scripting" chapters in the Manual.

  • THANK YOU! I've ended up getting it working after reading your post. Bellissimo.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.