Quest and Dialogue Tutorial Draft

10 posts / 0 new
Last post
Kevaar's picture
Kevaar
Lead DeveloperQuest DeveloperReviewer
Joined:
2016-01-19 19:35
Last seen:
2 hours 30 min ago

WIP. Below is an outline of things I intend to include. If you think I’m missing something, please post.

I. Basic understanding of Morrowind’s internal logic

A. Topics-Based Dialogue
i. importance of unique topics
ii. how to make topics appear (add topic code or appears in same NPC’s dialogue)
B. Dialogue order
i. navigating dialogue window
ii. engine reads top to bottom
 
II. Quest Journal
A. what is
i. Title Page, Failed, Completed tickboxes
B. using the stages efficiently
i. What if my quest has multiple endings or beginnings?
C. Making quests that work together
 
III. Greetings
A. What the different Greetings are used for
B. How to do a Force Greeting
 

IV. Commonly Used Dialogue Variables

A. Narrowing down who has the dialogue:
i. Unique NPC ID
ii. NPC faction
iii. NPC zone
iv. “Lore” NPCs
B. controlling when topics appear
i. that dialogue order thing again
ii. player has quest item
a. warning: non-unique items!
iii. player is on journal stage
iv. NPC disposition
v. the special case of Talked To Once
C. Latest Rumors
i. the use of rumors as breadcrumbs
ii. clean up! changing rumors offered before/during/after quests
iii. playing nice with other rumors already present
a. random mechanic to control frequency
b. NPC variables to control who actually gives the rumor
 
V. The Coding Box; Commonly Used Scripts
A. Moving NPCs
i. Teleport NPC to player
ii. Move NPC somewhere else
ii. Make NPC follow/stop following player
B. giving or taking items
C. Aggression
i. Make NPC attack player
ii. Making NPC attack other NPC
iii. Calming NPCs
iv. Unintended Bounties
a. who strikes first
b. how to make NPCs nearby ignore player aggression
D. Faction and Reputation
i. Increasing/Decreasing Disposition
a. overall faction disposition
b. unique NPC’s disposition towards player
ii. Handling Faction Ranks
a. detecting faction rank (giving quests)
b. promoting player
c. expelling player
E. Goodbye, Continue, and Choice
i. How to make a classic tree dialogue using if/then statements
 
VI. General tips and tricks for writing dialogue
A. less is more
i. !!, ??, ?!?!, capitalization
ii. plain speaking (no big words)
iii. avoid emotes (non-verbal interactions)
iv. NPCs don’t tell their life stories to just anyone/topic length
v. Don’t put words in the player’s mouth
B. common tags like %PCRace, %PCName
C. Playing sounds while in dialogue

 

10Kaziem's picture
10Kaziem
Lead DeveloperDeveloperInterior Developer
Joined:
2015-12-12 23:47
Last seen:
1 day 19 hours ago

No suggestions, but this looks like it will be very nice to have in the handbook!

Does: concepts, textures, youtube vids, admin stuff e.g. PR, handbook, assets, small website things. Activity level: wildly unpredictable. Still active. Find me on Discord.

Kevaar's picture
Kevaar
Lead DeveloperQuest DeveloperReviewer
Joined:
2016-01-19 19:35
Last seen:
2 hours 30 min ago

So let’s get started!
Planning Your Quest
The first step to doing any quest creation is writing out an outline of the quest. For most of you working from the claims browser, these outlines will be provided for you. Even so, it’s helpful to break it down into steps so that you know what needs to be implemented.

In general, quests follow a very simple format:
1) The player finds out about the quest and talks to the quest-giver.
2) The player does whatever the quest-giver wants them to do, such as find an item or kill a monster.
3) The player then returns for their reward, usually given to them by the original quest-giver.

Obviously, these steps can be added to, such as the player having to find more than one item, or the quest-giver giving them additional tasks, or the player having to find out about the quest by doing other quests first. This I will cover later in (link).

For the purposes of the tutorial, I’ve planned out a very simple quest called Kevaar Finds a Shiny. It goes like this:

1) The player speaks with Kevaar, who talks to them about a ring he found. The player offers to find the ring’s original owner.
2) The player speaks to characters around town about the ring. The player finds out that the ring belongs to Fargoth, and gives it to them.
3) The player returns to Kevaar for their reward for returning the ring.

Though this quest design could be expanded to add more twists in the plot or additional ways for the player to finish the quest, it is enough to start crafting my quest.

The Quest Journal
The first step to creating your quest in the Construction Set is creating the Quest Journal entries for it. (Well, actually the first step is opening up the Construction Set, but we’re assuming you already know how to do that and won’t be covering it in this guide!)

You first navigate to the Dialogue Window. This is a little icon near the top of your screen that looks like a speech bubble. Click it.

(picture of dialogue icon)

This opens up the dialogue window. In the default view, here you can see all the dialogue ever written into the game. To get to the Quest Journal, you’ll want to navigate over to the tab that says Journal.

(picture of dialogue window with mouse over tabs)

Here you will see a list of all quests that have been implemented into the game. To create your own, right click on any quest title and click New.  (It doesn’t matter which quest you do this to, as you won’t be changing it by doing this.) Type in an ID for your quest. Note that changing the ID gets tricky later on, so you’ll want to make this something short, unique, and identifiable to you at a glance. (link to naming conventions) I decided on the ID “TR_KevaarShiny”.

