NWN2 TOOLSET HOWTO � WRITING CONVERSATIONS
In this HowTo, you will learn the basics of creating a branching conversation
tree that players can explore as they wish. You will learn a little about how
condition and action scripts can be used to make your conversations more
interesting and powerful. You will also learn how to attach the complete
conversation to a creature in your module.
TABLE OF CONTENTS
- Anatomy of a Conversation
- Conversation Scripting Basics
- Conditions
- Actions
- Writing a Dialogue
- Some Basic Conversation Tricks
- Attaching a Conversation to a Creature
- Conclusion
CONVERSATION BASICS
Conversations are an important aspect of NWN2 gameplay. They are used to
talk with companions, trade with a merchant, and get quest information from
NPCs. At its heart, a conversation is really just a branching menu, so a
conversation doesn�t necessarily have to be two people talking � if you want a
player to encounter an inanimate control panel with three switches, a
conversation with three responses would be an effective way of representing
the situation.
ANATOMY OF A CONVERSATION
Conversations can appear complicated at first, but you will soon be able to
write them quickly.
This screenshot shows a portion of Pitney�s conversation in the Sample
Module, 0100_UninvitedGuests. Conversations (sometimes referred to as
dialogues) are arranged in a branching tree, not unlike a folder directory in
Windows.
Each row or line in the conversation is referred to as a node. The leftmost
section is the text, which is what is displayed to the player.
Red nodes are lines that are spoken by the NPC. Blue nodes are the
player�s responses. A blue �[CONTINUE]� means that the player has no choice
to make at that node. In these cases, the conversation will proceed to the next
red line, allowing an NPC to make multiple statements before the player
responds.
- The text for the currently selected node. All of the information in the
Node Properties section (D) refers to this node.
- A series of options from which the player can choose. After the preceding
red node fires, the player will see these options and can click on (or press the
number of) the one he wishes to select. Note the + sign to the left of these
nodes, which shows that they can each be expanded.
- Other node information. By right-clicking on this region (choose
�Columns�) you can set which columns of information will be displayed. In this
screenshot, you can see Actions, Conditions, and Quest information for each
node.
- Node Properties. This section contains more details on the selected
node.
- Text. The text for the selected node is shown here. Just click on the text
box and type to change what the NPC says (red node) or what player option is
presented (blue node).
The grey nodes are links to other nodes within the conversation. Using links
prevents you from having to type the same line for the same situation.
To add a node to a conversation tree, just right click on the preceding node
and choose Add. A �New Line� window will appear. Just type in the text you�d
like the player to see. (The language selection Dropdown Menu and the �Edit
String Ref� button will not apply to your modules, but are used for the official
campaign.)
CONVERSATION SCRIPTING BASICS
Scripting in NWN2 is very powerful and can be complicated. In creating the
official campaign, we had many scripters who are a specialized type of
designer (or a specialized type of programmer, depending upon your
perspective) who spent their time mastering the scripting tools and
possibilities, creating new global scripts to be used in area creation.
The details of scripting are beyond the scope of these HowTos, but we�ll
discuss some of the very basics in the context of how scripts can be used in
conversations. The best way to learn more about scripting is to experiment
with the Sample Module and see how we were able to create it. Then play
around with conversations and scripts in your own modules.
Conditions
Conditions are test scripts that are attached to a conversation node and are
either TRUE or FALSE. When a condition is TRUE, then that conversation node
fires (is executed). For example, you might have an NPC who has two possible
greetings: the first is warm and friendly while the other is cold and standoffish.
If you placed a condition script on the first node to check if the player is
an elf, then elves would get the warm greeting and other races the cold one. In
this case, the condition script is being used to help establish the personality of
an NPC.
In the Sample Module, conditions are used to determine which of Pitney�s
dialog nodes will be displayed, based upon the player�s quest state. If the
player declined to help Pitney, then the poor fellow pleads again with the
player. If the player has killed the lizardfolk, then Pitney expresses his
gratitude.
If a condition is not met, then the player will never see that conversation
node. For a series of player responses (blue nodes), this might mean that the
player only sees 3 of the 4 possible choices. For an NPC statement (red nodes),
the first node whose conditions are met is shown.
If you experiment with the Sample Module, you will notice that there are 5
initial nodes for Pitney. Which one the player sees depends upon what has
happened so far.
- Node Properties Tabs. These tabs let you view different properties of the
conversation node. (In this screenshot, the Conditions tab is shown.)
- Condition Operators. If a node has multiple conditions, you can specify
�And� or �Or� to indicate whether they must all be true or if only some of them
need to be true for the node to fire.
- Script Name. This text box contains the name of the condition script. In
this case, the global script gc_journal_entry, which checks a journal (quest)
entry, is being used.
- Script Parameters. The remainder of the row for each condition shows
what parameters are passed to the condition script. In this case, the parameter
sQuestTag is given the value �01_lizardfolk� and the parameter sCheck is given
the value �10.�
The use of script parameters is very powerful and allows a single script to
be used in dozens of conversations. For example, gc_journal_entry can be
used to check any state for any quest in the entire game! The use of
parameters for scripts is a new function of the NWN2 toolset.
Note: If you add a global script to Conditions or Actions, or swap
one script for another, click the �Refresh� button to set the appropriate
parameters for the new script.
- Script Code. The documentation and code for the condition script is
shown in this window.
Actions
An action is a script that is used to accomplish a wide variety of tasks. An
action script is executed when a conversation node fires. For example, an
action could cause an NPC to become hostile to the player, move the player to
another map, or place gold in a treasure chest.
In the Sample Module, an action script is used to reward the player with
experience points for completing his quest for Pitney. Action scripts are set for
nodes similar to how condition scripts are set.
WRITING A CONVERSATION
Let�s try writing a conversation for victim of the lizardfolk holed up in Pitney
Lannon�s house. The player can talk to this person after dispatching the
lizardfolk.
To create a new conversation, use the Dropdown Menu at the top of the
Toolset and select File " New " Conversion.
Your new dialogue will be entirely empty, save for the Root node. As
mentioned in the earlier overview of a conversation, you can add your first line
by right-clicking on the Root node and selecting �Add.� This will bring up the
New Line window where you can input the first line of the dialogue. Note that
the first line after the root is always an NPC line.
Once you hit �OK� the New Line is added and you have the introductory line
for the victim.
If you were to add a line to this red NPC line, you�d be adding a player
response node. If you wanted the NPC to say two lines before the player
responded, you�d have to make an empty player node between the red NPC
nodes. Try adding a blank line to the introduction.
End Dialog? If a Player node has NO responses attached to it, it is a
conversation-ending node. Let�s see what happens if we add another NPC line
after the highlighted, empty PC line.
The blue player node switched to [Continue] now that an NPC line follows
it. Now that the NPC has said two lines, let�s add some player response nodes.
To give a player multiple possible responses at one time, add multiple times to
the same node. If you want three possible responses to the �I can�t feel my
leg�� line, right-click then �Add� on that line three times.
Now you have three possible PC responses to that line. Fill in text for each
line by clicking on the line, and then typing in the text box (lower-right of the
dialogue editor with the �Insert� button).
Since these lines don�t yet have any text following them, they are
dialogue-enders. If you�d like, you could continue to add NPC nodes, and
subsequent player nodes, to your heart�s content. The basics of adding lines
are quite simple.
Advanced Topic: Stores
Stores are only accessed through script in a conversation � they are not
objects that the player can detect. Stores have blueprints just like other types
of objects. After you create your store�s blueprint, place it on the map
normally. It is generally best to place your store next to the NPC. Check out
the Sample Module for an example of a store.
- Store Dialogue Node. This is the dialogue node that accesses the store in
the Sample Module.
- Script ga_open_store. This action opens your store. It is given the store�s
tag as a parameter.
- Store Properties Panel. To edit the contents of your store (and to initially
assign its tag), open its Property Panel. Click on the �Store� tab, then click the
�Edit� button to change its contents. You can them place instances of any
blueprint item into your store.
- Area Contents. All stores in an area can be seen here under the �Store�
tab.
SOME BASIC CONVERSATION TRICKS
Links are an incredible time saver when writing large dialogues. If you want
the conversation to return to a previous set of options, links let you do so
without typing re-typing everything over again.
Continuing with the previous conversation, let�s say that the survivor is
clinging to life, and if the player asks questions, the victim shortly collapses in
exhaustion.
In effect, the dialogue would look like this:
Notice that the �Why should I help you?� and �Who are you?� nodes lead
to exactly the same text. Writing this out is more work than is necessary, and it
clutters your conversation. There�s an easier way using links to streamline this
conversation.
First step is to remove everything after the �Who are you?� line � it�s no
longer needed. By Right-clicking on the �Please� help me�� line and selecting
�Remove,� that red NPC node and all nodes connected to it are purged.
Next step is to set the link. We want �Who are you?� to link to the line under
�Why should I help you?� Right-click on that line and select �Set Link
Destination.�
This flags the NPC node as being the new destination for any other player
node in the dialogue. Adding this to the �Who are you node?� is as simple as
right-clicking on the node and selecting �Insert Link.�
Once in, you�ll see a grey node attached to �Who are you?� This indicates
that if the player were to select �Who are you?� they would get bounced to the
same node as if they selected �Why should I help you?�
If you ever forget where a particular gray node leads, just double-click it.
The editor will take you to the destination node.
Links make the difference between writing a large conversation in a few
minutes versus a few hours.
Pipes and Braces can be used to write text that shows up in the Toolset but
NOT in game. Thus, if you are writing a long conversation and need to leave
notes to yourself that you don�t want players seeing in game, you can place
your text in pipes, |like this| or in braces {like this}.
The line above may look messy but the player will only see the text
�Thank you stranger, I won�t forget your kindness!� The conversation�s author
can keep tabs on what kind of response this is and leave a note to return later
and add a bump to the player�s Good alignment � neither of these notes will
ever show up in the actual gameplay.
Barkstrings are conversations with only NPC nodes and no player
responses. When speaking to an object with a barkstring conversation, the
game does not stop for a full branching conversation. Instead, the one red
node of dialogue floats over the speaker�s head without any halt in gameplay.
In the Sample Module, 01_ginni is an example of a barkstring
conversation. Pitney�s wife always speaks a single line and never allows the
player to offer a response.
Advanced Topic: Fall-through
Fall-through is a term for creating multiple NPC nodes and assigning
conditions so that, if the first node can�t be displayed, the process �falls
through� to the next red NPC node down the line. As mentioned earlier in our
discussion of conditions and actions, a node can be given a condition and if
that condition is FALSE, the line will not be displayed. Observe Pitney Lannon�s
conversation:
Notice how there are 5 red NPC nodes off of the root (indicated by the vertical
line dropping down from the word Root).
The first red NPC node that is TRUE is displayed, and the conversation
follows the nodes under it � the other nodes are effectively ignored. Here, the
author has used comments in pipes to indicate when and why each red NPC
node is used. When first speaking with Pitney, the first red line fires. Next time
in the dialogue, the game checks to see if the player refused to help and if so,
it plays the second red line, otherwise, it checks to see if he�s agreed to help�
and so on.
As you experiment more with conditions, you can use fall-through to
create very powerful, reactive conversations. The player may feel like it�s five
completely different dialogues, all custom-tailored to what events took place
already when really, it�s just one conversation using fall-through to create a
smart dialogue.
Advanced Topic: One-time-only Nodes
You may occasionally want an NPC to speak a line once and never repeat
it again. For example, in the Sample Module, Pitney�s initial conversation (in
which he tells the player about his problem and begs for help) occurs only
once. After this, Pitney will respond based upon the player�s quest state. This is
to create the illusion that Pitney knows and remembers the PC.
To set a dialog node as one-time-only, click the node in the Dialog Editor,
and select the �Node� tab in the Node Properties window (at the bottom of the
screen). Click the �Show Once� field, and you will be able to select from a
drop-down menu. The �Show Once� field defaults to �Always,� which means
that the node will always appear, unless Conditions dictate otherwise.
Set the �Show Once� tab to �Once per game� to ensure that the node will
only be called once, and will never appear again. Be certain that a fall-through
node follows the once-only node, however, or the conversation will simply
close.
For Persistent Worlds, it may be wiser to set the �Show Once� field to
�Once per creature that uses this conversation.� Otherwise, the node will be
displayed for the first player who views the dialog, but will never appear again!
ATTACHING A CONVERSATION TO A CREATURE
Conversations are placed on any creature or object that will talk to the player.
Select the creature or placeable and, in that object�s property window, look for
the �Conversation� field. Click on the field next to Conversation and click the
dropdown button. A list of conversations available in this module will appear
and you may select the one to apply to the creature. Now, when the player
tries to talk to this creature, the conversation event will take place.
CONCLUSION
Neverwinter Nights 2 offers an extremely powerful conversation system that
can look intimidating at first but is quite simple to use. Put your writing skills
to the test and see what sort of conversations you can offer your players! Now
that you�ve completed this HowTo, you should know:
- The basic structure of a conversation in NWN2.
- A brief overview of how conditions, actions, and scripting work in
conversations.
- How to write your own conversation.
- How to link and comment your text.
- How to hook up your conversation to a creature in the game.
|