How to trigger a new dialogue sequence when the player revisits an NPC?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Uzzi2018
Posts: 1
Joined: Thu Mar 28, 2019 10:28 pm

How to trigger a new dialogue sequence when the player revisits an NPC?

Post by Uzzi2018 »

Hello all!
My question is regarding when the player revisits an NPC. We would like the NPC to say something different the second time the player visits her. (Sidenote: I'm very new to DS. Answers that simplify and break down the process would be most helpful).

Below you can see an image of what we are trying to do. Ideal, when the player comes back to the NPC, I would like to trigger the second string of text on the right without repeating what was already said (in the first string on the left). Thank you in advance for your help :)
Image
Attachments
image.png
image.png (44.38 KiB) Viewed 531 times
DragoonHP
Posts: 62
Joined: Tue Jan 15, 2019 8:17 am

Re: How to trigger a new dialogue sequence when the player revisits an NPC?

Post by DragoonHP »

You can do it by using variable.

In the Script field of "Stay if you..." entry, put something like Variable["visited_weaver_once"] = true
Then in the Condition field of "Perhaps I can...", put Variable["visited_weaver_once"] == true

And in Condition field of "May this be...", put Variable["visited_weaver_once"] == false
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to trigger a new dialogue sequence when the player revisits an NPC?

Post by Tony Li »

DragoonHP said it perfectly. I wish this forum software had a "like" button.


If you're a visual learner, you can watch the related tutorial.


BTW, use the "..." button to choose variables from dropdown menus. You don't have to manually type Variable["visited_weaver_once"] = true, although you can if you prefer.

In a big project, variables can pile up quickly. One way to organize them is to put some identifying info at the front of the name, such as "Weaver.visited". (Example: Variable["Weaver.visited"] = true) This way you can have variables such as:
  • Weaver.visited
  • Baker.visited
  • Farmer.visited, etc.
Then you can sort them alphabetically if you want. This is nice if you end up with other Weaver-related variables such as Weaver.insulted, Weaver.taughtSpinning, Weaver.knowsPlayersSecret, etc. They end up grouped together.

Alternatively, you can add these as custom fields to each actor. So the Weaver actor could have custom fields "visited", "insulted", etc. It keeps the variables list shorter. But personally I like to be able to see all of the variables in one place for a clear overview of the whole game.
Post Reply