Forum rules - please read before posting.

Dialogue Outlines different for player and NPCs

Hey,

I was wondering if it is possible to change the Outline Effect for each player and NPC individually? At the moment I can add an Outline Effect in the AC Game Editor for all Dialogues/Speech. Is there an easy way to do this or does it require scripting? I already tried to solve it with scripting but no success so far… but I can imagine that there is probably a very easy solution for this.

Thank you so much in advance and all the best Marco :)

Comments

  • Welcome to the community, @MCO1191.

    How many variants of the subtitle Menu's appearance are you looking to have? One for Players, and one for NPCs?

    The Subtitle menu's For speakers of type property can be used to filter its display to only certain characters - so one way to achieve this would be to duplicate it, and have separate "Player subtitles" and "NPC subtitles" menus that you can then restyle individually.

  • Hey Chris, thank you so much :) This is the solution I was looking for. I creating one subtitle menu for each NPC because everyone should have have an individual outline. But it works!

  • Glad to hear it - though it sounds like a little scripting would be a neater way of handling this, if it needs to be different for each character.

    Is it the "Effect size" field you're varying for each Menu? I should be able to write a simple script that can vary this depending on which character is speaking.

  • Yes, it is "Subtitles [Name of Character]" > Line > Text effect: Outline > Effect Colour

    And each character has its own text colour as well.

    I tried it once, to add a Outline color setting in the NPC Controller right under "Speech text colour" but I didnt get it to work :D So it would be super helpful, if you can help me with a script :)

  • For the speech text colour, you just need to check Use speaker text colour? in the Line label element's properties.

    For the outline colour, create a new C# script named OutlineColorGetter, and copy/paste the following:

    using UnityEngine;
    public class OutlineColorGetter : MonoBehaviour
    {
        public Color color = Color.black;
    }
    

    Then attach the new Outline Color Getter component to your NPCs, and set the colour in the Inspector.

    Then, create a new C# script named OutlineColorSetter, and copy/paste:

    using UnityEngine;
    using AC;
    
    public class OutlineColorSetter : MonoBehaviour
    {
        void OnEnable () { EventManager.OnMenuTurnOn += OnMenuTurnOn; }
        void OnDisable () { EventManager.OnMenuTurnOn -= OnMenuTurnOn; }
    
        void OnMenuTurnOn (Menu menu, bool isInstant)
        {
            if (menu.appearType != AppearType.WhenSpeechPlays && menu.speech == null) return;
    
            Color color = Color.black;
            if (menu.speech.GetSpeakingCharacter ())
            {
                var getter = menu.speech.GetSpeakingCharacter ().GetComponent<OutlineColorGetter> ();
                if (getter)
                {
                    color = getter.color;
                }
            }
            foreach (var element in menu.elements)
            {
                if (element is MenuLabel)
                {
                    (element as MenuLabel).effectColour = color;
                }
            }
        }
    }
    

    Adding the new Outline Color Setter component to your scene should then update the Subtitle menu's outline colour.

  • Oh wow thanks! Where exactly should i add the OutlineColorSetter?

  • It can be anywhere in the scene - an empty GameObject is best.

    That way, once you've confirmed it works, you can prefab it, remove from the scene, and then use the Events Editor to spawn it in manually via the "Scene: Change: After" event and the Object: Add or remove Action.

  • Okay, cool, thank you so much!

    I will try this in a couple of weeks. Right now, we are in crunch time for a playable demo of our game, so we've been using the other workaround. However, for further development, we will switch to your script since there will be a lot of NPCs with different outlines.

    I have some other things I would like to ask for your help with. Should I create a new thread or use this one? It’s about menu settings and issues with the controls and stuff...

  • A new thread would be best, yes - it'll help keep things searchable for others with similar issues.

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.