Oblivion Tutorial Quest Making Part 1: Adding Dialogue to an NPC.
Written by The Guild Master   
Thursday, 16 July 2009 13:20

Oblivion Tutorial Quest Making Part 1: Adding Dialogue to an NPC.

This tutorial assumes your using the Construction kit V1.2.404

Introduction.

The first thing to understand is you can add dialogue to an NPC without editing an NPC. Dialogue is ASSIGNED to an NPC, not ADDED to that NPC. So its possible to add additional lines to any character in the game without editing it and becoming incompatible with other mods. It also means you can offer new quests that way without breaking other mods.

To explain this topic, I have also teach you how to set up a quest. So this is a "How to make a quest and add a line of Dialogue to an NPC" tutorial.

Creating a new Quest for our Dialogue

Before we continue, if the editor popups with an error and asks if you want ignore something and continue, IF YOU SAY NO, the editor will close automatically and you will lose all your work.

In the CS (Construction Set), go to the Character menu and select Quests from the list. The quest window will appear, the list on the left will say Editor/Priority and under it, it will say Arena. Look for the divider between the words Editor and Priority, grab it with your mouse and move to the right so you can see the full name of the quests below. Now right click (right mouse button) and select new. Give the new quest a name, if your brains gone dead just enter "MyQuest" without spaces.

Time to setup the new quest ready for our dialogue

Quest Name = Name the player sees, this does not have to be the same as the name you just gave the quest. Entry a name here, you are going to add 1 line to an NPC and its going to be a rumour so, call it My Rumour. It will not even log anything.

Priority = 20 is ok for minor stuff, 60 is best for major quests, 100 for the world ends if this does not run quests. Give it a priority of 20.

Start Game enabled = Tick yes for now, idling you do not want all quests starting from the beginning of the game but for this tutorial, its ok.

To the right of the Start Game enabled option is a box for an icon, do you really want to get in to DDS files right now ?
NO, I did not think so, so lets leave that blank.

Notice the one box I have not mentioned yet, script. Well time to get scripting, click on the little box with 3 dots in it that looks like this ..., notice it pops up with the script box. If it does nothing then you just found your first Quest Editor Bug, welcome to my world. Close the Quest window and reopen it, find your quest, and click on those 3 dots again. The script window will appear, to save time we will copy and paste another script and edit it. We need a quest script, a short one so lets look for one. Click on the red right arrow in the script box and look for a script that has the words "begin gameMode" in it. You should fine one right away called "scriptName AbandonedMineTrap02Script", its an object script but it has everything we need.

Using the mouse, select all of the script, then hold down CTRL and press C.

You just copied the script.

Now in the script windows script menu select new and then hold down CTRL and press V to paste the script in to that window.

Why do we do it that way, well if you edit the original script with out selecting new, it actually edits the original script, it will even delete the original and change its name, so always select new and copy and paste that way. Better yet, copy and paste to a different text editor, work on your script out side of the CS, then paste it in when your done. That's always handy, in fact its always a good idea to have a good programmers text editor like context open in the background.

The script you have will look like this.

scriptName AbandonedMineTrap02Script

short triggered

begin gameMode

if ( getDistance player < 160 ) && ( triggered == 0 )
playgroup forward 1
AbandonedMineTrap03REF.playgroup unequip 1
set triggered to 1
endif

end

Starting at the top.

Change

scriptName AbandonedMineTrap02Script

to

scriptName MyquestScript

When you save the script, it will be named MyQuestScript. Every script will need to be given a unique name like that. Im using MyQuest as a name because we have to use something and that might as well be it.

Now select all of these next bit.

if ( getDistance player < 160 ) && ( triggered == 0 )
playgroup forward 1
AbandonedMineTrap03REF.playgroup unequip 1
set triggered to 1
endif

With it highlighted, just press delete. Next delete the part that says "short triggered" too.

This is what the script should look like.

scriptName MyQuestScript

begin gameMode

end

Those 3 lines are your basic empty script, you need something like that for most quest based dialogue Now your going to edit it to do part of the job we want. On the line below "scriptName MyQuestScript" type this.

Short my_quest_wants_this_done_once

Below the "begin gameMode" line add this next line

if (my_quest_wants_this_done_once == 1)

set my_quest_wants_this_done_once to 1
endif

The new script should look like this.

scriptName MyQuestScript

Short my_quest_wants_this_done_once

begin gameMode
if (my_quest_wants_this_done_once == 0)

set my_quest_wants_this_done_once to 1
endif

end