The next thing you will need to do is create the title of the quest as it will appear in your ingame journal. You can add this at any time, but since I already know my title, I’ll do that now. First I’m going to right-click in the Info/Response window, and select New. Then I’m going to navigate down to the text box and type in my title, capitalized correctly. As this is the Quest Name, I am then going to click on the “Quest Name” checkbox, so that the game doesn’t inadvertently give me a journal entry that says nothing but Kevaar Finds A Shiny. Because that would be strange. Unless you’re Kevaar.

(screenshot of my purdy title)

Next I’m going to start making the rest of my journal entries. These will appear in the ingame journal as the player plays through my quest. These entries also help you, the backend writer, to organize your quest in logical steps. I’m going to be making a simple quest, so I’m going to add just three entries to start with.

The first entry should be what appears once the player stumbles upon your quest for the first time. Sometimes you will have multiples of these depending on how many ways the player can find your quest, but I will just have the one. First I click on the Info/Response tab and click New, just like when I made my quest title. In the textbox, this time I will be typing out exactly what I want to appear in the journal entry itself. (The game engine will automatically handle adding a date to the entry). Using the logic of Topic-Based Dialogue, I want to write blandly, so that conceivably any kind of character could be writing this.

(quest entry 1 screenshot)

I also want to add an Index number to this entry. This is used later on for identifying what stage of the quest the player is on. Since this is the first entry, I will call it 10. I like to use multiples of 10 just in case I forget an entry and need to go back and add others in between. Entries should be in the order you expect the player to come across them, for it makes your life easier later on down the road.

If I haven’t already, I am going to SAVE my mod file!

Next I will add my second entry. For the purposes of my simple quest, this will be the entry that shows up when the player has returned the shiny to its owner successfully but has yet to tell Kevaar. I will call it 50. If I were writing a mystery quest or a quest with multiple steps, I might realize later I need other entries that happen between 10 and 50, which is why I chose such a big gap.

(quest entry 50 screenshot)

Finally, I need to write an entry for once I have returned to Kevaar and he has given me a reward for completing his quest. I am going to call this entry 70. Since I don’t want this quest hanging around forever in the player’s journal, I will also check the Finished box so that the quest no longer appears once the player has finished it.

And that’s all I have to do for my simple quest journal! For tips and tricks to using more complicated journal entries, click here (link). If you haven’t already, SAVE your mod file!

Next, we will be handling creating all the objects needed for the quest.

 

Kevaar's picture
Kevaar
Lead DeveloperQuest DeveloperReviewer
Joined:
2016-01-19 19:35
Last seen:
2 hours 30 min ago

Also moving this to the public forums while I work on it. Maybe it’ll help out some new folks, plus it’ll serve as a kick in the butt to actually get in completed...

Kevaar's picture
Kevaar
Lead DeveloperQuest DeveloperReviewer
Joined:
2016-01-19 19:35
Last seen:
2 hours 30 min ago

Creating Objects
After creating my quest journal, the next thing I want to do is make sure I have all the objects I need for the quest.  (An object is any item or character the player may interact with through the course of the quest.) The easiest way to do this is to go back to my original outline. For instance, in Kevaar Finds a Shiny, my quest is planned to go like this:

1) The player speaks with Kevaar, who talks to them about a ring he found. The player offers to find the ring’s original owner.
2) The player speaks to characters around town about the ring. The player finds out that the ring belongs to Fargoth, and gives it to them.
3) The player returns to Kevaar for their reward for returning the ring.

 I see that I need three unique objects for this quest: a Kevaar NPC, a Fargoth NPC, and a ring. When I go into the Construction Set, I see that while Fargoth already exists, neither Kevaar or a unique quest ring do. I will need to create them. (When working with claims, sometimes the NPCs and quest items already exist, and sometimes they don’t, so you will need to check!)

Creating Kevaar
I will first create my Kevaar NPC. I first navigate to the NPCs tab, right click within it, and click “New.” A window will open with lots of values to fill in, which I will explain briefly here.

ID
First, the ID that I call my NPC for use in scripting. This is a unique identifier for the NPC and is read by the game engine only; it never appears ingame. While writing for TR, you should follow the naming conventions here (link).

Name
The next part is the character’s name as it appear to players. With a few notable exceptions, all characters in TES3 have both a first name and last name, and no title. I notice that my quest design has failed to give Kevaar a last name, so I will come up with one now. I’ll call him Kevaar Ezran.

Script
For now, I will ignore this, but it comes in handy later when telling the game engine to track the status of certain NPCs or giving them special abilities.

Race
This governs what race the NPC will be. I want Kevaar to be a Dunmer, and so select Dark Elf.

Female
This checkbox makes the NPC into a female. Kevaar is a male, so I will leave this unchecked.

Class
The NPC’s class governs what skills they’re good at, what spells they have access to, and in some cases, generic dialogue available to them. I imagine Kevaar to be a simple peasant, and so give him the class of Commoner.

Level
This governs how strong the character is. Since players will be meeting Kevaar in a low level area and he is not intended to be a fighter, I will set his level to 5.

Faction and Rank
Unlike the player, NPCs can only belong to one faction at a time. This classification typically effects an NPC’s disposition to the player, some generic dialogue, and some universal questlines. As I want Kevaar to be friendly to thief characters and don’t mind him giving thiefly advice, I will make him a Wet Ear in the Thieves Guild.

Essential
I will be leaving this one alone. Unlike later games, in TES3, all being essential does is tell the player they broke the main quest if they kill this NPC. It doesn’t make them immune to death.

