User:Thingy Person

The Beyond Skyrim Wiki — Hosted by UESP
Revision as of 08:48, 26 April 2021 by Thingy Person (talk | contribs) (Blocking Branches and Forcegreets)
Jump to: navigation, search

WIP Article: Dialogue Systems for Writers


Dialogue Branches

A large portion of dialogue that NPCs have in Skyrim occurs during conversation with the Player and is largely accessed through the dialogue menu. This is known as Player Dialogue, and dialogue of this kind is structured in Branches.

By default, when the Player initiates dialogue with an NPC, the subsequent dialogue menu will be a collection of separate Dialogue Branches that were written for this NPC, each option being its own Branch. In order for a Branch to appear in this way, it must be of a specific type, namely a Top-Level Branch.

A characteristic of Top-Level Branches is that they begin with a dialogue option by the Player, and not a line from the NPC. This allows many Branches from many different sources to be available side-by-side, without the NPC pushing the conversation in a specific direction with their opening line.

Here is a hypothetical NPC document. Player dialogue options are in bold. Each top-level entry is the beginning of a Top-Level Branch. In this example, the Branches represent typical subjects that a player might inquire into in non-quest related dialogue.

1. How long have you been working here?
1.1. I've been working these mines ever since the Forebears set foot in this place!
1.2. Back then, this place was a frontier. Well, in some ways, it still is.
2. Do you have any family?
2.1. Yeah, a daughter, back home in Stoudholm. Better keep her far away from a place like this.
2.1.1. Does your daughter live alone?
2.1.1.1. My mom and pop look after her. She's too young to be by herself.

Note that 2.1.1. mentions the daughter, and therefore has to follow 2.2. Here, it is simply dialogue continuing within the same Branch, which has expanded into a small dialogue tree. Once the Player has entered into such a tree, they will no longer see the Top-Level dialogue options until they exit dialogue or reach the end of the Branch, at which point the Top-Level menu will be shown again.

Although this example is small, Branches can become so elaborate that the Player will have a bad time treading through all of the dialogue buried in them. If needed, the dialogue can be broken up by splitting part of it into its own Branch. But here, it wouldn't make sense to ask about the NPC's daughter if we haven't heard about her yet! One tool that a writer can use here is to have one piece of dialogue unlock a Top-Level Branch:

1. How long have you been working here?
1.1. I've been working these mines ever since the Forebears set foot in this place!
1.2. Back then, this place was a frontier. Well, in some ways, it still is.
2. Do you have any family?
2.1. Yeah, a daughter, back home in Stoudholm. Better keep her far away from a place like this. (unlocks 3)
3. You mentioned a daughter. Does she live alone?
3.1. My mom and pop look after her. She's too young to be by herself.

Note how I rewrote 3. to be more natural as a conversation starter, since it no longer has to follow directly after 2.1.

Implementer's note: "Unlocked" branches in non-quest related dialogue are usually implemented by having the unlocking dialogue set a stage in the settlement's general dialogue quest. The unlocked branch will be conditioned on that stage using GetStageDone. The quest will usually have a bunch of these stages; document them by describing what they do in the journal entry text.

As mentioned before, the dialogue menu is a collection of Top-Level Branches from various sources. If this NPC is currently involved in a quest, then they may have some active dialogue related to it, and the in-game dialogue menu will look like this:

  • I found the pickaxe you were looking for.
  • How long have you been working here?
  • Do you have any family?
  • You mentioned a daughter. Does she live alone?

The display order of Branches is determined by a number called Priority which is configured by the implementer, and standard practice is to give quests (in the narrow sense of the word) a higher Priority than non-quest dialogue, hence it appears at the top of the list.

Greetings

Although Top-Level Branches always begin with a dialogue option selected by the Player, the conversation itself will still be opened with a line from the NPC. That is because a Greeting (sometimes also referred to as a Hello) will run first.

Greetings are actually a separate system from Branches. By default, a Greeting can run when the Player initiates dialogue as well as when the Player just walks past, although it can be restricted to one or the other if needed (in practice, this distinction is rarely made). Greetings are located in a stack that is separate from the Branches. Like Branches, Greetings can be pooled from different sources and conditioned on a variety of factors.

