Dialogue Tutorial
Finally we get to how to do more with dialogue than just talk. You can influence the world around you by using the "result box" of the Dialogue window. This box lets you type in a mini-script that will execute each time a particular info/response entry is delivered.
I promised at the beginning that this would not be a scripting tutorial. However, the results box is where scripting and dialogue overlap, so we will necessarily get into some scripting issues. A word for those who are familiar with scripting:
|
Result Box and Scripts Result box text is both similar to and different from regular Morrowind scripts. It's similar in that it contains a list of (mostly) standard script functions to be executed one after the other. It's different in the following ways: A few functions work differently in the result box.
The result box can interact with regular scripts by starting and stopping them, and by setting and checking variables. Complex quests will usually involve interlocking scripts and dialogue. It is commonly believed (and stated in some authoritative references, including the help file) that if-statements are not allowed in the result box, but apparently that is not the case. Thanks to Argent for this basic discovery! |
For everyone else, we will be introducing several script functions that are especially useful in dialogue; but if you want to go beyond that, you can't do better than these two resources:
|
Scripting Function Resources Ghan Buri Ghan's Morrowind Scripting for Dummies. Structured as a guide, with functions divided into sections by function with ample discussion and extensive examples. MS Word document. UESP Morrowind Construction Kit Commands. Structured as an index, this is a complete alphabetical list of functions with descriptions and brief examples. Web page. Both these resources contain information not found in the official help file, and correct help file errors. |
Adding a topic explicitly
Sometimes you may want to let an NPC have a topic that may not come up in conversation. Such topics can be accessed from the in-game dialogue topic list, even when they don't appear highlighted in text. You can use the script command "AddTopic" to achieve this, either from a script or from the Results Box. Let's say that when somebody tells you about Neverland, you want to be able to ask where to buy a drink.
You can get a drink at the Midnight Star Inn.
addTopic, "buy a drink"
Now, after you've heard the Neverland topic, Neverland NPCs will tell you where you can buy a drink. Before testing, you can check the syntax of the code in your Result boxes by clicking the "Error Test Results" button.
|
Error Test Results button This button compiles all the dialogue results in the database, and displays messages corresponding to any errors. It takes a few seconds, but it's a good way to catch dialogue results problems before playtesting. |
A note on script commands used in results:
|
Implicit arguments Many script commands have an implicit argument. In the case of a script on an object, that's the thing or person the script is attached to; in the case of dialogue results, that's the NPC that speaks the dialogue. You can make a script command act on another thing or person by adding an explicit argument, as we will see later. |
So the "AddTopic" command above adds the topic to the NPC that you're talking to, since we haven't specified otherwise.
Different answers from different people
This is all very well and good if you're not IN the Midnight Star when you ask the question, but it's a little odd if you're already at the bar. Let's fix that. It's just a matter of using some of the same conditions we learned about under Greetings.
Talk to the bartender. His name is Pourboire, and he pours a mean Flin.
So far so good... except that even Pourboire is going to have this line, which just sounds dumb. We need to make another response for the man himself.
That's what I'm here for. What'll it be?
All right! We now have the following scenario for the "buy a drink" topic:
Test and make sure it works this way.
How to make friends and influence people -- or not
OK, now let's get back to the Result box. Let's say that asking about "buy a drink" gets different reactions from different townsfolk.
modDisposition 10
modDisposition 5
modDisposition -5
Test, talk to people, and see how their opinions of you change.
Setting a variable
One problem you might notice is that you can talk to the same person over and over about the topic, and their disposition keeps going up or down each time. We don't really need to worry about the people outside the bar, since the player won't be motivated to keep lowering their disposition, but we don't want the player to be able to easily get to 100 disposition with everybody in the bar. We can fix this using the same trick we learned about earlier in our discussion of the "nolore" variable.
First,
we need to make a tiny script. Don't worry, it will have nothing in it but a
variable declaration.
begin DT_DrinkScript
short DT_drinkVar
end
Save and test. You should find that you can ask about buying a drink as much as you want, but inside the bar, each person's disposition will only increase once.
Picking a fight
Annette Auxarmes is the Redguard outside of the inn. She's a little touchy. Let's give her her own private dialogue.
Looking for trouble, stranger?
Thought so -- you got it!
startCombat, player
goodbye
The first line of this puts her in combat mode, with you as her target; the second puts up "Goodbye" in the dialogue window, thus immediately terminating conversation. When you click it, she'll attack you. Unfortunately, you'll probably have to kill her -- unless she kills you first! Test this.
Acting on others
Well, this hardly seems fair. You killed her, and you hardly knew her. Let's see if we can fix that. Fortunately, there's an apothecary close by.
I saw the whole thing! You killed Annette! Yes, I know how she can get -- I don't really blame you. Fortunately, if we're quick, we can resurrect her.
Yes, living in Oblivion, my healing powers only grow stronger. Since you killed her, you owe me 50 gold for that -- thank you very much. Here goes!
player->removeItem, "Gold_001", 50
playSound, "restoration hit"
"DT_Annette Auxarmes"->resurrect
The first line takes 50 gold from the player. Using "player->" ensures this action applies to the player, not the speaker.
The second line plays a sound, so you'll know something magical is happening. (You can find a complete list of available sounds under "Gameplay/Sounds".)
The third line resurrects Annette. Again, putting her ID before the arrow ensures that the action applies to her.
It seems that the result box is fussier than the console or scripts about spacing in commands. Type the commands exactly as they are here -- they won't work if you put spaces around the arrow.
Finally, let's deal with the case where the player doesn't have 50 gold. We don't really want Annette to stay dead, so let's provide an alternative.
Yes, living in Oblivion, my healing powers only grow stronger. I see you're destitute, so I'll do this for free -- but don't expect me to resurrect YOU if something happens. Here goes!
Save and test. You may notice that if you talk to Marie again, she still seems to think Annette is dead... apparently the "Dead" function returns "true" even when the dead person has been brought back to life. This could be fixed, either with the variable approach explained above, or by using journal entries, which we'll look at later. For now, let's leave it.
Casting a spell
In case you got a little beat up in your fight with Annette, you might want some help from Marie yourself. Let's have her heal you any time you're not feeling quite up to par.
Why, you're hurt. Let me see what I can do...
Filter it for "DT_Marie Deseaux", and put this in Function/Variable: "Function | PC Health Percent | < | 100". (Naturally, this means "the player has less than 100% health".)
cast, "heal companion", player
Save and test. (You can use "player->modCurrentHealth -10" in the console for testing if you came out of the fight with Annette without a scratch.) Now every time you talk to Marie with less than full health, she'll heal you with a spell.
Enough for the moment. We'll see a lot more different kinds of dialogue results in the following sections.