Corpses Persist
If killed, this governs if the NPC’s body sticks around. This is useful for quests where you need to loot a unique item from the body, as it keeps the body from disappearing if the player inadvertently leaves the area before obtaining the quest item. As I don’t foresee this occurring in my quest, I will leave this checkbox alone.

Respawn
This effects whether the NPC can respawn after being killed. Since Kevaar is unique and afaik doesn’t have nine lives, we won’t check this box.

Attributes and Skills
These are set automatically when you choose a Class and Level. However, if I wanted to change one of these manually, I could do so by unchecking “Auto Calculate Stats” and editting them to my tastes.

Head and Hair Listing
Unfortunately there is no easy way to preview these, and you must pick these by trial and error. I chose b_n_dark elf_m_head_07 and b_n_dark elf_m_hair_21, but if you are modding for Tamriel Rebuilt, this is a great opportunity to make use of some of the new meshes available!

Items
This governs what is found in a NPC’s inventory when slain or pickpocketed. Please note that the Morrowind engine automatically equips the best items in the inventory, which then makes it impossible for those items to be pickpocketed. For instance, if I wanted Kevaar to have access to a pair of shoes for the player to steal, I would have to make sure the shoes he wears are more valuable than the shoes intending to be pickpocketed.

For the purposes of my quest, all I want to do is make sure Kevaar has some clothes on. I will not put the quest ring in his inventory, because giving this to the player will be handled by a script later on, and giving it to him now would cause duplicates.

Spells
These are automatically chosen dictated by the character’s Class and Race. But if I wanted to add some special spells to the NPC, I could do so here.

After setting all these attributes to my liking, I will click the Save button. I will also save my mod file!

Placing Kevaar: Keep Him From Wandering Off!
A player can’t talk to an NPC that isn’t in the game world! I will also want to pick a spot for to put my new Kevaar NPC. Since placing objects is already handled in other tutorials (link), I will only draw attention here to the Wander mechanic for NPCs.

Wander is a script automatically assigned to NPCs that makes them randomly walk about on their own. Most NPCs in exteriors will have this, while most NPCs in interiors won’t, as they have a tendency to climb on tables or get stuck behind crates otherwise. I want to put Kevaar in Seyda Neen’s Lighthouse, an interior, so I’ll want to make sure he doesn’t Wander.

To do this, I’ll want to open up his NPC window, and click on AI. In the list of AI Packages there should be one called Wander. I will double-click this, and set the distance to 0. I will then click Save in each window to save the change. Now Kevaar will stay put and not wander off.

Creating the Ring
Next, I want to create the ring. This is most easily done by finding an existing ring and tweaking it to my liking rather than making an entirely new one. First I will go to the Clothing tab and find a ring that seems close to what I want my quest ring to be. I’ve picked ring_keley. To create my ring from this one, I right-click on ring_keley, and click “Edit”. I then give this ring a new ID and click Save. I want to be very careful to tell the editor to create a New Object in the dialogue window that pops up, or else I will replace the existing version with my quest version, and thereby may break both my quest and any others that use ring_keley!

After saving my quest ring under a new ID, I can tweak the quest ring to my liking, such as changing the enchantment or the value. Since I don’t intend the player to be keeping this ring, I’m going to keep the value and enchantment trivial.

Pro Tip: Since enchanting an item changes the ID, a good way to keep players from accidentally breaking quests is to give the quest items an enchantment.

Creating a Reward?
Finally, I also want to give some consideration to what reward to give to the player once they have completed the quest. While most quest designs will specify the reward, mine didn’t, so I will have to come up with something. As appropriate to the ease of the quest, I think I will have Kevaar reward the player with 50 gold and a low level item. Though I could create a new, unique low level item to give the player, I don’t want to make more work for myself, and instead will choose something out of the existing item list. I want to be sure I pick something with a count greater than 1, so I don’t inadvertently give the player something that is a unique item for another quest.

I chose to give the player a silver staff. I do not need to place this reward in the game anywhere, as like the ring, giving it to the player will be handled by a special script.

I am now ready to go on to crafting the dialogue!
 

Rot's picture
Rot
Lead DeveloperQuest Developer
Joined:
2014-03-16 17:45
Last seen:
6 hours 12 min ago

Nice, this may also be the place to add (@ Creating the Ring ) that having a small trivial enchantment on quest items that can be equipped doubles as a way to prevent the player from enchanting them (which would make it impossible for the quest to recognise it as the same item afterwards), without having to turn the item into a misc.

Kevaar's picture
Kevaar
Lead DeveloperQuest DeveloperReviewer
Joined:
2016-01-19 19:35
Last seen:
2 hours 30 min ago

Dialogue Basics
Writing out the dialogue is arguably the biggest part of the quest creating process that also requires the most creativity. Tips for writing good dialogue is not the intent of this tutorial, and so I will be keeping this mainly to how to handle all the logistics of implementing dialogue using the Construction Set.

Topics-Based Dialogue vs. Tree Dialogue
The first thing to understanding Morrowind dialogue is that it is TOPICS-BASED Dialogue, rather than the Tree Dialogue you may be used to in other games like Skyrim or Neverwinter Nights. What this means is that the dialogue is organized by topics which the player can pick out of a list to ask the NPC about. The flow of conversation and how the player character is asking about the topics is largely left up to the player’s imagination.