Greetings
  1. Welcome, traveler. What brings you to these mines?
  2. If you mine anything of value, it's yours to keep.
  3. My back's acting up...
Dialogue
1. How long have you been working here?
1.1. (etc)

Greetings can be in a fixed or in a random order. In non-quest dialogue, they are typically in a fixed order, and are written with this in mind. Note how the more important, introductory Greeting comes first, followed by ones that are just flavor text. Greetings of this kind will be implemented with a reset timer so that each one will only run once until some amount of in-game time has passed, at which point it can run again. Although the NPC may seem like an amnesiac for bidding the Player welcome a second time, this is common practice and helps keep custom dialogue active in the game. When all Greetings are on a timer, the NPC will fall back to generic dialogue (see below).

Implementer's note: A value for the reset timer which is consistent with vanilla seems to be 8 hours.

Instead of a reset timer, a line can be set to run only once in the entire playthrough. This is sometimes used for an initial Greeting if the NPC formally introduces themselves, but it is likely to go over the Player's head, as it passes quickly and will never be heard again.

Greetings
  1. Abak Lendrian. Miner, father, widower. (say once)
  2. Welcome, traveler. What brings you to these mines?
  3. If you mine anything of value, it's yours to keep.
  4. My back's acting up...

Although a Greeting can technically consist of multiple lines, this is not desired, because the Player can select an option in the dialogue menu before the second line has had a chance to come up. Consider this example, where the second Greeting is instead a followup line of the first:

Greetings
1. Welcome, traveler. What brings you to these mines?
1.1. If you mine anything of value, it's yours to keep.
2. My back's acting up...

At the start of 1., the dialogue menu is available. If the Player does nothing for a while, 1. will finish and 1.1. will be spoken. If the Player is quick enough to select a dialogue option while 1. is still running, however, 1.1. will not run and is put on the same reset timer as 1., causing the Player to miss out on this line. Compounding this is that multi-line Greetings do not appear in Vanilla and the Player is therefore not trained to wait for them. For these reasons, Greetings with multiple lines are not idiomatic to Skyrim and shouldn't be used.

One common pitfall is to write the dialogue options as though they are replies to a Greeting which the NPC is assumed to speak first. Consider this broken example:

1. A traveler! What are you looking for in these mines?
1.1. Nothing, but I was wondering how long you've been working here.
1.1.1. I've been working these mines ever since the Forebears set foot in this place!
1.1.2. Back then, this place was a frontier. Well, in some ways, it still is.
1.2. Just taking a look. Do you have any family here?
1.2.1. (etc)

As mentioned before, 1. will typically be a Greeting with a reset timer. After it has been spoken once, the next conversation will open with a different Greeting, and 1.1. and 2.2. will be non sequiturs. Imagine the flow of conversation if a generic Greeting is active:

"Hello." "Nothing, but I was wondering how long you've been working here."

Moreover, when the end of a Branch is reached, the top-level dialogue menu returns, leading to more non sequiturs:

"Back then, this place was a frontier. Well, in some ways, it still is." "Just taking a look. Do you have any family here?"

Although it is possible to force 1. to always open the conversation, this will feel extremely repetitive, as it will seem as though the exact same conversation is repeating itself over and over. The proper solution here is to split 1. into one or more greetings, and rewrite 1.1. and 1.2. to be more general, so that they no longer require a specific line to precede them. The result of this would be the correct examples further above.

As a final note, there are NPCs whose entire unique dialogue consists of a short stack of Greetings. This means they will simply say a line when spoken to, without a dialogue menu opening up (although a dialogue menu can still appear if there is quest-related dialogue). It is good to have a healthy number of such NPCs in a settlement, as they can add a lot of flavor without bogging the player down in endless dialogue trees. For proof of the impact that such minimalist dialogue can have, look no further than Nazeem, who became one of the most infamous NPCs in Skyrim with just this:

Greetings
1. Do you get to the Cloud District very often? Oh, what am I saying - of course you don't.
2. I actually advise the Jarl on political matters. My input is invaluable, of course. But this is all probably a bit over your head.
3. Oh, it took years, but I earned my way to the top. I own Chillfurrow Farm, you see. Very successful business. Obviously.

