Dialog is perhaps the most important part of making an adventure into a story. In Dragon Age, dialog is a collection of lines that are arranged in an interactive tree-shaped structure. This tree structure can be simple or complex, and each line can have conditions and actions attached to it that interact with the state of the world at large.
For this tutorial we will start simple and then progressively add new features and options to a conversation as we go. Later on there will be a separate tutorial for adding cinematic direction to conversations.
Creating and setting a conversation for a creature
In the creature tutorial we created a creature named "Quest Giver", who is standing outside a hut that's filled with monsters. The goal is to have the quest giver ask you to go in and kill all the monsters for him.
First, we need to create the conversation resource. Using the new resource command, select "conversation" and give it a resource name that will help keep track of its purpose. We're calling this conversation "conv_quest_giver". The new conversation starts out empty, with only a "root" node. The root node of a conversation doesn't contain any dialog itself; it is merely a container that holds various global settings that apply to the conversation as a whole.
With the root node highlighted, the global settings become accessible in the tabbed pane at the bottom of the conversation editing window:
These settings have defaults that will be perfectly good for a conversation between a PC and a single NPC, as we will be doing here. The "OWNER" of the conversation will be the creature the conversation is attached to - in this case, Quest Giver. The "PLAYER" is, of course, the player's character.
- Default NPC Speaker: This is the creature who, by default, responds to the player's dialog selections.
- Default NPC Listener: This is the creature who the NPC is directing those responses to. This is used to determine who the NPC should turn his head toward when speaking.
- Default PC Listener: This is the creature who the PC is talking to when he makes dialog selections, determining who the PC's avatar turns his head toward.
These settings can be overridden on a line-by-line basis, something you'll usually only need to do when you're writing a conversation with more than two participants. We won't do that in this introductory tutorial. It's also possible to have an inanimate object (a placeable) as a participant in a conversation, which we also won't get into here.
Also on this page are a number of checkboxes for locking cinematics. This is usually used to prevent the toolset from generating new automatic animations after you've fine-tuned things manually, we won't need to worry about that for now.
Once the conversation resource is created, we'll need to tell the quest_giver creature that he's supposed to use it when the player tries to talk to him. Open the quest giver in the creature editor and change his "Conversation" property from the default (none) to "conv_quest_giver" by pressing the ellipsis () button and selecting the conv_quest_giver dialog.
Adding some dialog
To add a line to the root, you can right-click on it and select "Add Line". It's also available as a button in the toolbar (button #23, below) and with the shortcut "control-A".
The added node will be in red text, indicating it's non-interactive (spoken by the NPC) and tagged with [[[[OWNER]]]] to indicate who's speaking it. When the player initiates conversation with the conversation's owner, this is the first line that will be said.
To determine what it is that the conversation owner says, select the node and go down to the dialog tab to enter the text. For the time being we won't need to worry about the other options below the dialog's main text entry field.
Once the creature has spoken its line, the player needs to be prompted to give some sort of response. The player could greet the Quest Giver, ask him a question, or choose to ignore him. To add these options, select the line you just added and "Insert line" three times. This will add three blue lines as children of the red one. In each of these lines' dialogue tabs, add the text of the response the player can give.
Here's how it looks in game once we've initiated this conversation:
The conversation can continue being built in this vein with one NPC response for each of the player's options and one or more player options branching out in turn. When the player runs off the end of the conversation it ends, sending him back to explore mode.
Thanks to this branching pattern it is possible for a conversation's volume to grow at an exponential rate, rapidly becoming very tedious to write. Worse, there could be many points within a conversation tree where the same lines might be spoken, leading to redundancy. This can be solved by "linking" lines to each other, allowing the conversation to jump from one branch to another or to loop back on itself to replay parts over again.
In this example, we'll have the Quest Giver respond to the player's first option with "Excellent! I have a quest I need performed for me!". At this point the player could respond with the same "Oh? What quests do you have in mind?" line that was an option initially, leading to the same response. Rather than duplicate the entire tree, select the existing "Oh? What quests do you have in mind?" line and copy it to the clipboard (control-C, or right click copy, or edit -> copy). Then select the new owner line and paste as link (control-shift-V, right click paste as link, or edit -> paste as link)
The linked line is shown in gray. To find out where a grey line links to, right-click on it and select "Jump to Target" (or just double click it). To find all the places the target line is linked to from, right-click on it and select "Find Links"
Now both of these paths through the conversation will lead to the same line, wherein the Quest Giver tells the player that the hut behind him is full of monsters. We can add an option to the dialog after this where the player can accept the mission to slay them all, and now when he enters the hut to fight them there will be more of a story behind about how he came to that point.
Keeping track of quests via plots
Now that we have a mechanism in place where we can assign a quest to the player we'll want some way to keep track of his progress. In Neverwinter Nights this was done using scripting directly, but in Dragon Age a new type of resource has been introduced that helps to simplify the process. These are "Plots". Go to the resource palette and create a new plot with the resource name "clear_the_hut".
A plot consists of a series of named flags that can be set to true or false. The intent is for these flags to represent significant accomplishments or developments in the plot, with the values being set in response to the player's actions. Each flag can also have an associated journal text, a block of text that is displayed in the player's journal under the plot's title. Journal text is normally used to keep the player informed of his progress and remind him of important information he's discovered along the way.
We'll need to give the plot a "Name" property, which will be seen by the player as the plot's title in the journal. This plot's name will be "Clear the Hut". There are three significant landmarks in the course of this plot; the moment the player accepts the plot, the moment the player has succeeded in slaying all of the monsters in the hut, and the moment when the player reports back to the quest giver to receive his reward. We will therefore create three flags:
Create flags by right-clicking on the plot editor and selecting "Insert -> Main Flag", or by clicking on "Insert Main Flag" in the toolbar, or by selecting "Edit -> Insert -> Main Flag" from the menu bar.
Each time a plot flag is set, that flag's journal text replaces the previous text that was in the journal for that plot.
The easiest way to set a plot flag is in a conversation. When the player accepts the quest to slay the monsters in the hut, we'll want to set the "QUEST_ACCEPTED" flag of the clear_the_hut plot. Select the line where the player accepts the quest and then click on the "Plots and Scripting" tab. Under the "Action" section we'll want to select the clear_the_hut plot. It won't initially appear in the dropdown list since we haven't selected it before (the dropdown list contains recently-used resources), so click on the ellipsis button and select it from the list of all plot resources. Then, once the correct plot is accepted, select the "QUEST_ACCEPTED" flag. The default action is "set", which will set the flag to true.
Now when we reach this line in the conversation, the "QUEST_ACCEPTED" flag in the clear_the_hut plot will be set to true. This will also update the player's journal to show the journal text associated with that plot flag. You'll note that an "A" also appears in the icon for this conversation node, an indicator that this line of dialog has an action associated with it.
Once the quest has been accepted, it makes no sense for the Quest Giver to offer it a second time. Indeed, if the player were to partially complete the quest and then accept it all over again, his progress through the quest would be disrupted and quite likely unexpected errors would slip into the game. Therefore, we are going to go back to the first line in this conversation and add a condition to it. Select the first line, go to the "Plots and Scripting" tab, and this time put the "clear_the_hut" plot in the condition section. Set the flag to "QUEST_ACCEPTED", and set the condition to "is false".
This means that this line of dialog will only appear if the quest has not yet been accepted. You'll note that a "C" appears in the node icon to indicate that this line of dialog has a condition attached. Since all of the other lines of dialog depend on this line appearing, including the offer of the quest and the line where the player accepts it, this means that the quest can only be accepted once; once it's been accepted the quest giver will not offer it again.
However, this will now leave the quest giver with nothing at all to say. We'll want to give him a different line to say instead. Select the root node of the conversation tree, add a line, and you'll get a second "first" line for the quest giver to say. The game will always pick the first line that can be spoken, so the player will never see the line "Have you slain the monsters yet?" until after he has accepted the quest and the line "Ahoy! I am the Quest Giver!" becomes hidden.
Conditions can also be placed on player lines. In this case, we want the player to only be able to tell the quest giver that he's completed the quest once the monsters are actually dead. We'll be showing how the MONSTERS_SLAIN flag will be set up later, using scripting, but the details of how it is set are not important right now; we can set the conversation up to account for it and implement it later.
Set the condition for the line "Yes, I have" to require the MONSTERS_SLAIN flag to be true. The subsequent response from the quest giver can then set the REWARD_RECEIVED flag to true.
To prevent the player from accepting his reward multiple times, add a condition to the line "Have you slain the monsters yet?" to require REWARD_RECEIVED to be false. Finally, add a third line off of root for the quest giver to say once the quest has been confirmed completed and there's nothing more for him to do.
And there you have it, a simple interactive conversation that will affect and be affected by the world around it.
If you run through the conversation as it currently exists you'll find that all of the mechanics are there, but that the performance of our virtual actor leaves a lot to be desired - he simply stands there silent and motionless, staring at the player. The camera angle is also somewhat bland. This can be remedied by adding a stage to perform the conversation in.
A stage is a set of locations where the participants in a conversation will be positioned, and locations where various cameras will be placed. Create a new stage resource and name it something informative, such as hut_exterior_quest_giver. You'll be presented with an empty, featureless stage. The stage editor window defaults to having four different views of the stage; if you want to change this you can find the setting for this under the "Tools->Options" menu.
Stages can be complex but in this case we'll keep it simple. Right-click somewhere near the center of the stage and insert a "place" object, and then again to insert a second "place" object. You'll create two blank-looking yellow figurines. These figurines will represent the two creatures who will be involved in the conversation, the player and the quest giver. You'll want to turn one of them to face the other and put them relatively close together.
You'll then want to insert a camera for the conversation to use. Right-click, select insert, and select camera. Position the camera so that it has a view over the shoulder of one of the two figures and is looking at the other figure, a standard over-the-shoulder shot. You can adjust the camera more easily by setting one of the four views to be the camera's view; right-click on the frame, go down to the "camera" option, and select which of the cameras the frame should provide the view of. You can also select the "Safe Frame" option, which puts a border on the view showing only what will be visible in-game.
For each place you'll want to define a default camera; this is the camera that will be used to view the creature standing in this place when that creature is talking in the game. Select the place and in the object inspector select "camera1" for the default camera.
If you wish, you can put in additional cameras. In the conversation editor you will have options to select which cameras are active, and even to cut from one camera to another in the middle of a line. We won't do that yet, however; we currently want this to be as simple a stage as possible. A future tutorial will cover stages in more depth.
Once the stage has been created, we'll need to place it in the area where the conversation is to take place. Open the hut exterior area in the area editor and go to the location where you've placed the Quest Giver. Find the stage in the resource palette, place it in the area, and you'll see the blank figures and the camera appear. There will also be a red flag similar to a waypoint; this marks the center of the stage and is useful for distinguishing them when there are many stages overlapping each other in an area. Position the stage so that the place where the quest giver will be standing is approximately where he is right now; it doesn't have to be exact, but if he changes location dramatically when the conversation starts it might be a bit jarring.
Now that the stage has been placed, we can set the conversation to use it. Go back to the conversation editor, select the root node, and then select the "Cinematics" tab. There will be an option there to set a stage. Since we've never selected this stage before it won't be in the dropdown list, use the ellipsis button to select the stage from the available stage resources.
Once the stage has been selected the two places that are part of the stage will be listed below. You'll want to assign them to the two participants in this conversation, OWNER and PLAYER.
Select the root node of the conversation and then click on the "Generate Gestures for Children" button (#35 on the toolbar, or in the right-click menu for the node, or in the edit menu)
This will run through all of the nodes beneath root and automatically generate some random gestures appropriate for a man standing and talking to someone. These gestures can be customized and fine-tuned, but this will be the subject of a separate tutorial.
Now at last our actors are a little less wooden; they move around a bit, and the camera is in an interesting place. But their faces are still completely blank. This too can be easily remedied.
Voice-over and FaceFX
Every line of dialog in Dragon Age can have voice-over recorded for it, which as one might imagine can be a daunting task. As a temporary measure during game development you can instead generate a temporary placeholder voice-over using a basic speech synthesis program. Under "Tools" select "Generate VO" and synthesized voice-over will be added to every line.
The synthesized voice over is very primitive, but it allows you to test the conversation and fine-tune other details without having to record voice as you go - you can leave voice recording until later, once you've finalized all the dialog. It also allows us to generate a facial performance using FaceFX.
The most obvious component of facial performance is lip-synching. FaceFX generates lip-synching from the actual audio of the line, not just from the text of the dialog, so voice over needs to be generated before FaceFX can be run. FaceFX also adds emotional cues to the character's expression using an extension called RoboBrad. You can select the emotion to be added from the "Emotion" field in the cinematics tab for each line of dialog.
Once you've generated a facial performance, you can fine-tune it by selecting "Edit FaceFX" from the tools menu. This will open FaceFX with the selected line of dialogue loaded. We won't be doing this in this tutorial, but if you want to try it out and see what options FaceFX provides see the FaceFX page for more detail.
To record your own voice-over, you'll need some method for recording your voice (Windows comes with a basic sound-recording program but other more sophisticated programs are available free for download as well) as a wav file. The wav file must be recorded in or converted to PCM 24 khz 16 bit mono format, otherwise the process will fail and an unhelpful error message will be displayed.
Real vo needs to be stored in ~installpath~\Dragon Age\addins\[moduleuid]\module\override\toolsetexport\[lineid]_m.wav - you can dump wav files anywhere under the toolsetexport directory and they will be picked up but for organizational purposes you should probably organize it into subfolders grouped by conversation.
The wav file's filename must be of the form "[lineid]_m.wav" with [lineid] replaced by the ID number for the conversation line's string table entry. For example, if a conversation's line ID number is 344169, you'd save the voice over for this line as "344169_m.wav".
When you select "generate vo" from the toolset, the toolset will first check the above directory for properly named files. Any wav files that are not present will have robo vo created, and any that do exist will be used as-is.
A quick way to verify that voice over generation worked after processing: go to ~installpath~\Dragon Age\addins\[moduleuid]\core\override\toolsetexport\[conversationname].fsb and play it with windows media player. You will hear all of the vo lines for that conversation packaged together with whatever combination of real and robo vo all slapped together in one file.
Note that when you are doing a Builder_to_player create, you do not need to include the .wav files within the package. The sound used by the game is all stored in the .fsb files, and thus including the .wav files will only unnecessarily increase the size of mod.
Conversation history not showing up in the player's journal
The journal has a conversation history tab that you'll want your dialogue lines to show up in as well. If that doesn't seem to be working right or at all, make sure you check your dialogue and creatures back in before exporting your talk table. See the section on generated string IDs for more information.
|Language:||English • русский|