Page 1 of 2

Randomized Conversation Selection between Linear Conversations

Posted: Fri Oct 20, 2023 1:07 am
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

Re: Randomized Conversation Selection between Linear Conversations

Posted: Fri Oct 20, 2023 8:02 am
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.

Re: Randomized Conversation Selection between Linear Conversations

Posted: Fri Oct 20, 2023 12:21 pm
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?

Re: Randomized Conversation Selection between Linear Conversations

Posted: Fri Oct 20, 2023 1:52 pm
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);
}

Re: Randomized Conversation Selection between Linear Conversations

Posted: Fri Oct 20, 2023 3:47 pm
by boz
Oooh that's good, I'm going to try that.

Re: Randomized Conversation Selection between Linear Conversations

Posted: Sat Oct 21, 2023 9:21 am
by boz
Worked amazingly, thank you!

Re: Randomized Conversation Selection between Linear Conversations

Posted: Sat Oct 21, 2023 3:42 pm
by Tony Li
Glad to help!

Re: Randomized Conversation Selection between Linear Conversations

Posted: Sun Oct 22, 2023 4:22 pm
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.

Re: Randomized Conversation Selection between Linear Conversations

Posted: Sun Oct 22, 2023 4:42 pm
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"

Re: Randomized Conversation Selection between Linear Conversations

Posted: Sun Oct 22, 2023 6:38 pm
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.