Farewells

Similarly to Greetings, NPCs have a stack of Farewells (also known as Goodbyes) that can run when the player exits dialogue. Just like Greetings, these are pooled from various sources and can have various conditions on them, and Farewells in unique NPC dialogue tend to have a fixed order and reset timers.

Farewells
1. Thanks again for finding my pickaxe! (if "Find the Pickaxe" is completed)
2. Watch yourself in these mines, now. (if inside the mine)
3. Don't be a stranger, stranger.

Like with Greetings, a Farewell can technically have multiple lines, but this is again not idiomatic to Skyrim and is bad practice. As soon as the first line begins, the dialogue menu closes, and the Player is free to run away or re-enter dialogue with the NPC before the second line has had a change to begin.

NPCs like Nazeem who have only Greetings and no Dialogue Branches also will not say any Farewells (except in the rare and temporary case where there happens to be quest-related dialogue), so it doesn't make much sense to write custom Farewells for them.

It is actually possible to end dialogue on a regular dialogue line from a Branch rather than with a Farewell. This is done whenever it doesn't make much sense for the conversation to continue, like when the Player accepts a quest and is sent off to go do it, or if they have just said something rude:

1. How long have you been working here?
1.1. I've been working these mines ever since the Forebears set foot in this place!
1.2. Back then, this place was a frontier. Well, in some ways, it still is.
1.2.1. That's impressive. You must be very resilient.
1.2.1.1. Thanks, stranger! It's always nice to get proper recognition for my diligence.
1.2.1.2. It's taken its toll on me, but I've never once regretted coming here.
1.2.2. It's been a while. I bet you're just about ready to hit the retirement home.
1.2.2.1. Hmph! If you've got nothing nice to say, then don't say anything at all. (exit dialogue)

1.2.1.2. will return the Player to the top-level dialogue menu, whereas 1.2.2.1. will close the dialogue menu altogether. Note that the player can still re-initiate dialogue right after, so these kinds of lines shouldn't be so hostile that it is no longer believable to have a normal conversation afterwards. It is possible to have the NPC refuse to speak to the Player and say some rude one-liners instead, but this is an extreme measure that is typically reserved for bad endings of quests.

Dialogue lines that exit dialogue have the same caveats as with Farewells regarding multiple lines, so 1.2.2.1. was deliberately written to be just one line. Situations like this should be avoided:

1.2.2. It's been a while. I bet you're just about ready to hit the retirement home.
1.2.2.1. What did you just say about me, you little s'wit?
1.2.2.2. I'll have you know I graduated top of my class in the Aubere Academy, and I've been involved in numerous secret raids on Totambu.
1.2.2.3. (etc) (exit dialogue)

Notes on generic dialogue

Generic dialogue has been mentioned a few times up to this point. It consists of default dialogue with the lowest Priority that is shared by all NPCs, for when no unique lines are present or currently valid. The order of these lines is random, and they have no reset timer. This includes Greetings and Farewells, but a plethora of other kinds of dialogue as well. For an overview, see the UESP page on Generic Dialogue.

The creation of generic dialogue is a major undertaking for any project and is not within the scope of this article. It can only be done once Voice Types have been decided on, which in turn requires clarity on the number and demographics of the NPCs comprising a planned release, and the expected number of voice actors to be cast.

One thing that should be addressed in this article is that unique NPC dialogue must not itself be so generic that it is made redundant by the actual Generic Dialogue. Consider these generic greetings in Vanilla:

Greetings
1. Hmm?
2. Need something?
3. Yes?

Now, instead of the unique Greetings given to our NPC in the previous sections, imagine if their Greetings had been these:

Greetings
1. Hello.
2. What is it?
3. Hmm?

There is no point to writing and recording these for any particular NPC, as this kind of filler dialogue is already provided by the Generic Dialogue. Unique Greetings should have some flavor to them that is specific to the NPC in question, as in the previous examples. If this is, for whatever reason, difficult, then it is also perfectly acceptable not to write any unique Greetings for the NPC at all, in which case they will say only Generic greetings.

