Forum rules - please read before posting.

Conversation with no dialogue options remaining

I have hundreds of conversations that have multiple dialogue option each. These dialogue options are disabled by default once they have been chosen.

I want to have a pop-up that says "All questions have been asked" when the player triggers a conversation that's had all of its dialoge options exhausted. How would I go about doing this?

Comments

  • The Converation script's AllOptionsBeenChosen function can be used to determine this.

    This can be run when a Conversation begins via the OnStartConversation event, and then made to run an ActionList that displays a Menu popup.

    Example script, attached to the Conversation:

    using UnityEngine;
    using AC;
    
    public class ExhaustedConversationCheck : MonoBehaviour
    {
    
        public ActionListAsset actionList;
    
        void OnEnable () { EventManager.OnStartConversation += OnStartConversation; }
        void OnDisable () { EventManager.OnStartConversation -= OnStartConversation; }
    
        void OnStartConversation (Conversation conversation)
        {
            if (conversation.gameObject == gameObject)
            {
                if (conversation.AllOptionsBeenChosen (true))
                {
                    // All options chosen
                    actionList.Interact ();
                }
            }
        }
    
    }
    
  • Perfect, thank you so much, Chris!

  • Actually, I think the GetCount() function may be better as sometimes some options are disabled rather than being exhausted - that's my fault for explaining it wrong!

    So basically it would check if any visible options are showing and if not it would then run an actionlist.

    Do you know a demo script for that at all please, Chris?

  • The GetNumEnabledOptions function - in place of AllOptionsBeenChosen - will check that.

  • How would I write this in the code?

  • Replace:

    if (conversation.AllOptionsBeenChosen (true))
    

    with:

    if (conversation.GetNumEnabledOptions () == 0)
    
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.