This contrasts to Tree Dialogue, where the writer of the game has taken the liberty to write out exactly what the player character is saying to the NPCs. While Tree Dialogue is possible to code into Morrowind’s engine, the writing of it has to be done carefully so as to allow the player the flexibility of roleplaying their character however they want. 

Top-Down Processing
Besides being topics-based, the other important thing to understand about Morrowind dialogue is that the game engine processes dialogue in a top-down fashion. When you open up any Topic in the Construction Set, to the right you will see a window that lists all the possible responses for that Topic, called Responses. The engine goes through these Respones from top to bottom, checking to see if each Response matches the parameters you've given in the Speaker Conditions section. It stops once it finds one that does match, and this is what gets spit out at you in the game itself.

As far as developing quests goes, we then have to be very careful of tagging each Response with conditions so that it shows up only when we want it to. The engine will pick the first response it sees that even remotely matches the right conditions, meaning the most general Responses should be put at the very bottom of the list.

Below is a quick list of possible parameters and when you might make use of them:

ID
Here you can pick the ID of a particular NPC. Once selected, only this NPC can say this Reponse.

Race
This narrows down the speaker to a particular race. For instance, you may want to write out a response that makes use of Khajiit's special grammar, and only give it to Khajiit.

Class
Similarly, speakers can be narrowed down to a particular NPC class. For NPCs, classes also are often the NPC's profession, so be sure to check out the available list of classes to see which ones may be most applicable.

Faction
This limits the dialogue to NPCs who only belong in a certain faction. Remember that NPCs can only belong to one faction at a time.

Rank
This limits the dialogue to NPCs who have a certain rank. A faction must be chosen first before this option becomes available.

Cell
This limits dialogue to only appear when the NPC is placed in the given cell, or any of the cell's child cells. This is most useful for rumors that only appear in certain towns, or for NPCs making comments about the building they're in. If the NPCs move out of the cell, the dialogue will no longer show up, so you want to be careful selecting this option if the intended speaker(s) move(s) around.

PC Faction
The player has to belong to the selected faction for the dialogue to become available. 

PC Rank
The player has to be of a certain rank for the dialogue to become available. You must first choose a faction for this option to become available.

Sex
This is to limit the dialogue by the NPC's gender. (For dialogue that is based on the player's sex, see Function/Variable)

Disp
This stands for Disposition, or the number in the blue bar that denotes how positively the NPC sees the player ingame. For this dialogue to appear, the NPC's Disposition number must be greater than or equal to the number in the Disp box. 

Function/Variable 
This section has a series of boxes that allow you choose more complicated variables than the ones above. I've listed out some of the more commonly used ones below.
Item, ItemID, operator symbol, number input
Journal, JournalID, operator symbol, number input 
Function, Choice, operator symbol, number input
Weather
PlayerRace
PlayerSex

 

Kevaar's picture
Kevaar
Lead DeveloperQuest DeveloperReviewer
Joined:
2016-01-19 19:35
Last seen:
2 hours 30 min ago

Okay, that’s great and all, but where do I start?

That, my friends, depends on how you like write dialogue!

Different quest writers will do this step differently. Some will start with the topics they want to fill in and write to suit; others will just write out a natural conversation and then pick their topics based on what they’ve written. In TR, you may find all the dialogue written out already by another writer in the Claims Browser.

Whichever route you choose, you'll want to create the topics for your dialogue next. As far as my Kevaar Finds A Shiny quest is concerned, I then want to pick a few topics that the player will be using to speak with the NPCs involved in the quest. Good quest design normally has three different kinds of topics. I will go through these one by one.

Main Topic

The main topic is used for starting the quest and moving it along its updates. For sake of simplicity, you generally want to keep this to a single topic that is completely unique to your quest.  

Creating the Main Topic
For my simple quest, I have decided that the main topic that starts the quest is called “ring I found”, since just "ring" would probably be too general and already in use by another quest. To create this topic, I first right-click anywhere in the Topic list and select “New”. (It does not matter where in the list you click to do this). I then type in my topic exactly to be “ring I found”—misspelling this could mean my topic doesn’t appear correctly, and as there is no way to edit a topic name once made, I want to be very careful I get this right the first time!

Once the topic is created, I navigate over to the Responses tab and right-click to create a new Response. In the top box, I write out what I want Kevaar to say about this. 

(picture of first Response)

Then I fill in the Speaker Conditions. For instance, I want to make sure this Response only comes from Kevaar, and so select him in the ID box. I also want to make sure it only appears before the player is on the quest, so I fill in a Functions/Variable slot with Journal "Quest_ID" 10.

Pro Tip: The Conditions I chose here should be specific enough that the Response doesn’t shows up when I don’t want it to, but I might want to give some thought to peculiar circumstances. For instance, if Kevaar were to have a script that made him appear in Vivec every Morndas, would I still want him rambling on about the ring he found while in Vivec? If I didn’t, I’d also want to select the Cell to only read Seyda Neen or perhaps more specifically Seyda Neen’s Lighthouse.

Now, as this is my main topic, I also want to add Responses in here that will appear at all stages of the quest to progress it. A good rule of thumb is to have a Response for each of these general stages:

1) When the player first asks Kevaar about the quest.
2) If the player rejected the quest.
3) When the player has accepted the quest and the quest is still in progress.
3) When the player returns to Kevaar for their reward (quest completion).
4) After the player has completed the quest successfully.