This is what all that's for, later your going to add a command called ADDTopic below the "if (my_quest_wants_this_done_once == 0)" line but above the "set my_quest_wants_this_done_once to 1". The game will read that right away, it will say yes "my_quest_wants_this_done_once" does equal zero, add this topic, set "my_quest_wants_this_done_once" to 1 so it does not equal zero anymore and there for will never run again. EVER. You can see why I called it "my_quest_wants_this_done_once" now, but it could have just as easily been given any name, you could for example have called that VAR bob, or ManchesterUnited. As long as there was no space in the name the game would be happy to accept it. Providing the name was not a command for the game of course :)

Ok now save the script using the save option in the script editor.

Quick the script editor, now IM going to give you a task you cannot do.

In the quest window, select the down arrow next to the script box and try and a script named MyQuestScript (or what ever you wrote after the command "scriptName" in your script). You cannot find it can you. Because its not there. Panic....you messed up....you just completely ruined the whole thing, how stupid you are ha ha.....stop IM messing with you. You no stupid, is one of the little quirks in the editor. Close the Quest window, save the mod as MyQuestMod. Do not even bother reloading it, saving is enough.

Now open the quest editor again, find your quest, go to the script box, select the down arrow and find a script named MyQuestScript.

Opps its not there again, silly you, you saved it as an object script, did giskard know you did that, oh yes he did, why did he not say anything, because you need to learn this lesson. Go the Gameplay menu in the editor, select Edit Scripts, Find your script, load it, select the pull down box next to the words Script Type and select Quest. Save the script, close the script editor, close the quest editor, save the mod. Open the Quest window again, find your quest, select your quest script in the script box and make sure it appears in your quests script box above the ADD ICON IMAGE box.

Now your quest as a script assigned to it.

Next save your quest again, just in case it crashes on you, some actions cause the editor to crash automatically every time and you being a noobie will more than likely find this out before I do.

Now back in the quest window, with your quest selected, go to Quest Stages. In the part that says Index, select new so it puts a zero in there. Thats stage 0, we do not actually need this but its good practice to do this. We do not need Quest targets either so lets skip those. Go directly to Topics now.

In topics select new under the Editor ID window, a smaller window will popup, select new again and give the new topic a name like Myquest1. We add the one because we used the name Myquest and we cannot use it twice, so adding a number means we can still use it. Once you have given it a name, click ok with your new topic selected, now select your new topic, see the topic text above, it will have the same name as your new topic, change it to say "Ooo did you know...", then right click in the info box below that and select new.

A window called New Response just opened, we are not ready for this yet so just ok it. The Info window will say EMPTY but the results script and conditions boxes will be usable now which is what we need. Now this next part is the bit you must learn, this is used EVERYWHERE. Learn it now and you can put this in conditions, in scripts, you can say run this quest now, not later. Lots and lots of tricks can be done this way.

Using Conditions 101

(for you yanks, for us brits its "how to use conditions")

First if we just add the line now, it will be given to every single NPC in the game, that is bad, we need to narrow it down a bit, to just 1 NPC. Lets give it to "Count Marius Caro". That's the count if Leyawiin to you. In the editors Object window select NPC and then scroll down until you see the name "MariusCaro" in the Editor Id list. No need to open his file up, I just want you to be able to find an NPC, I do not actually need you to do it for this tutorial. So stop before you do anything with that file so you know where to look for this info in the future.

The name we need is the Editor ID name which is "MariusCaro" and not the name the players say which is "Count Marius Caro".

Now you know we need the Editor ID name right ?, well do not let me confuse you with this next part, we need the Editor ID name, not the name IM about to tell you. The Editor ID is a master file, master files are not placed in the game world, or cells as we call them. We drag and drop a master file in to the cell but when we do so, we create what is known as a REF object of it. So the master creates the REF object. You can only have 1 master but you can drag and drop it as many times as you like to create several REF objects. Then if you add our line to the masters dialogue, ever REF object will get that line too.

I hope that did not confuse you, you need to understand the relationship between Master Editor Ids and REF items early on because some commands only work on the REF object, and others only work on the EDITOR ID for the Master object. And this is one tutorial that uses the Master not the REF.

Back in your quest window, go down to conditions and click on the new button. Select the new entry, use the condition function box to find the function GetIsID in the list. Now select Function Parameters (the Invalid box) and try and try and find the Master ID for the "Count Marius Caro", do you remember the Master ID, no...well its "MariusCaro" so it will be in the Ms somewhere. When your done, select Value and make sure it says 1.0.

Let me translate this in to English for you.

GetIsID MariusCaro == 1

Means

Find the ID for "MariusCaro" and give him this line. Yes I know its nothing like GET but that's actually how you should read it. GET commands in this game tend to GET something for you by finding it and checking its the right one. The == 1 part means is it a positive match, YES or NO, 1 means YES, 0 means NO. So if you had this next line, then every NPC in the game except for "MariusCaro" would get the line.