Although we have only discussed custom Greetings and Farewells, it is possible to write custom lines for any category of Generic Dialogue, but this is rare in practice. One kind of dialogue for which it might make sense to do this is combat taunts (lines barked at an opponent in the middle of combat).

Blocking Branches and Forcegreets

Examples from Idolaf Battle-Born and Maul. Sometimes used in combination with greetings: example from Jaree-Ra

Earlier, we noted that Top-Level Branches always begin with a dialogue option chosen by the Player. However, there are different kinds of Branches where the dialogue tree is initiated by the NPC. These are Blocking Branches, and Branches activated via Forcegreet.

A Branch of either of these types will override and disable all other Player Dialogue from this NPC as long as its conditions are valid. Thus, they are used sparingly, typically within a specific quest stage.

If a Forcegreet is specified, the NPC will approach the Player when they come near and forcibly initiate dialogue:

1. You there! What took you so long? Corsairs have started attacking the mine while you were looking for my pickaxe! (Forcegreet)
1.1. How was I supposed to know this would happen?
1.1.1. Well, no matter. You can help me fight them off now. I'll take back my pickaxe as a weapon. (pickaxe removed) (exit dialogue and initiate combat)

Forcegreets run counter to the freeform nature of Skyrim, which tries to avoid forcing the Player into any specific action whenever possible. Here, the Forcegreet was necessary, because the Player would miss out on exposition and gameplay (a pickaxe-toting companion) if they were able to just run past the NPC and clear out the Corsairs by themselves.

If you want a dialogue tree to be initiated by the NPC for whatever reason (such as flavor), but can't justify a Forcegreet, then a Blocking Branch may suffice. This works similarly to a Forcegreet, except it will activate when the Player initiates dialogue with the NPC rather than being forced into it. Imagine if, instead of Corsairs attacking, the quest simply has the Player return the pickaxe to an overexcited miner:

1. You're back! And the rustle is unmistakable - you're carrying my pickaxe! (blocking dialogue)
1.1. That's right. Here you go.
1.1.1. By Zenithar, you've found it! Thank you so much, friend. Here is your reward. (remove pickaxe, give small leveled gold)

It would have been just as functional to write this differently as a Top-Level Branch, which is initiated by a dialogue option in the Top-Level menu. But moderate use of these Blocking Branches can add flavor.

The examples above are quest-related. However, there are instances of Forcegreets and Blocking Branches in Vanilla that are part of non-quest dialogue. For lack of other conditions, these are only triggered on the first encounter, after which they will not run again, and regular dialogue takes over.

Examples of Forcegreets include the gate guards outside Whiterun and Riften, which require persuasion or bribery before the Player is given entry. Again, Forcegreets were justifiably used here because the Player shouldn't simply cruise past and into the city.

Blocking Branches are more plentiful, and are typically done for flavor on the first meeting. Consider this encounter with Idolaf Battle-Born which, incidentally, is his only unique dialogue, after which he will revert to generic greetings:

1. Gray-Mane or Battle-Born? (blocking dialogue)
1.1. What?
1.2.1. Got stones in your ears? I asked what side you're on, Gray-Mane or Battle-Born! (back to top. unlocks 1.4.)
1.2. Battle-Born.
1.2.1. Then I say well met, friend. I could tell you were a sharp one the moment I laid eyes on you. (exit dialogue, increase disposition)
1.3. Grey-Mane.
1.3.1. Then you're either a Stormcloak sympathizer or a fool. Either way, you're no friend of mine. (exit dialogue, decrease disposition)
1.4. I don't know what you're asking.
1.4.1. New in town, huh? Whiterun's got two clans, both old and both respected.
1.4.2. Difference is, the Gray-Manes turned their backs on the Empire and we Battle-Borns stayed loyal.
1.4.3. So I'll ask again, Gray-Mane or Battle-Born? (back to top. unlocks 1.5.)
1.5. I'm not picking sides.
1.5.1. Sooner or later, we all have to choose a side. (exit dialogue)
Implementer's note: Here, the unlocks aren't done by scripting quest stages, but by configuring the dialogue links appropriately, since these are linked topics rather than Top-Level Branches. Although 1.2.1., 1.3.1. and 1.5.1. do not have the Goodbye flag set, they still close the dialogue menu since they link to no other topic and Idolaf has no Top-Level Branches.

