×
Меню
Индекс

TES CS Choice

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.
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.
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.
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.