Getting these steps to appear at the right time means making wise use of the Journal. Remember the Journal index numbers we chose? We use these to reference which stage of the quest the player is on, using the Journal function and simple mathematical logic.

After finishing all the “ring I found” Responses that are specific to Kevaar, I want to consider the other NPCs that are involved in the quest. In my quest design, I see that I wanted the player to talk to the NPCs around Seyda Neen to find the rightful owner. 

To do this, I create another Response. I fill in the Speaker Conditions to have Seyda Neen for the Cell condition. This means all NPCs located in Seyda Neen will have this Response.

As this is a less specific Response than Kevaar’s dialogue, I want to move it to be UNDER his in the list, or else Kevaar will say this instead of his own personalized dialogue. I do this by selecting the Response in the Response box and using the Left or Rught arrow keys to move it up or down. 

Next, similar to Kevaar’s response, I want to consider writing Responses that are applicable to each quest stage. So long as I am sure to tag each Response with the Journal Function, it is not necessary to write a Response for each stage—the topic will simply not appear when there is no Response for it. 

The final NPC included in the quest is Fargoth himself. Like Kevaar’s dialogue, the only Speaker Conditions I need to worry about is the ID and the Journal function. I also want to make sure the Responses are higher in the list than the more general responses tagged for Seyda Neen. (It should not matter whether they are higher or lower than Kevaar’s Responses.)

Greetings

Now that the meat of my quest’s dialogue has been implemented, I want to be sure the player can find it! This is most often done through use of the Greetings. Greetings are what the player sees whenever they greet NPCs and before they click on anything in the topic list. In the Construction Set, the Greetings work the exact same as the Topics, except that they are under a different tab called (obviously enough) Greetings.

Greetings can also be used to characterize the NPCs in my quests, add detail to the worldspace, or give the player reminders that they are on a quest at all.

(picture of Greeting tab)

Creating the Greeting
First open up the Dialogue window and navigate to the Greetings tab. Unlike in the Topic tab, you will see Greetings are labeled from 0-9 instead of using specific titles. Each of these Greetings are used for different purposes in Morrowind. Like the Topic Responses, Greetings follow the Top-Down logic, where the engine goes through all the Greetings in Greeting 0, then moves to Greeting 1, then to Greeting 2, etc, until it finds the first Greeting that matches the parameters it needs. This means that the higher number Greetings often have very specific Speaker Conditions, and tend to be used for quests and events that have the potential to override everything else. 

Below is a list of what circumstances each Greeting is typically used for. For the most part, you will be using Greeting 5 for quests, occasionally branching into Greetings 0 or 1 in special circumstances.

(list of each Greeting and what they do)

So why are Greetings important, beyond making your NPCs not sound like every other Average Joe out there? Morrowind dialogue is coded to not overwhelm the player with choices, so topics do not appear unless they are called by a script (rare) or spoken by an NPC with an available Response for that topic (most common). And so, the best way for the player to find our main topic is to mention it specifically in a Greeting!

To do this, I first navigate to the Greetings tab and click on the Greeting number I want to use. Let’s choose 5. Next, I rightclick in the Responses tab to make Kevaar's Greeting. Just like his other dialogue, I want to give this Response specific Speaker Conditions tailored to Kevaar's ID and the player's progress on the quest.

 Because this is a very specific set of Speaker Conditions, I will probably want to leave it at the top of Greeting 5 in a normal mod. However, some of TR’s Greetings need to be kept at the top of the list regardless of what else is added, so it’s good practice to scroll through the Greetings until you find other similarly Conditioned Greetings to put yours with. In this case, we are looking for a Greeting that is tied to a particular NPC’s ID and seems to be the start of a quest.

(screenshot of first Quest Greeting 5 from TR)

For many quests, simply creating a Greeting to introduce the main topic is enough. I don’t have to make Greetings for other NPCs in the quest or for each quest stage unless I really want to punish myself. Usually, additional Greetings are to help characterize the NPCs in my quest (for instance, an impatient NPC constantly badgering the player to finish their tasks), or to help remind the player where they are if the quest is a particularly long one. If there are no more Greetings, the engine will simply keep going through those available, usually landing on one that is specific to the character’s Cell, Race, or Faction.

Secondary Topics

Technically these are no different from main topics, but I make the distinction based on how they are used in simple quest design. The secondary topics are topics that give background information on the quest. These may or may not be important to furthering along the quest itself. In Kevaar Finds a Shiny, I might use the topic "shinies" for Kevaar to ramble on about how much he likes shinies, further characterizing Kevaar and giving a clue as to how he found the ring to begin with. Or, I might use the topic "tit for tat" if one of the NPCs in my quest wants the player to complete an additional task before telling the player who the ring belongs to.

Creating Secondary Topics
Finally, I want to go back and add any secondary topics I have left. They are created in the Construction Set just like main topics. Also just like main topics, they have to be introduced to the topic list through the dialogue of the NPC who will be speaking them or called through a script, and you want to be careful with their Speaker Conditions so that they only show up when you want them to.

Secondary topics can also be used to add additional quest steps or sidequests. Creating these is beyond the scope of my simple Kevaar Finds A Shiny quest however, and I will address it in (link)

Kevaar's picture
Kevaar
Lead DeveloperQuest DeveloperReviewer
Joined:
2016-01-19 19:35
Last seen:
2 hours 30 min ago

