Event Tutorial - 04 - NPC Dialogue


Before we plot down what the characters could possibly say, we'll play around with one more feature of the engine - idiolects. So we're not only going to be writing the words the NPC speaks, but also choosing ways for the game to present it using filters that can alter the text. In particular, we'll be using the recently written drunk filters for the drunk characters!

1) Setting up idiolects

So, there's a bunch of files that exist already that handle idiolects. In particular, there is a master list of idiolects, accessible by attribute in the form of the data\filters\filter.list file, as well as the automata\npcs\generic\data\rc-idiolect file, which also handles issues of rarity.


We can set this up in tree note like this:


That can be a bit complicated, but if you take a moment to study the API and non-terminal syntax, it should make sense. The biggest thing I might need to point out is the usage of :, it's just a way of escaping some characters. When you are assigning a string, you can use it to treat everything after it as an unparsable text. The typical usage is with the p (print) token.

This will give us an idiolect, mostly an empty one, but with a pretty high probability, it might be something else. And if the character is drunk, it will result in a drunk filter. Now, since some of the choices are accents, the question can arise, if idiolects can be stacked, like if we can have a drunk welsh filter. The answer is that yes, filters can be stacked, but to balance their usage I've decided not to do that.

In any case, it's now time for us to write the wrapper for the dialogue segment:


Small correction: it should be just [colour], not generic-[colour]. This slipped my attention during testing.

This presents the correct way of running some text through the filter as well as the proper formatting for a speech segment. Note the position of the quotation marks, the use of colour and the application of the filter.

2) Writing dialogue

This is really all for the preparations, we can now get to the writing.


Not much new here. Because up next we want to refer differently to what the man says depending if he asks a question or not, we introduce an additional tag to the context, but only if he asks a question. We can negate its presence for the alternate case.

From here we can throw an extra bit of text into the mix, finalising what the man says. We'll use the new context tag here:


These texts might still get revised in time, but for now, they are good enough. Next up, we need to prepare our conversation tree for the impending player interaction. This basically means closing off the current text block. The conversation parser will do everything else on its own:


It also turns out that our regular grammar approach let us altogether remove one of the sketched out nodes. That's fine. It doesn't really matter in practice, but if we just compress the content of two nodes into one, we're not losing out on anything.

Next up, we set up the PC's responses and conclude the tutorial.

Get Esoteric ♥ Esoterica

Leave a comment

Log in with itch.io to leave a comment.