Page 1 of 1

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

Posted: Thu Mar 28, 2019 11:07 pm
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

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

Posted: Fri Mar 29, 2019 4:10 am
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

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

Posted: Fri Mar 29, 2019 9:28 am
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.