Now the "Fun" Part: Scripting!
Now, I know most of you who make quests care more for making stories and fleshing out characters, and go a little pale when it comes to the scripting. I'm here to reassure you that most of Morrowind quests can get by with just a few scripting snippets, so there is no need to feel overwhelmed when you delve into the CS's scripting commands! I have taken the liberty to jot down here some of the most common scripts and how you would implement them in a quest.

That said, there are a ton more commands you can work with to affect your gameworld in all kinds of ways. The purpose of this tutorial is not to list out every scripting command that can be used in Morrowind however, so I will have to point you towards some excellent websites such as (link) for that!

When writing quests, there are three main places where scripting is accessed and implemented. These are scripts implemented through dialogue, scripts attached to Objects (including NPCs), and finally scripts that aren't attached to anything, and must be told when to run.

Scripts Implemented through Dialogue

The  first and most common place you will find scripts is implemented in the dialogue window, in the Results box.
(picture of Respones bo with coding in it)

Unlike Object scripts, which only start when specified conditions affect their attached Object, dialogue scripts are triggered the instant the player clicks on a dialogue topic and is navigated to the appropriate Response. This timing is especially important to keep in mind for things like playing sounds or blacking out the screen, as these will happen a split second after the player clicks, usually not giving them time to read the dialogue itself.

It should also be noted that unless otherwise specified, dialogue scripts affect the speaker of the dialogue, either telling them to do something, or making something happen to them. Otherwise, you can specify another Object for things to happen to with this syntax:
"PutObjectIDHere"->PutRestofScriptHere
Eg.
"fargoth"->SetFight 100 
would make Fargoth very mad, even if this script was put into a dialogue Response spoken by Kevaar.

Journal "Quest_ID", Index#
The first and most important script is that of Journal Updating. As explained before, the journal organizes your quest into steps, and in order for the player to progress through these steps, you have to tell the computer when to move the player on to the next one. In order for my Kevaar Finds a Shiny quest to even begin, I must start adding this script to any pivotal Respones in my quest dialogue, like so:
Journal "TR_KevaarShiny" 30
This updates the quest to stage 30, and the player will be able to read whatever I wrote for that entry in their journal.

AddItem, "ItemID", #ofItems
RemoveItem, "ItemID", #ofItems

This is the primary way you will give quest items to the player, both when you hand them rewards, as well as quest items, such as that special letter they need to read or deliver on to the next person. The syntax goes like this:

AddItem ,"TR_fargothring", 1
OR
"ReceivingNPC"->AddItem, "TR_fargothring", 1

ProTip: Note, because the game engine is stupid, it will try to remove items even if the player or NPC in question doesn't have any, causing a crash. This is rectified by having the object be one of the Speaker Conditions, or adding this code into the Responses window before you do the RemoveItem command:

if ( player->GetItemCount, "TR_fargothring" >= 1 )
player->RemoveItem, "TR_fargothring", 1
endif

StartCombat "AttackedNPCID"
Sometimes you will want NPCs to initiate combat with the player, or with each other. This is done through the StartCombat command. The syntax goes likes this:

StartCombat "fargoth"
or
"TR_Kevaar"->StartCombat "fargoth"

When making two NPCs attack one another, you must tell BOTH NPCs to attack one another, or one will stand there stupidly as he gets beat on by the other. As you can see in the dialogue above, one of my attack commands specifies the actor and the other doesn't. Since this is written in the dialogue window as one of Kevaar's Responses, the game engine automatically assumes he is the one doing the attacking unless I tell it otherwise.

ProTip: As the game pauses while in dialogue, usually this script is also paired with a Goodbye command, so that the player can't keep chattering away while the NPC is trying to attack someone. While not adding a Goodbye won't break the game, it wouldn't seem very realistic.

ModDisposition #
Remember that Disposition thing I talked about earlier when talking about Speaker Conditions? This the command to change how much the NPC likes the player. While there are a few hard-coded instances of this (such as when stealing from an NPC or joining a new faction), most NPC relationship dynamics have to be done by hand. This is usually done in increments of 5 to 10, though a particularly heroic (or villanous) act may net the player a jump of 15. Syntax examples are below.
For positive disposition gains (the NPC likes the player more):
ModDisposition 10
For negative disposition gains (the NPC dislikes the player more):
ModDisposition -5

FadeOut, #
FadeIn, #
This command causes the screen to fade to black. ALWAYS PUT A FADEIN COMMAND AFTER A FADEOUT ONE, or else your player will be stuck looking at a blank screen....foreeeeeever.

You can customize how long the fadein and fadeout is by adjusting the number that follows the command, though I find 1 second is enough to symbolize the passing of time, such as when you train.

If, ElseIf
As the Results box is indeed a scripting window, you can use this kind of scripting in it! This is most often used in the conditioning of Choice commands (see below), as most other modifiers that you could put in here will already be handled by use of the Function/Variable Speaker Conditions or the order of Responses in the dialogue window.

Always remember to pair each "if" statement with an "endif", or this script will not compile correctly!

Goodbye
An old standby: this is how you force the player to stop talking to an NPC. Unfortunately this does not allow for the "Goodbye" text to be customized. The syntax is simple. You just write "Goodbye".

As I'm sure you've noticed while playing through Morrowind, there is no way to for the player to get around this beyond straight up reloading the game or clicking on Goodbye. When used in conjunction with another script such as Journal or (attack), this is how you keep the player from trying over and over to ask the same thing of an NPC.

Choice, "Text", #
Ah, I save the best for last. The Choice command is how you write Tree Dialogue into the game. The use of this script must be paired with a Function/Variable speaker condition. The script you put in the Results box looks like this:

Choice "Yes, I will help you." 1
Choice "No, get lost." 2

When I write in the above, the player will have the option of choosing either option 1 or option 2 as their character's response.

Let's say the player chooses 1. First the player gets the message that they told the NPC "Yes, I will help you", as I wrote. Next, the game engine goes back over Responses in the same Topic, until it comes across the first Response that is conditioned with Choice == 1. (This is why most Choice conditioned responses appear at the very top of topics). Then, it reads out whatever you wrote into the Choice == 1 Response to the player, implementing any other scripting in the Choice == 1 Results box, such as journal updates, the NPC attacking the player, yet another Choice, etc.

These can be done in any topic, including the Greetings, so long as all the Choice responses are kept within the same topic. If you put your Choice Response into "little secret" instead of "ring I found", the game engine will never find it, even though Kevaar telling you about the ring he found may indeed be considered his "little secret".

If I wanted some Choices to only show up based on certain conditions, I could do it like this:

if ("player"->GetMarksman >= 35)
Choice "Yes, I know how to use a bow." 1
elseif
Choice "I'm sorry, I don't know how to use a bow." 2
endif
if ("player"->GetLongBlade >= 70)
Choice "Actually, I'm much better with a sword." 3
endif

In this example, if the player's Marksman skill is greater than or equal to 35, they will see the option to tell the NPC that  they know how to use a bow. Otherwise, they can only say they don't know how. They also have the option to say they'd rather use a sword if they have a high enough Long Blade skill, but this option won't appear at all otherwise because I included no elseif option.

Complicated dialogue trees can be implemented by using lots of Choice and if/elseif commands like this, though I warn you, it is very easy to get lost in your own writing. It is often best if you can limit conversations to less than 10 choices, or draw yourself a labelled diagram.
(diagram tree)
Although it is tempting to write out all dialogue in this way a'la Neverwinter Nights, it's frankly better if we work within the style of the game engine, and only use this command when the player is indeed making a choice that could affect the entire questline, not just telling the NPC that they prefer the green drapes over the blue ones. Quest-heavy mods may break this convention, but in Tamriel Rebuilt, we prefer all Choice dialogue to be to the point and used only if there is no other way of getting the same scene across.

Pro Tip: In playing through the vanilla game, you may notice a lot of dialogue where you can click on "Continue" to give you another paragraph. This is actually done by using the Choice command, and writing "Continue" as the choice text. This is primarily done to break up long chunks of dialogue. Be warned however, that just like the Goodbye command, the player will not be able to do anything but click on your Continue or reload the game. It is best to split up very long monologues into multiple topics orto give the player the chance to leave the conversation every third Continue for this reason.

Scripts Attached to Objects

In general, scripts attached to Objects directly affect those Objects, including but not limited to telling signs how to swing in the wind, lights when to come on and off to follow day/night cycles, vampires how to infect their victims, and smart NPC followers like Julan how not to get lost on random rocks. Obviously, there are a ton of things you can do with these, but when working with quests, there are _ major uses: kill counters, Force Greetings, and activators.

Remember, that these can be accessed through the Object window. They can also be accessd by clicking the Script button, but don't forget to then attach them to the Object later!
(picture of Object window and script button)

OnDeath
In quests that involve killing off a unique NPC, you may find a code snippet something like this in the NPC's attached script:
if ( OnDeath == 1 )
Journal "JournalID" 15

In coding language, this means that when the game engine detects the death of your NPC, it will update the journal to stage you told it to. This is useful for quests where the NPC must kill a certain monster or person, but can also be used if you want to put in another quest branch if your player killed off the wrong guy as well.

For instance, in my simple quest, I could attach this script to Fargoth:
(code)

This will update the journal to an entry reading that I murdered poor Fargoth, and after writing out and properly conditioning dialogue responses for Kevaar, he will yell at me for being a cold-blooded killer.

ForceGreetings
Sometimes when taking a stroll through the lovely landscape of Morrowind, you will be rudely accosted by an NPC begging you to find her beloved or keep him from being eaten by rampaging kagoutis. This is accomplished through an Object script, and it goes like this:

if ( GetDistance Player <=256 )
ForceGreeting

Basically, when the game detects that the player is within a certain distance of the Object the script is attached to, that Object will start a conversation with the NPC. This conversation follows all the rules of dialogue initiated by the player, including Greetings and Topic orders. This is why many Force Greetings find their way in Greeting 1 or 2, so as not to be overriden by more general dialogue tied to the same zone or NPC characteristics.

Often these scripts will include further conditions to keep the computer from incessantly checking where the player is (which can slow down your mod). Here are two examples of these:

In this script, the computer checks where the player is every 4 seconds, instead of every thread:
(timer script)

In this script, the computer starts checking where the player is once they have entered a certain zone:
(zone script)

Depending on where and how you want your ForceGreeting to happen, you may use one or all of these scripts to keep your computer chugging itself to death.

Activators
These are scripts attached specifically to doors, levers, chests, beds, and other interactable objects in the game world. While these are more often used in level design (for instance, putting a trap on the button you push to raise and lower a platform), they can also be used to further a quest.

In this example, I want Kevaar to yell at the player if they try to break into his secret stash in the barrel beside him. Since barrels cannot be locked, and the dialogue for being caught stealing is generic, this allows me to make Kevaar be more or less forgiving when he notices the player poking around in his things.
(code)