GetIsID MariusCaro == 0

You see how it works ?

1 means yes, 0 means no.

== means =, they do it twice because some idiot a lot time ago decided computers needed to use the = sign for something else and now if you want to do a 1+1= sum, you have to write it as 1+1==2. You also have >= 1 which means greater than or equal too 1, or < = 1 which means less than or equal too 1, or => 1 which means IM an idiot, and got the > in the wrong place. So always put the >< before the = sign.

Ok you have your EMPTY line assigned to the count.

The option the player sees is "Ooo did you know...", lets make the count speak a line when the player clicks on that.

"Ooo did you know" is a line an old comedian Les Dawson used to say when he advertised the post office stuff, it was usually gossip related jokes btw. Anyway, we want the count to spread a rumour so lets have him say "The Countess of Anvil sleep walks every night". Click on the EMPTY word and reopen the New Response Dialogue box. Enter that text. A spell checker will open, use it if you wish.

If you have a mic plugged in and working, press record and say that line.

When your done, preview it, if you like it, save it and ok it. From WAVE and FROM LFT are broke lipsink features that have not worked since 1.2 appeared so ignore them.

Back in the quest window, go to the Editor ID name for your topic, click once with the left mouse so you can rename it, do not rename it, just select all the name and hold down CTRL and press C, or write down the name somewhere safe so you can remember it. Now click on Quest data in the quest window, select your script, open it. It should look like this.

scriptName MyQuestScript

Short my_quest_wants_this_done_once

begin gameMode
if (my_quest_wants_this_done_once == 0)

set my_quest_wants_this_done_once to 1
endif

end

Click on the space between "if (my_quest_wants_this_done_once == 0)" and "set my_quest_wants_this_done_once to 1" and type "AddTopic", then put space after addtopic and write your topic name there so it reads something like AddTopic Myquest1. The Myquest1 part must match the topic Id you entered in the Topics Tab. That's not the "Ooo did you know" part, its the "Myquest1" part. You see theres a method to my "Oooming madness hehe". Your not likely to get those two names mixed up are you hehe.

The new script should look like this.

scriptName MyQuestScript

Short my_quest_wants_this_done_once

begin gameMode
if (my_quest_wants_this_done_once == 0)

AddTopic Myquest1

set my_quest_wants_this_done_once to 1
endif

end

Before I say that's it, let me quickly cover the basic things from the Topics tab I did not cover.

In the Result Script box you can add other commands that run when the player clicks on "Ooo did you know". For Example you could give the player gold using Additem in that box so everytime the player clicked on "Ooo did you know", the count gave him some money. Or you could use SetStage to move the quest to a new stage. This is normally how its used. You can even enable objects from there so they appear in the gaming world after you disabled them in the editor. I used that method to rebuild Kvatch in Katch aftermath.

The other parts are

Info refusal = IF the NPC hates you he says this line
Goodbye = The player says this line when the chat ends.
Say Once = NPC says this once and you never see it again.
Random = this line will appear randomly.
Random End = the end of a random entry (I think)
Run for rumours = NPCs will say this line as a rumour (and you may hear them saying it to each other too)

Save the script, quit the quest editor, save the mod.

Now your mod is complete and works, but your line has no audio, the game uses MP3 audio for voices and waves for sound effects. If you look in the Oblivion\Data\sound\voice folder you will see a new folder named after your mod and in that the race of the count who spoke the new line, I think he is imperial, in which case it will say imperial. Inside the imperial folder will be a F and an M folder. That's Female and Male folders. The counts a bit of a pansy but he is still a man so his line will be in the Male folder. It will be a wave file.

You need to load that wave file in to a sound editor. Do not ask me where you can get one, you need to search online for this your self. I use Wavepad for mine but its not the best and its not free. Once loaded in to a sound editor you clean up the sound, edit it a little, and then you need to save it and the format you MUST save it as is this below.

BitRate 64
Mono
Sample Rate 44100

You may find the bitrate can be changed but if you do not use the samplerate listed above, the sound will not play. Now click save as and save with exactly the same name as the wave file but save it as an MP3 instead. Your file name will not look like this but this will give you an idea of what it should look like.

The original wave file
OMGBrumaRestoration_OMGRomonBruma_00001752_1.wav

The usable mp3 file
OMGBrumaRestoration_OMGRomonBruma_00001752_1.mp3

When your happy with the sound file, you can delete the wave file.

Now load oblivion, enable your mod, go to leyawiin and talk to the count. He will have a new rumour canned "Ooo did you know" and when you click on that, it will say the countess of anvil sleep walks. :

Enjoy.

 

 

This is the end...my friend.

Copyright © 2010 The Engineering Guild. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.