One crucial point of note is that these Blocking Branches should be kept short, not be excessively branching, and not include dialogue that is essential world building for the Player. Consider this broken example where the NPC is the mayor of a town:

1. You there! Haven't seen you before in my town. What is your purpose here? (Blocking dialogue on first meeting)
1.1. Nothing, just passing through.
1.1.1. That's what they all say. I've got my eye on you. (exit dialogue)
1.2. Nothing but trouble, I assure you.
1.2.1. Don't play sassy with me. That's a surefire way to end up in the brig. (exit dialogue)
1.3. I just saw this town and wondered what it was like.
1.3.1. This town, stranger, is the hallowed abode of Stoudholm, haven for Kings and fishermen alike.
1.3.2. It has sometimes been described as being situated in the armpit of High Rock, a moniker which I personally take pride in.
1.3.3. Rest assured that we are a proud and prosperous community, and will do anything to keep it that way.
1.4. I came here looking for work.
1.4.1. (etc)

The biggest problem is that selecting either 1.1. or 1.2. will disable this entire dialogue tree for good, including 1.3. and 1.4. which are important pieces of dialogue to establish lore and direct the Player toward quests, respectively. Furthermore, it is not clear what happens after 1.3.3.; does it end dialogue and disable the tree, even though the dialogue doesn't suggest a sudden end to the conversation? Or does it bring up all the dialogue options again (as though it were a Top-Level menu, which it is not), leading to non sequiturs?

In the section on Greetings, we addressed such a situation by rewriting all the dialogue options so that they don't expect to follow a specific line anymore. This is appropriate for 1.3. and 1.4., but not for 1.1. and 1.2., which only make sense within the context of the Mayor calling the Player out on the first meeting. The true solution here is to split 1.1. and 1.2. into their own Blocking Branch and have the rest rewritten as Top-Level Branches, with a regular stack of greetings added for completeness. The guidelines for formatting and labeling this depend on the project in question.

Blocking dialogue on first meeting
1. You there! Haven't seen you before in my town. What is your purpose here?
1.1. Nothing, just passing through.
1.1.1. That's what they all say. I've got my eye on you. (to standard dialogue)
1.2. Nothing but trouble, I assure you.
1.2.1. Don't play sassy with me. That's a surefire way to end up in the brig. (to standard dialogue)
Greetings
1. I hope you find yourself well in Stoudholm, traveler.
2. If there is any sign of trouble, tell the Guard right away.
3. How can I be of service?
Standard dialogue
1. What can you tell me about this town?
1.1. This town, stranger, is the hallowed abode of Stoudholm, haven for Kings and fishermen alike.
1.2. It has sometimes been described as being situated in the armpit of High Rock, a moniker which I personally take pride in.
1.3. Rest assured that we are a proud and prosperous community, and will do anything to keep it that way.
2. Is there any work available?
2.1. (etc)

There is one additional challenge with Blocking Branches as opposed to Forcegreets, which is that the NPC will still speak Greetings drawn from their regular stack if the Player walks past. In many cases, this is not problematic, but sometimes, it will be very jarring to have a normal Greeting ("Need something?") followed by a totally different tone as soon as the Player initiates dialogue ("Well, what have we here? A newcomer in town!")

Implementer's note: By default, the first line in a Blocking Branch will actually also be spoken when the Player walks past, making it functionally indistinguishable from a Greeting. However, this behavior should almost always be conditioned out using IsInDialogueWithPlayer, as it is janky otherwise.

If the first line of a Blocking Branch is at odds with the NPC's Greetings at that time (whether unique or generic), then the solution is to provide one or more custom Greetings which are valid at the same time as the Blocking Branch. One example from Vanilla is Jaree-Ra:

Walkaways

Example from Maul


Gameplay dialogue

Barter, rent room, trainers, rumors and why not to be too creative with them


Scenes

Random conversations vs major establishers