Fallout 3: Dialog Tutorial
Introduction
Today I will be explaining how to create new dialog from scratch, starting with the creation of an NPC and walking you through the process of adding Dialog to that NPC. We will be using existing Dialog for greetings etc so we do not need to bother with those (The Voice Types that exist in the game by Default already have them recorded). This means we do not have to record every line they need, just the new ones we want them to say. Our NPC will allow the player to talk to it and run some scripted stuff as a result of the conversation. In this way you will see how to make your Dialog actually do something in the game.
Initial Preparation
First we must load the Fallout esm in to Geck and save it right away under our new mod name. Our new mod will simply add a new NPC to the game and allow that NPC to share its story with the player. So lets just save the mod as MYNPC.esp and started.
Click on the Geck File menu and select Save, in the window that appears type in NPC as the mod name and save it off.
We do this because all Dialog mods need to know the mod name before the audio can be saved. The mod name is used as the folder name to put the dialog we record in.
Creating a new NPC
Now go to the Object Window and scroll down until you get to NPC, then select AbrahamWashington as the NPC we will use as the basis for our NPC. I have chosen this NPC for several reasons, first it is a quest NPC and thus VERY DANGEROUS TO EDIT, second, it will need some changes. How we make those changes is information you need to know to avoid the "Dangerous" part since quests tend to be a little picky about you changing things they use. So I will start by editing quest content safely so you know how to do it. A lesson worth learning, it is not hard at all this part so relax.
As usual we go right to the ID AbrahamWashington and change it to something new (remember to say yes to the create new formID question later when you close the NPCS window), lets call our new NPC something boring like Jim Bob. Make the ID say JimBob and the NAME box say Jim Bob. Make sure no script is being used, untick the Essential box unless you want your NPC to be unkillable and go to the Actor Base Template area.
Select the pull down menu in Actor Base and select CGPresentAsianM01 by pressing C and scrolling down the list until you reach it in the list. Now go to tabs that start with Traits. We want younger Asian male, so lets make one. Choose Race and select Asian. Next voice type MaleAdult02 (Remember this name it is the name of the folder this NPCs recorded lines are stored in later) and set the NPCs class to settler.
Our guy is not going to be anything special, just an average joe.
Using the arrows at the end of the to the right of Traits, scroll along until you reach the FACE Tab, select it then hit Generate a few times to generate a new face for our NPC. Click Select Colour and choose a new Hair colour then hit apply. Finally scroll along the tabs a little further until you get to head parts and select Hair and just choose a hair style you like, ch oose an eyecolour you like and then in Head Addons, right click in the white area below EyeBrowM and select new.
Lets give our new NPC a BeardGoateeFull, you can choose another one if you like. When done just tick the preview box and then tick Head again. You may get an error message here, say yes to continue if you do. Otherwise the editor will close and you will have to start again.
Opps Geck just crashed as I clicked on the Inventory part, take note people, Save your mod Often :D
Now go to Jim bobs Inventory and select the RCAbrahamWashingtonKey and press delete, we do not want that. We will leave the rest, you can customize the inventory if you want by giving the NPC armour, weapons or anything, it is entirely up to you.
Now go to AI Packages and delete all the packages you see there, then right click and select new and enter a name for the ID, lets call it MyNPCPackage for now. Set the package type as Sandbox so our NPC will interact with other objects in the area we will be placing him in and then go to wander location, leave it set to Near Editor Location but set the radius to 2048 so our NPC can stroll far and wide in the area we place him in. Leave the Allowed Behaviors for now, or just tick them all.
Now we will place our new NPC in the market area of Rivet City, since he already has the right faction for that cell, saves us guessing a neutral faction that will not get killed when you randomly place your Jim Bob someplace else in the world. We know our Jim Bob will be safe in Rivet City because the original character was safe there and it is his Faction settings we are using.
For the record, my Jim Bob faction is set to RCResidentFaction, megaton has its own faction, as do all other cities.
Now scroll down to RCHanger and double click to make it load the cell in the view window so we can see it. Double click on something in the RCHanger Object list from the Cell View window to zoom in and find a place to drag and drop our JimBob in to the cell so he can walk around the market. When you find a spot, go to the Object Windows NPC list, select NPC and scroll down to J to find out JimBob and select him with the left mouse button and just drag him over to the Rivet City Market. That is the view in the window your looking at btw.
Then Select JimBob and with the Z key on the keyboard pressed, move him down to the floor somewhere. Z moves the NPC up or down, you can use the mouse on its own to move it left or right. Also try X and Y, these are important keys to learn for placement of items.
That is it, we are done, we have made our NPC and how we can start with the Voice work and Quests.
Creating a Quest to hold our new Dialog
Go to the Object Window, find Actor Data and scroll down until you see Quests, then in the right window, right click and select new. Now set the Quest name to "MY NPC Quest", set the ID to MYNPCQuest, give it a priority of 30 (low because its not important dialog) and tick Start game enabled.
Now Okay the window to create the quest and save the mod, then find our quest in the Quest list, it will be called MYNPCQuest, when you have found it, reopen it and go to the Script box, and select the square with the 3 dots in it. A blank script window will appear.
I am now going to tell you how to quickly and easily make a quest script without knowing what your doing. But becareful to follow these instructions very carefully, we do not want to change an existing script, we want to make a new one and will be BORROWING an existing one to do it.
In the script menu, select open and choose a script that starts with MQ (main quest), Now click in the white area where the script appears and press Control A to select ALL and Control C to copy it. Then go back to the script menu and select new, then click in the white area and press Control V to paste it back in to the empty script window.
Now we have made a copy of the script, we can edit it safely, do not save it yet, wait until you change the first line to something else.
The script I chose was MQ01AmbushMutantSCRIPT so my first line is "scn MQ01AmbushMutantSCRIPT".
We want it to say "scn MYNPCQUESTSCRIPT" instead so go a head and change that, then change the script type to Quest. Now if you save it, it will save it as a quest script with the name MYNPCQUESTSCRIPT. So your safe, you will not be saving over anything vital.
Now starting at the line below scn MYNPCQUESTSCRIPT delete everything down to the "begin gamemode" line, leaving the "begin gamemode" line in place. Then go to the line after "begin gamemode" and delete everything down to the word "END", leaving the "END" word in place and save the script.
It should look like this, if it does not, remove anything that should not be there and save the script again.
scn MYNPCQUESTSCRIPT
begin gamemode
end
What you have there is an empty script we will need later. Go a head and save and close the script window and the quest window, then reopen the quest window and go back to script box, select the arrow pointing down and find the script you just created, it was called MYNPCQUESTSCRIPT, select it so it appears in this box then leave it for now. The script only appears on the list AFTER you close the quest window, that is why we had to close it and reopen it..
You have just created an empty quest, time to work on the Dialog.
Creating the Dialog in GECK
Go the the Quest window and select the Topics Tab. In the topics window, select the white area to the left under the Quest Data Tab and select NEW. A select Topic window will appear, Right click, select new and enter the name "JimWhoAreYou" as our Topic, this will be the topic we use to get Jim Bob to tell the player who he is, which is why I chose the name JimWhoAreYou, it could have been called anything and he could be saying anything, it makes no difference if he is saying hello or explaining how to defuse a bomb. He might be part of some secret cult of mushroom worshippers and is reciting the cults prey or something, you can choose anything really or follow my text below.
In the Topic Text, change the name to say simply "Who are you ?", then in the window box under info right below the Topic Text, right click and select new and enter some text that Jim Bob might say to the player when the player asks who he is (or the prey of the Mushroom people lol, your choice here).
I used this text, you can use anything you like.
"I am Jim Bob, I used to be a used Donkey Sales Man but the donkeys died so now I am unemployed."
If you look down you will find a box named Response Text, I will now add a second line to Jims answer, right click in the white box under Response Text and select new, then add a second line and OK it.
I added "Shame really, I liked donkeys." to mine.
You can add more and more lines here this way until Jim has all the lines you want to give him. When I made the Elder Council Mod for Oblivion, I used a lot of lines to describe various Septim Emporers on the Lore Master NPC, but more lines means more voice work so remember that. To be honest Fallout 3s ability to use Wav files directly makes this much easier than Oblivion.
Now go to conditions, right click and select new, choose GETISID as the function name, click on the function parameters and choose our NPC JimBob (pressing J jumps you to the Js once the list appears), set Comparison to == and Value to 1.
Tip: What this means is this, if the NPC is JimBob, let him speak this line. In computer speak, you always read these things back like this.
Is this Jimbob == 1 and 1 means YES to a computer when used this way. If that confuses you, do not worry, its not important to this tutorial. Just thought I would thrown that one in for free.
Now go back to response text and double click on the first line of text, make sure your mic is working, your about to do some voice acting.
Notice under VoiceType MaleAdult02 is listed, if you go back and look at your NPCs own window, you will see this matches exactly what you selected in your NPCs Traits as your NPCs Voice Type.
Funny old world aint it bud, I believe I told you to expect this right at the top and here it is :)
Tip: These little tips may not make any sense to you right now but they help you understand how the editor settings effect the files you create and gives you a deeper understanding of the inner workings of GECK in the process. But its still excess information, not vital to this tutorial.
Time to record the first line, using your own natural voice, without any acting at all, simply read the line back in a normal way.
Tip: If you think your voice sounds funny, trust me if it does, then you sound funny all the time anyway and everybody already knows you sound funny and will be used to it by now. Usually though, it is just you that thinks that, it is all perfectly normal. Voice acting is good fun once you get over this initial "I sound funny" problem. Try doing a Terminator voice or something for a laugh if you want.
Now press record and do it, then preview it to make sure you did it right and save it. Press Okay when you get the error about the lipsync, lipsync does not work so do not even worry about it, just ignore it. Finally select Emotion Type and choose one, then set the Emotion Value to around 70 to make it show when you talk to Jimbob. 70 makes him smile visibly if you make him happy.
Now select the second line and record it like you did the first, set the emotion but increase or decrease the Emotion Value by 10 so the face appears to change slightly when the second line is read. This helps make up for the lack of lipsync, it stops the NPC looking too robot like.
Tip: Your newly recorded lines will be saved in Fallout 3\Data\sound\Voice\Your Mod name\Voice Type\ and will be wave files.
Tip: Whilst the game will play wave files perfectly ok, you might find it advisable to convert all the waves in to OGG files which are smaller and also supported by the game. If you do this, you can delete the wave files. I have avoided mentioning MP3s because Fallout 3 has problems playing back MP3s smoothly.
TIP: About Dialog File Names that get recorded.
When you record a voice file for a quest/topic, files like MYNPCQuest_JimWhoAreYou_00001552_1 are created. Every NPC you use to speak the line has its own line recorded to its Voice Type Folder in Fallout 3\Data\sound\Voice\Your Mod name\. If you have several NPCs using several different Voice Types all saying the same MYNPCQuest_JimWhoAreYou_00001552_1 line, then GECK will place a copy of MYNPCQuest_JimWhoAreYou_00001552_1 in each Voice Type Folder. These are exact copies that you have to get re-recorded if you want different Voice Types to sound different in the game. Otherwise, they will all sound like you.
There is one advantage though, support you added 3 new NPCs to your topic later and wanted them to use the same lines, you would not have to re-record the lines. You could create a folder named after the Voice Types that used inside your Fallout 3\Data\sound\Voice\Your Mod name\ folder and just copy the MYNPCQuest_JimWhoAreYou_00001552_1 from one folder to the new folders and the 3 new NPCS would also be able to speak the line automatically. This is true for Oblivion as well btw.
If you want to use existing in game dialog files it is best to extract them from the BSA first for compatibility reasons, then you simply make your quest dialog normally. Then get the original in game dialog file you want to use and rename it to match the file name your own recorded dialog created and just swap them over.
Finishing off our Script
Time to go back to the Quest Data Tab and select our script again.
Now we have to make a script to do the add the topics but we want to make it CPU friendly so lets make sure the add topic part only runs once.
Between scn MYNPCQUESTSCRIPT and begin gamemode, we declare our variables so we can use then later. We must do that now, this is actually common practice in a lot of programming languages, the commands may change but the vars are usually declared right at the top like this.
So between scn MYNPCQUESTSCRIPT and begin gamemode, insert the following line
Short IOnlyWantThisToRunOnce
Now we have declared our var (it can be any name btw) we can use it. Insert the following between begin gamemode and END.
if IOnlyWantThisToRunOnce == 0
Addtopic JimWhoAreYou
set IOnlyWantThisToRunOnce to 1
endif
What we just did is say "have you used IOnlyWantThisToRunOnce before, if not, then do the next few lines", that is what the 0 means, it means if this has not been used. Just as the 1 in the Jimbob question far above meant yes, this 0 means No. So the game then adds the JimWhoAreYou topic to the game which is the name of the topic you added in the TOPIC tab, (go to the Quest windows topic tab and check this needs to match the topic you entered in the Topics tab). Then we set IOnlyWantThisToRunOnce to 1 to say it has run once and finally end it with endif because we started with an IF command.
So there is a tip for you, if you start a function (that above is a function) with an IF command, you end it with ENDIF.
The final script should look like this.
scn MYNPCQUESTSCRIPT
Short IOnlyWantThisToRunOnce
begin gamemode
if IOnlyWantThisToRunOnce == 0
Addtopic JimWhoAreYou
set IOnlyWantThisToRunOnce to 1
endif
end
TIP: If you want to add more topics later, do this.
Change the name of the IOnlyWantThisToRunOnce var by adding a 1 to the end, so every place it said IOnlyWantThisToRunOnce, it now says IOnlyWantThisToRunOnce1. Then add your new topics after the first one above. The game can be fooled in to running the same function again. You can change it to 2 and 3 and 4 and update this as often as you like this way and know it will work with all game saves safely.
I used this trick to update players saved games automatically with new stuff when I released updates to Kvatch Aftermath. When others where telling people to start again or reset the mod. I was able to FIX save games on the fly, insert patches to quests and reveal new content any time I wanted using this simple quest maker trick. If you like at Kvatch Aftermaths scripting, especially the Jobs quest, you will see hundreds of patches implimented that way.
These are all things you can learn as you go and now you are a quest maker, you might as well start learning these tricks because they are very useful.
That should do it, you now have a working NPC with his own Dialog, walking around the Market place in Rivet City.
Making your Dialog Do Something.
This section is not as hard as it seems, but you will want to know it so you can have fun with Dialog in the future.
Unlike the tutorial sections above, this is more of a "Who do you do that" section, so put mod down and have a read, no need to add anything, it is all tips and tricks from now on just to get you started. Try experiementing with some of this stuff. I'll start with the hard stuff and get easier.
Lets open up our quest again, Find MYNPCQuest in the Quests menu of the Object Window again and open it up.
Tip 1: Getting the NPC to use Vars to check if the player has asked this line already.
This is good tip, you can use it to count how many times a line has been spoken and if that line just happens to say "give me a medi pack", you can effectively count how many medi packs you have given the player. So it is worth learning this one. So open up your quests script and right under the "Short IOnlyWantThisToRunOnce" line add this and save it.
Short IhaveRunXTimes
The var name can be anything, I just made that up for this tutorial
Now lets go to the Topics tab and find our JimWhoAreYou topic again. Select the JimWhoAreYou and take a look right at the bottom, below conditions, see the Result Script (Begin) and Result Script (End). Well enter this in the Result Script End (so it runs after the line has been spoken).
set IhaveRunXTimes to IhaveRunXTimes + 1
Tip: If the "set IhaveRunXTimes to IhaveRunXTimes + 1" was using a var from a completely different quest, you would need to change to say this. "set NameOfQuest.IhaveRunXTimes to NameOfQuest.IhaveRunXTimes + 1", replacing NameOfQuest with the name of the quest. This way one quest can read in the value held by another quests Vars. This is a good tip to remember. My The Elder Council Legion Quests used this extensively.
Each time the player asks Jim who his is, it will add 1 to IhaveRunXTimes, counting up.
If you went a head and made a second topic for Jim Bob just like the first one but added the "set IhaveRunXTimes to IhaveRunXTimes + 1" to the first topics Result Script as explained above. Then put the condition below in the second topics condition box. When IhaveRunXTimes reaches 10, the second topic will appear on Jim Bobs list of things to say, but not before the player has asked Jim to say his JimWhoAreYou topic is 10 times.
Condition Function = GetquestVariable
Function Parameters = IhaveRunXTimes
Comparison ==
Value = 10
If Jim was collecting for some charity and his topic was "donate some money to charity" and jim said "thank your" to the player and removed the donation money from the player as part of the topic. The the player would donate 10 times before the second topic appeared.
My The Necromancer Mod for Oblivion used this method to slowly let the player in to the Necromancers Inner Circle of friends and my Foundation mod is using it again to count the books the player hands in in order to slowly increase the Foundations Tech Level. So it is a very useful tip.
Tip 2: Quick ways to get the Dialog to do something when spoken.
Take a look at the Topics result box again, the end one.
You could add a perk like this.
Player.AddPerk PerkID
Where PerkID is the name of one the perks found in the Object windows Perk Menu, e.g. BlackWidow is a perk name.
TIP: Some commands can be used on the player and NPCs, these usually require you to name the actor first (eg player.command to be used, or NPC.Command to be used). Commands that only ever apply to the player do not require this.
You could use it to add Experience Points to the player like this. Only the player earns experience points so the above tip does not apply here.
RewardXP 100
You could change the players stats like this, making him 1 point stronger.
ModPCAttribute Strength 1
You could increase or decrease the players karma like this.
RewardKarma 100
or
RewardKarma -100
All of this goes in the Script Result box, you can do a lot there. Take a look at the Wiki's Scripting Functions for a list of things you can do here.