Changing NPC Conversations

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
YeeHonk
Posts: 6
Joined: Sat May 22, 2021 2:40 pm

Changing NPC Conversations

Post by YeeHonk »

I'm looking for advice on how to handle NPC conversations similar to games like Rune Factory 4, Stardew Valley, etc.

I have a calender ingame and I would like each day for the NPCs to say something different to keep the world feeling lively. Has anyone successfully implemented such a concept with Dialogue System?
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing NPC Conversations

Post by Tony Li »

Hi,

One way is to record the current day in a variable:

Code: Select all

DialogueLua.SetVariable("Day", 14); // C# code
and branch your conversation based on that variable:

dayVariableConversation.png
dayVariableConversation.png (43.43 KiB) Viewed 319 times

You can also vary the conversation using the RandomElement() function in your Dialogue Text:
  • Dialogue Text: "[lua(RandomElement("You've been here a while.|Hi, old timer.|Still here, eh?")]"

You can also add variables and conditions for other world info such as the current weather, or special events.

To change the order in which links are checked, inspect the originating node (e.g., the <START> node in the screenshot above). The "Links To:" section at the bottom shows the order in which they'll be checked. You can also change the priorities of the link arrows to specify which ones take precedence.
YeeHonk
Posts: 6
Joined: Sat May 22, 2021 2:40 pm

Re: Changing NPC Conversations

Post by YeeHonk »

Thank you for the advice with screenshots Tony! You are the best!
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing NPC Conversations

Post by Tony Li »

Happy to help!
Post Reply