As you can see, this is a simple Journal Update command. See the common theme? Now when I go back into Kevaar's dialogue, I can make him grow interested in the player's thieving ability instead of attacking them for touching his things:
(screenshot)

NoLore
You may notice that some NPCs do not have the full list of generic topics like "Morrowind lore" or "Balmora", but instead only talk to the player about topics related to their quests. This is done by attaching a NoLore script to them.

There are three parts to making  functioning noLore script. First, at the beginning of the script, you must declare it as a variable. (For those of you without scripting knowledge, variable declarations go at the top of any script, after the Begin ScriptName line. They are necessary for the computer to be able to understand and use your variable names in the rest of the script text, instead of telling you you are using a command it doesn't know.)

short NoLore

Next, in the body of the script, you must set this variable to 1.

set NoLore to 1

The third part is only applicable if you are making your own landmass or quest mod that includes more generic topics than the ones the vanilla game gives us. Whenever you add a generic topic, you must put this in the Functions/Variables part of the Speaker Conditions:

Function, NoLore, == 0

Now any topic tagged with this Function won't appear whenever the speaker of the dialogue has your NoLore script.

Companion Share
This mainly applicable for NPCs that will be longterm followers of the player. Companion Share is a hard-coded function that allows the player to manage the NPC's inventory by clicking on "Companion Share" near the top of the dialogue window. By default, this is turned off, but we can turn it on by putting this line in with the variable declarations in the NPC's script:

short Companion

Followed by:

set Companion to 1

The game engine will take care of the rest!

On-Run Scripts

And finally, there are scripts that you must tell the game engine to start running, either through putting  StartScript "ScriptName" into a the dialogue Results window, or into a script attached to an Object. Otherwise, these scripts are just floating around in the game engine like so many letters in a smokecloud and do nothing at all.

These are often best used when you want the game to do lots of commands or check lots of conditions all at once in the background, as it will not slow down the game while it is being compiled and run. They can also be used when you are trying to affect multiple Objects at a single time, or when it would just plain not make sense to attach it to any one object in the game world. This kind of script also gives you more flexibility in just when you trigger them, though I'm afraid I will have to leave it up to your imagination how this can be useful.

As I am keeping this tutorial to scripts that are useful in quests and dialogue specifically, I will be giving you an example from a Tamriel Rebuilt script:

(add topic script)

Long script short, this is used to add topics to the dialogue window. As you (should) know by now, most new topics are called into existence by using them in a snippet of dialogue. Some things, like ingredients lists or place names, are just too long, unwieldy, or impractical to add to the dialogue this way. The solution? You run a script like this.

This particular script can also be used if you are simply paranoid that the traditional way of adding your topic to the dialogue list won't work, though beware, most players are used to scanning for clickable blue text when doing quests, so you may not want to tie any pivotal information to topics added in this manner.
 

Kevaar's picture
Kevaar
Lead DeveloperQuest DeveloperReviewer
Joined:
2016-01-19 19:35
Last seen:
2 hours 30 min ago

Tying Everything Together

Whew! We are almost done. The final step to any quest creation is playtesting! Below is a handy checklist of things you'll want to check.

Writing and Planning
1) Is there an obvious start, middle, and end to my quest's story? (Assuming you want them to be obvious).
2) Does my characters' actions make sense, given their motivations? Could they have been smarter and bypassed the need for offering the quest altogether? Has this been addressed if so?
3) Are there any parts of the quest that would work better as a side quest with it's own Journal ID, to help me organize it?
4) Have I taken into account what will happen if the player kills quest NPCs, misplaces the quest items, talks to NPCs in the "wrong" order, or otherwise does something unintended?
5) Is my quest's reward appropriate to the level, difficulty, and backstory of my quest?
6) Am I using any unique objects for either quest items or quest rewards?
7) Are my NPCs appropriately leveled and equipped to withstand accidental blows by the player? To deal with monsters in the area?
8) Have I given the player the option to both turn down the quest and be able to pick it up again? (The latter may not apply to all quests).
9) Are my NPCs in use by other quests that might kill or move them? Is my characterization and storyline consistent with such quests?

Quest Journal
1) Are the quest entries clearly written, with directions or links to my topics if the player forgets what they were supposed to do?
2) Are my quest stages updating when they should?
3) Have I marked one or more of the journal entries as Finished?
4) Have I given my quest journal a Title entry and checked the box for it?

Dialogue
1)  Does dialogue affecting multiple NPCs take into account the different knowledge, speaking styles, and opinions of these NPCs? Are there any Responses that conflict with generic or quest-related Responses with the same conditions? (I'm looking at you, Solstheim latest rumors!)
2) Do all my topics either disappear or have filler responses when not in use by the quest?
3) Do all of my NPCs greet the player with an appropriate Greeting for the quest stage they're on?
4) Do all my Choices lead to the correct Responses? Does the conversation flow naturally when play-tested?
5) Do any characters who can't speak or have special accents give unique responses to generic topics like services, little secret, and Background? Or have I otherwise blocked these topics off?
6) Is there any way my player can get around a forced dialogue choice by speaking to the NPC multiple times?
7) Does an exceptionally high or low disposition break the quest in unintended ways?

Scripting
1) Are there any compilation errors?
2) Are memory-intensive scripts stop-gapped by a timer or very specific conditions?
3) Does it do what it's supposed to do ingame, even if the player doesn't do what THEY'RE supposed to do?