Randomized Conversation Selection between Linear Conversations

Announcements, support questions, and discussion for the Dialogue System.
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Randomized Conversation Selection between Linear Conversations

Post by boz »

I attached two images to give a visual to what I'm thinking.

I'm wondering what the best way to accomplish this might be, or some ways to try.

I imagine it would be something to do with a traffic controller toggling between looking for the randomized conversation starting node and looking for the next conversation in linear order?

And then once you go inside the randomize conversation choice node, it takes a list of the randomized conversations, gets 4 randomly from the list, and puts up a selection title for each one. Upon selection, it goes to the starting node of that conversation. Then the ending node leads back to the traffic controller.

How do I refer to these things and what's the best way to interact with them through the dialogue system?

Thanks for any help :D
Attachments
Randomized Event Diagram.png
Randomized Event Diagram.png (222.03 KiB) Viewed 515 times
Example Flow.png
Example Flow.png (491.03 KiB) Viewed 515 times
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Randomized Conversation Selection between Linear Conversations

Post by Tony Li »

Hi,

Make your Traffic Controller a group node. Link to two nodes, each of which could be group nodes where the Conditions on one node checks if the player came from a dialogue event and the Conditions on the other node checks if the player came from a mini dialogue.

On the node that checks if the player came from a dialogue event, use the RandomizeNextEntry() function in the Script field. Then link from this player nodes that link to your random conversations.

On the other node, link to your next dialogue event in order. You could use a variable to keep track of which event to use.
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Re: Randomized Conversation Selection between Linear Conversations

Post by boz »

Oh wow! I didn't know about RandomizeNextEntry()

But that sounds like it will lead to a random one of the entries, rather than show a selection of four options to choose the next conversation.

Maybe using the conditionals idea you mentioned above, I could link all the nodes to this node and have a list select four of them at random to turn to true? And if the other options are false it won't show them?

But I suppose that leads me back to my first question - how do I grab these conversations in script and assign them values?
Or wait, maybe I could do a boolean representation of each of the randomized conversations and use a script to set those instead?

What do you think?
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Randomized Conversation Selection between Linear Conversations

Post by Tony Li »

Good point. RandomizeNextEntry() won't be applicable for everything you need.

Maybe using variables and Conditions are the best approach. You could set them randomly so that only 4 responses will have true Conditions.

Alternatively, you could make a subclass of StandardUIMenuPanel and use it instead of the base StandardUIMenuPanel. Override ShowResponses(). When you identify that this is a menu that should only show 4 responses, only show 4. For example:

Code: Select all

public override void ShowResponses(Subtitle subtitle, Response[] responses, Transform target)
{
    var list = new List<Response>(responses);
    if (/* your condition here */)
    {
        // Shuffle list and then remove all but the first 4:
        list.Shuffle();
        for (int i = list.Count - 1; i >= 4; i--) { list.RemoveAt(i); }
    }
    base.ShowResponses(subtitle, list.ToArray(), target);
}
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Re: Randomized Conversation Selection between Linear Conversations

Post by boz »

Oooh that's good, I'm going to try that.
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Re: Randomized Conversation Selection between Linear Conversations

Post by boz »

Worked amazingly, thank you!
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Randomized Conversation Selection between Linear Conversations

Post by Tony Li »

Glad to help!
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Re: Randomized Conversation Selection between Linear Conversations

Post by boz »

Does there happen to be a fast way to remove an option from future choices after you've selected it before? I imagine that sort of thing comes up a lot.
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Randomized Conversation Selection between Linear Conversations

Post by Tony Li »

Hi,

Tick the Dialogue Manager GameObject's Other Settings > Include SimStatus. This will enable SimStatus.

Then set the response dialogue entry's Conditions field to:

Code: Select all

Dialog[thisID].SimStatus ~= "WasDisplayed"
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Re: Randomized Conversation Selection between Linear Conversations

Post by boz »

Wow, thank you. That's so much better than the convoluted blacklist thing I was trying to create to remove conversations that were set with a oneshot variable. I knew there had to be something already in the system.
Post Reply