Random dialogue in conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Random dialogue in conversation

Post by lostmushroom »

Hey, I'm trying something out in unity and I want to see if it can be done with dialogue system.

The idea is for the player to be in one continuous 'conversation', which will give them random dialogue prompts. They then respond to them by making choices. There will be multiple dialogue prompts such as 'go into the cave?', 'eat the mushroom?', etc. I would like it to pick them at random.

Basically it's a game where you have to avoid dying by making the right choices.

I also want to have some stats that have a random element of change each time you get a prompt. For example, with each prompt, you could lose between 1 and 3 points of hunger.

Does this sound like something dialogue system could do, or would it require some customizing?

Thanks :)
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random dialogue in conversation

Post by Tony Li »

Hi,

That's all pretty easy in the Dialogue System. No customization necessary.
lostmushroom wrote: Thu Aug 08, 2019 2:33 pmThe idea is for the player to be in one continuous 'conversation', which will give them random dialogue prompts. They then respond to them by making choices. There will be multiple dialogue prompts such as 'go into the cave?', 'eat the mushroom?', etc. I would like it to pick them at random.
Keep looping the conversation back to a Group node whose Script field contains RandomizeNextEntry().
lostmushroom wrote: Thu Aug 08, 2019 2:33 pmI also want to have some stats that have a random element of change each time you get a prompt. For example, with each prompt, you could lose between 1 and 3 points of hunger.
Define a variable for each stat. In a node's Script field, do something like this:

Code: Select all

Variable["Hunger"] = Variable["Hunger"] - math.random(1,3)
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Re: Random dialogue in conversation

Post by lostmushroom »

Perfect, that's exactly what I need!

Is there a way to have it skip some dialogue entries? I have a couple of nodes that are only used for setting variables, or being used as Randomizers.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random dialogue in conversation

Post by Tony Li »

Set a variable true after using those nodes, and set conditions on those nodes to require that the variable isn't true yet.
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Re: Random dialogue in conversation

Post by lostmushroom »

Sorry, I wasn't clear. I meant that I want the entry to be played, I just don't want any text to show. For example I have a dialogue entry that does nothing but check to see how many scenarios you've played so far. Even if I leave the text blank, it requires two clicks to progress. I want it to be an 'invisible' node, so to speak.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random dialogue in conversation

Post by Tony Li »

If you're using continue buttons, then in that node leave the text blank and/or set the Sequence field to: Continue()
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Re: Random dialogue in conversation

Post by lostmushroom »

Nice, that seems to be working! Thanks.

One last thing - is it possible to show variables on screen? I'd like the player to be able to see their stats.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random dialogue in conversation

Post by Tony Li »

Yup, use the [var=variable] tag in dialogue text or quest text. You can create a quest that starts active with both tracking checkboxes ticked. It will appear in the HUD. Whenever you change a variable, also put UpdateTracker() in the Script field to automatically update the HUD.
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Re: Random dialogue in conversation

Post by lostmushroom »

Okay, one last last thing :)

Can you also randomize player choices? Let's say I have a scenario where you are prompted to choose between two potions. I always want there to be only 2 choices, but for those choices to randomly pick from 4 or 5 options of potions.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random dialogue in conversation

Post by Tony Li »

See this post on randomizing player responses.
Post Reply