Forum rules - please read before posting.

Couple of questions regarding already chosen options in conversations

  1. Is there a way to check if all options in a conversation have been chosen?
  2. Is there a way to make a certain option not change color when chosen? I have it for all but there are certain cases where I wouldn't want it to happen.

Comments

  • Is there a way to check if all options in a conversation have been chosen?

    This would require a custom Action (similar to this one). However, it will require a new function in AC's Conversation script to return this information - I shall provide this in the next release.

    Is there a way to make a certain option not change color when chosen? I have it for all but there are certain cases where I wouldn't want it to happen.

    Would this be for all options in a specific Conversation, or a specific option within a Conversation where other options can chance colour?

    For the former, you can rely on a separate Conversation menu that doesn't have Mark options already used? checked.

    For the latter, you'd have to rely on scripting and Unity UI to dynamically control the Button's colour based on the dialogue option it's linked to. Are you using Unity UI?

  • I am using Unity UI. And I don't have the Mark options already used option toggled. I'm using a script to trigger each button's animator.

  • edited May 2022

    If you're using a script attached to each Button and know the "slot index" it relates to in the Menu Manager, you can hook into the OnMenuTurnOn custom event to determine if the option has been chosen with:

    public int slotIndex;
    
    void OnEnable () { EventManager.OnMenuTurnOn += OnMenuTurnOn; }
    void OnDisable () { EventManager.OnMenuTurnOn -= OnMenuTurnOn; }
    
    void OnMenuTurnOn (Menu _menu, bool isInstant)
    {
        Menu menu = KickStarter.playerMenus.GetMenuWithCanvas (GetComponentInParent<Canvas> ());
        MenuDialogList dialogList = (MenuDialogList) menu.GetElementWithGameObject (gameObject);
        bool hasBeenChosen = dialogList.GetDialogueOption (slotIndex).hasBeenChosen;
        Debug.Log ("Option index " + slotIndex + " has been chosen? " + hasBeenChosen);
    }
    
  • Regarding point 2, I'm looking for a way to revert/toggle an already used option (indicating to the player there's still more dialogue for that option, or to permanently unmark the "quit conversation" option as used).

    I'm using Unity UI, have the "Mark options already used" toggled on and am not using any scripts to trigger the buttons.

    Couldn't find anything about this in the manual or other posts.

  • You can do it - but only through script. A dialogue option's "already used" state can be accessed from its hasBeenChosen variable.

    To access a specific dialogue option, you can use the Conversation component's GetOptionWithID function. For example, this script can be used to "unmark" a given option:

    using UnityEngine;
    using AC;
    
    public class OptionUnmarker : MonoBehaviour
    {
    
        public Conversation conversation;
    
        public void UnmarkOption (int id)
        {
            conversation.GetOptionWithID (id).hasBeenChosen = false;
        }
    
    }
    

    To use it, copy/paste into a C# script named OptionUnmarker, attach to your Conversation, and fill in its Inspector. You can then use the Object: Send message or Object: Call event Action to run its "UnmarkOption" function, passing in the ID of the option you want to un-mark as a parameter.

  • edited August 2023

    Perfect, thanks a bunch! :)

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.