Dialogue Tutorial
Part 6: Choice
<< Back to the Result Box <<
OK... now we're ready to look at "choice". This is a powerful feature of the dialogue editor that lets you handle questions and answers (from "yes-no" to multiple-choice riddles), Baldur's Gate-style dialogue trees, and even multi-level menus.
Yes and No
Let's start with a simple yes-no question. Across the stone bridge from the inn, there's a shack with a rather harried alchemist inside, Armand Des Cieux. He wants your help.
-
Give Armand his own "welcome" greeting. Filter it for DT_Armand Des Cieux, and for Function | Talked To PC | = | 0. It can go above or below Marie's greetings (since they're each filtered for a single NPC, they won't interfere with each other).
Welcome to my humble workshop! I'd shake your hand, but I've got my latest concoction all over them. Say, you wouldn't be interested in doing a quick errand for me, would you?
-
Add a new topic, "quick errand". Filter it for Armand, and give it this text:
I need some kresh fiber for the brew I'm testing, and I can't leave the cauldron -- it must be stirred continuously. It grows in the square just outside. I can use as much as you can get. I'm a bit short on cash, but I'll trade you potions for it. Would you run out and get me some?
-
Now for the question. Add this to the results:
Choice "Sure!", 1, "Sorry.", 2
The answers will spark two different responses from Armand, each of which will have another entry in the same topic as the question. For reasons which I'll explain in a moment, the answers must go above the question.
-
Add a new entry above the question:
Excellent! Come back quickly.
Filter it for Armand, and put this in Function/Variable: "Function | Choice | = | 1". That means that this is the response to answer 1, i.e. "Sure".
-
Add another entry above the question (before or after the "choice 1" entry, doesn't matter):
My brew will be ruined! Oh well, it's not the first time...
Filter it for Armand, and put this in Function/Variable: "Function | Choice | = | 2", since this is the response to answer 2, i.e. "Sorry".
All right, let's talk about how this works. What the "choice" result does is two things: a) allow the player to set the value of "choice" to 1 or 2, depending on what they click; and b) tell the game to rescan the same topic and stop at the first applicable entry. If the user clicked "Sure", that will be 1; if they clicked "Sorry", that will be 2.
If you put the question above the answer responses, though, this won't happen. The first applicable entry will be the question (again); that will display, and you'll never get to the two responses.
One choice: "Continue"
As you may have noticed, there's a length limit on the text field of 512 characters. Try to type beyond this, and you'll get an error message and not be able to enter any more text. What if a character has more to say than that? We can use "choice" (in this case, "no choice") to add additional text.
Pierre Lapin, the pawnbroker in the market, is a chatty fellow. Let's give him more to say about Oblivion than his neighbors.
-
Go to the Oblivion topic, and insert a new topic at the top of the list. Filter it for DT_Pierre Lapin, and give it this text:
What's it like living in Oblivion, you ask? Well, it's not much different from living in a small isolated village anywhere else. Same people, same routine, day after day. Sure, the sun never shines, and nobody ever comes here from outside... except you, of course... and Belle visits once in a while to check up on us. And there's the odd low-ranking daedra passing through. They're not much different from the city folk we used to get once in a while back in High Rock...
-
Add this to the "Result" box:
choice, "Continue", 1
-
Insert a new topic above the current one, filtered for Pierre again, and also for Function | Choice | = | 1. Give it this text:
...either looking down their noses at us or poking and prodding us like we were in some kind of a zoo. Oh, they do bring in interesting items that I can sometimes persuade them to part with for my business... not that I get much custom these days, since everybody pretty much has what they want, and nothing ever gets used up here... still, it keeps me busy. Kind of a hobby, really. I'm not boring you, am I?
-
You can keep this going indefinitely. Add this to the "Result" box:
choice, "Continue", 2
-
Insert a new topic, filtered for Pierre and for Function | Choice | = | 2. Give it this text:
Good, because I can tell you anything you want to know about the locals. A pretty nice bunch for the most part -- except Annette, of course; I've never figured out what her problem is. And that Mercutio fellow upstairs at the inn... he's a nutter, used to be cozy with our mayor until she figured out that he's only interested in himself. But the others are OK. Take Marie -- she'll heal anybody without charge. How she stays in business, I don't know. Speaking of business, are you interested in buying?
OK, that should be enough to give you the idea. Now when the game displays Pierre's first speech (at the bottom of the list), there will be a single choice ("Continue") for the player to click. Click that, and "choice" gets set to 1. The game starts at the top of the topic again and finds Pierre's second monologue. Once more the player is forced to click "Continue", "choice" gets set to 2, and you will be treated to the third speech. Note that you have to use a different "choice" number for each one, so that the correct continuation is displayed.
Multiple Choice
OK, now let's try additional choices, and finish up the Kreshweed Quest. If you greet Armand while carrying a kresh fiber, he will take it and offer you a choice of potions in exchange -- or no potion, which we'll treat as the default case, putting it after the others.
I'm going to start laying out the dialogue entries in tabular form, with Text, Conditions, and Results for each one. Note that the table is in the order you should enter them, which is NOT the order in which they should appear in the info/response table; normally you work from the bottom up.
You can enter these into the Info/Response table more efficiently by right-clicking and using "copy" for the last four entries (the choice responses), and editing the conditions and results as appropriate.
|
Greeting1 (below Armand's welcome)
|
|
Text
|
Hello again. Ah! You have my kreshweed!
|
|
Conditions
|
ID: DT_Armand Des Cieux
F/V: Item | ingred_kresh_fiber_01 | >= | 1
|
|
Result
|
|
|
Topic: "kreshweed" (new topic)
|
|
Text
|
Wonderful! I'll take it. What kind of potion would you like in return?
|
|
Conditions
|
ID: DT_Armand Des Cieux
F/V: Item | ingred_kresh_fiber_01 | >= | 1
|
|
Result
|
player->removeItem, "ingred_kresh_fiber_01", 1
choice, "levitation", 1, "night eye", 2, "water walking", 3, "nothing, thanks", 4
|
|
Topic: kreshweed (Response 1: above "wonderful")
|
|
Text
|
Good choice -- here you are!
|
|
Conditions
|
ID: DT_Armand Des Cieux
F/V: Function | Choice | = | 1
|
|
Result
|
player->addItem, "p_levitation_s", 1
|
|
Topic: kreshweed (Response 2: above "wonderful")
|
|
Text
|
Good choice -- here you are!
|
|
Conditions
|
ID: DT_Armand Des Cieux
F/V: Function | Choice | = | 2
|
|
Result
|
player->addItem, "p_night-eye_s", 1
|
|
Topic: kreshweed (Response 3: above "wonderful")
|
|
Text
|
Good choice -- here you are!
|
|
Conditions
|
ID: DT_Armand Des Cieux
F/V: Function | Choice | = | 3
|
|
Result
|
player->addItem, "p_water_walking_s", 1
|
|
Topic: kreshweed (Default response: above "wonderful", below others)
|
|
Text
|
Well, I must say that's very generous.
|
|
Conditions
|
ID: DT_Armand Des Cieux
F/V: Function | Choice | > | 3
|
|
Result
|
|
Save and test. Note that you can keep clicking the "kreshweed" topic and giving Armand kresh fiber as long as you have any; when you run out, the topic will disappear (because of the item check on the topic).
Branching dialogue
The final example is going to be more complicated. Some Morrowind players have expressed dissatisfaction with the "topic-chaining" dialogue style; they prefer the more traditional RPG style, which involves the player choosing a response to the NPC, thus giving them a chance to "role-play" their character. In fact this kind of dialogue can be straightforwardly implemented in Morrowind's dialogue system, using the "choice" function.
The following example gives some dialogue to Mercutio, who is in the second room on the second floor of the Midnight Star Inn. The player has three possible responses to everything Mercutio says, reflecting a "good", "neutral", or "evil" reaction. In turn, Mercutio responds differently to these three types of player reactions. However, there is some convergence; choosing the neutral response (some variant of "I don't care") will always end the conversation immediately, for instance. That helps keep this dialogue manageable, with only 9 instead of 27 entries for three conversational turns.
Once more, the dialogue is presented in a table in the order in which you should enter it; but this is not the same order in which it appears in the Info/Response table. Again, you will be starting at the bottom and working up (though in fact, since all the choices have unique identifiers, the only ordering that is crucial is that the initial entry be at the bottom with all the choices above it).
|
Greeting1 (below Sanctus greeting)
|
|
Text
|
Ah! a visitor here in no man's land! An odd occurrence... but one that may serve my purposes. Let me tell you my sad story.
|
|
Conditions
|
ID: DT_Mercutio
F/V: Function | Talked To PC | = | 0
|
|
Result
|
|
|
Topic: "sad story" (new topic)
|
|
Text
|
Yes, very sad indeed. The tragic figure you see before you was once the consort of the powerful, the beautiful, the cruel mage Bellefigure.
|
|
Conditions
|
ID: DT_Mercutio
|
|
Result
|
choice "How interesting! Please continue!", 1, "This isn't really any of my business...", 2, "This should be good for a few laughs.", 3
|
|
Choice 1 ("good" response, continues)
|
|
Text
|
Ah, thank you for your concern... the others here shun me or laugh at me... now where was I?
|
|
Conditions
|
ID: DT_Mercutio
F/V: Function | Choice | = | 1
|
|
Result
|
choice, "Continue", 4
|
|
Choice 2 (ends conversation)
|
|
Text
|
I'm sorry to have bored you. Goodbye.
|
|
Conditions
|
ID: DT_Mercutio
F/V: Function | Choice | = | 2
|
|
Result
|
goodbye
|
|
Choice 3 ("evil" response, continues)
|
|
Text
|
I assure you, %PCRace, you won't be laughing when I have finished my tale.
|
|
Conditions
|
ID: DT_Mercutio
F/V: Function | Choice | = | 3
|
|
Result
|
choice, "Continue", 4
|
|
Choice 4 (continuation of story)
|
|
Text
|
Yes, she was once mine, until her obsession with the cursed Sheogorath began to draw her away from me. Gradually she began staying out later and later, coming home at dawn flushed and firy from her studies and experiments. Finally she stopped coming home altogether. Would you believe that her thirst for power began to eclipse her passion for me?
|
|
Conditions
|
ID: DT_Mercutio
F/V: Function | Choice | = | 4
|
|
Result
|
choice, "Surely not! Unimaginable!", 5, "I think I've heard enough... I'm out of here...", 2, "Smart girl!", 6
|
|
Choice 5 ("good" response, continues)
|
|
Text
|
I see you understand me... Let me go on.
|
|
Conditions
|
ID: DT_Mercutio
F/V: Function | Choice | = | 5
|
|
Result
|
choice, "Continue", 7
|
|
Choice 6 ("evil" response, continues)
|
|
Text
|
No! You don't understand! It was the failure of her devotion that led to the marooning of Neverland! Let me tell you the rest...
|
|
Conditions
|
ID: DT_Mercutio
F/V: Function | Choice | = | 6
|
|
Result
|
choice, "Continue", 7
|
|
Choice 7 (continuation of story, quest proposed)
|
|
Text
|
Eventually she made the terrible pact of which you have perhaps heard... vowing to obliterate this village, she instead buried it here, and I-- I am consigned to pass the weary days surrounded by riff-raff in the middle of nowhere, while she flaunts her immortality among the living! It would have been better if she had simply used a fireball to incinerate us all. Now, stranger, will you help me gain my revenge?
|
|
Conditions
|
ID: DT_Mercutio
F/V: Function | Choice | = | 7
|
|
Result
|
choice, "Revenge? I'll have no part of this!", 2, "This really doesn't sound like my problem.", 2, "Aha! Now you're talking! Who do we hurt?", 8
|
|
Choice 8 ("evil" response, conclusion)
|
|
Text
|
Excellent! At last I have found a champion! But hush... I don't want anyone to overhear my plan. Meet me at the top of the inn tower; we'll discuss it there, farther from the ears of those sheep downstairs.
|
|
Conditions
|
ID: DT_Mercutio
F/V: Function | Choice | = | 8
|
|
Result
|
playSound "mysticism hit"
positionCell, -115, -1064, 450, 135, "Neverland, Midnight Star Inn"
|
As you will have noticed if you followed this example through to the end, a player who takes the "neutral" path falls out of the dialogue immediately (winding up at Choice 2, which results in "Goodbye"); the "good" and "evil" paths continue in parallel until the end, when the "good" player also goes to Choice 2, and only the "evil" player makes it to Choice 8, at which point Mercutio teleports to another location.
Of course this is only one way of doing it; you can set up the flow any way you want.
We'll finish Mercutio's story in the Quests section.