Forum rules - please read before posting.

Multiple styles of conversation boxes (Menus, Lock Menu, Turn Off Menu)

Hi Chris!

Firstly, I'm a new user of Adventure Creator. I dearly love it so far, thank you for your constant efforts.

An element I'd really like to incorporate is varying styles of text boxes for my characters, but I'm finding some confusion within the 'lock menu' / 'turn off' menu system options. I've made three different dialogue oriented menus, based off of 'subtitles', that appear near the character, all using Unity UI.

Two are set as 'start locked off', and set to appear with all characters speaking, so I can lock and unlock them as needed with an Asset Actionlist but even when 'locked off', they flash into the scene for a split second every time a piece of dialogue fires (full of just the prefab temp dialogue). I looked for clarification on this behaviour but couldn't find anything detailed.

So, two questions:

1) Is there a way to ensure only one dialogue menu plays at any given time (without assigning it to different characters). As it is I'm using 'Lock Menu' and "Turn Off", but it still doesn't seem to ensure they disappear for good.

2) Would it be possible to add a new dropdown to the 'dialogue' action that lets us choose which menu to use for each line? I want to intermingle the styles as different languages, and not having to use an Asset Actionlist or other workaround would be a wonder.

  • Efehan

Thank you again! AC is magic.

Comments

  • Welcome to the community, @efehan.

    Is there a way to ensure only one dialogue menu plays at any given time

    Locking a Menu will prevent a Menu from showing when it's regular "Appear type" rule is met, so there shouldn't be a need to separately turn it off as well. Whether it momentarily flashes on for a moment, I'd imagine, would depend on when exactly you tell it to lock. What is your AC version, and how exactly are you calling the Lock command? Doing so before the Dialogue: Play speech Action, or in the OnStartSpeech custom event, should safely prevent unwanted Menus from showing.

    Would it be possible to add a new dropdown to the 'dialogue' action that lets us choose which menu to use for each line?

    The Dialogue: Play speech Action can be extended through a custom Action. Here's some sample code - follow the tutorial to install it, and you can then disable the "default" speech Action within the Actions Manager:

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    #if UNITY_EDITOR
    using UnityEditor;
    #endif
    
    namespace AC
    {
    
        public class ActionSpeechMenu : ActionSpeech
        {
    
            private string[] menuNames = new string [3] { "SubtitlesA", "SubtitlesB", "SubtitlesC" };
            public int chosenMenu;
    
            public ActionSpeechMenu ()
            {
                this.isDisplayed = true;
                category = ActionCategory.Dialogue;
                title = "Play speech + Menu";
                lineID = -1;
            }
    
            override public float Run ()
            {
                for (int i=0; i<menuNames.Length; i++)
                {
                    Menu menu = PlayerMenus.GetMenuWithName (menuNames[i]);
                    if (menu != null)
                    {
                        menu.isLocked = (i == chosenMenu);
                    }
                }
    
                return base.Run ();
            }
    
            #if UNITY_EDITOR
    
            override public void ShowGUI (List<ActionParameter> parameters)
            {
                chosenMenu = EditorGUILayout.Popup ("Chosen menu:", chosenMenu, menuNames);
    
                base.ShowGUI (parameters);
            }
    
            #endif
    
        }
    
    }
    
  • Amazing, thank you for that sample code. I'll give that a shot!

    I'm currently using version 1.67.0

    For the menu locking question, then, should the menu be locked each time a speech item is called? In the sequence of the ActionLists it would be:

    --> lock menu --> dialogue

    for each instance of dialogue?

  • If you were using separate default Actions, then yes - locking the menu before the speech would be the correct approach. However, the Action about should combine both tasks in one.

  • Thank you again for all this Chris! My apologies in delayed answer, I've been focused on a bunch of other aspects before returning to the dialogue boxes.

    The action seems to work perfectly, though I'm just sorting out how to re-lock the other dialogue menus after it plays the selected one (they remain unlocked currently, it seems).

    There is something else I've noticed though, and I haven't been able to find another thread on it either. If there are three AC menus set to 'When Speech Plays', but two are locked, all three seem to flicker just for a moment before dialogue plays. It happens no matter in what arrangement the menus are locked are unlocked. Every menu appears just for 1 frame any 'Speech' action being called, even if just one UI Prefab stays after. This happens on the original Speech action or this new one, both.

    My AC version: 1.67.5
    My Unity version: 2018.2.17f1 Personal

    This has actually been happening the whole time during my testing.
    Have you come across this before?

  • You can see an example of what's happening here:

  • The action seems to work perfectly, though I'm just sorting out how to re-lock the other dialogue menus after it plays the selected one (they remain unlocked currently, it seems).

    If you don't check Play in background? in the speech Action, the Action's End function will run once the speech has completed. You could add the following override to re-lock the Menu afterwards:

    public override ActionEnd End (List<Action> actions)
    {
        for (int i=0; i<menuNames.Length; i++)
        {
            Menu menu = PlayerMenus.GetMenuWithName (menuNames[i]);
            if (menu != null)
            {
                menu.isLocked = false;
            }
        }
        return base.End (actions);
    }
    

    There is something else I've noticed though, and I haven't been able to find another thread on it either. If there are three AC menus set to 'When Speech Plays', but two are locked, all three seem to flicker just for a moment before dialogue plays. It happens no matter in what arrangement the menus are locked are unlocked

    I can't recreate such behaviour. Does it occur when using Adventure Creator as each menu's Source? And this was before any custom code to lock/unlock menus through script?

    If you can create a .unitypackage file of your Managers, UI prefabs, and a sample scene to test with, PM it to me and I'll take a look.

  • Thanks Chris!

    Correct, this has been happening with the 'start locked' option, even when i was simply locking/unlocking them in a series of Actions with a Param, in an Asset Actionlist.

    It doesn't seem to happen when the source is Adventure Creator, only with the Unity UI Prefabs.

    It also, oddly, doesn't happen when the menus are set to "Specific characters", included or excluded. In that case they work well per character, no flickering.

    I'll try and package a scene for you to test as soon as I can!

    I may try to update Unity / and AC both after a backup, and see if it resolves anything.

  • Update!
    I updated to the latest Adventure Creator, and the flickering has vanished for the moment! Huzzah! Same older version of Unity, 2018.2.17f1 Personal.

    I'm using the solution you mentioned above to unlock and relock, and its working as well.

    Thanks Chris.

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.