Main Menu
Week of June 15th, 2009 Topics:
Homework: Dungeon and Quest
Week of June 7th, 2009 Topics:
Homework:
Week of June 1st, 2009 Topics:
Homework:
May 27, 2009 Topics Homework
|
GAME CONCEPT AND DESIGN
|
Glenda: Hello there. Are you a good witch or a bad witch? 1. I'm not a witch at all. |
The player then clicks on 1 and the box changes to:
Glenda: But you are dressed like a witch. 1. They dressed me like this. |
The player clicks on 1 again and the box is dismissed.
Ok...now delete all those lines and let's start a new one.
If the conversation were to run now, it'd look like this:
Gruntbelly: Guess how many fingers I'm holding up behind my back.. 1. I'll guess 3. |
And the player can click on the response he wants to have his avatar speak.
That's nifty, but it's not a very good conversation. Let's add to it.

Notice that each of the closing player lines has an [END DIALOG] meaning that it'll close the box and end the conversation. Now the when the player choose one of the three options and the conversation travels down that branch of the tree.
Links or "Loop Backs"
Let's suppose you want your player to learn about all sorts of things. So you want the NPC to offer a list of several options. The player chooses one, reads through it, and when he's done you want the NPC to offer the list again so the player can choose a different branch to go down and learn about the next topic. We do this with what I call a "loop back". Create a new conversation and make it look like this:

Now, before we do a loop back, let's take a side-trip. Click the bottom button on the left-hand button panel. It looks like a bunch of arrows all pointing inward. When you do this, the entire tree collapes down. Now click the next button up, which looks like four arrows pointing outward. Bam! The conversation tree expands.
Now back to the looping....
We can see that the NPC says "Let's learn about shapes!" and the player says "Whee! Sound fun!" Then the NPC asks "What shape do you want to learn about?" Next the player has 5 choices: Triangle, Square, Circle, Pentagon, or Nothing. When the player choose a shape, we travel down that branch of the tree, right? Here's the kink: When the player says the last line of the branch, we want the NPC to re-offer the line: "What shape do you want to learn about?" But adding those lines to the end of the branch would be ugly and cumbersome. So we're going to do this:
If you'd like to test the conversation, right-click on the Root node and select Test. It doesn't run exactly like the conversation does in the game, but it'll give you a fair idea of how it'll work.
Tokens : Built-in
It's always a nice touch if the conversation reflects the speakers or the circumstances around the speakers. You can make this work through the use of built-in tokens. Start a new conversation and type in the NPC line that reads: Hello there, don't click OK yet. Now, after the comma, right-click and select Insert Token. A window pops up showing a bunch of variables that you can choose from. Depending on which you choose, the conversation will "look around" and select the right option. For instance, select Brother/Sister, and click OK.
The text now reads Hello there, <Brother/Sister> so let's finish it up. Add in a . How are you? And click OK.
When the conversation runs, the game will check the sex of the avatar and put in the appropriate word.
Tokens : Custom
Creating custom tokens is a little tricky as it involves some scripting and we're not there just yet. Nonetheless, here's an example lifted (more-or-less) from the .pdf file.
Suppose the player is supposed to chop down 80 trees. So you put some "choppable" trees in your map and when the player chops one, you have a script that looks something like this (for you programmers, this is pseudo-code! It won't work!):
nTreesCut++;
SetCustomToken(200, nTreesCut);
So, we've created our own token with an ID of 200 and set it equal to the number of trees that have been cut.
Now let us suppose that the player has chopped down 45 trees, then goes to talk to the NPC, the conversation tree looks like this:

And where it says <CUSTOM200> the conversation will display the current value of the token--in our case 45. Working with custom tokens can be a bit tricky but is a nice touch when you can do it.
Colorizing the Text
You can do a limited about of colorizing the text in the conversation. When you want to change the color right-click in the text window as if you were going to insert a built-in token. You'll notice that there are four tokens that seem odd: StartAction, StartCheck, StartHighlight, and /Start. These do not actually start any actions, checks, or such but served other purposes in the NWN compaigns.
Sometimes in a conversation, one of the player options would not be a line of "spoken" text but would instead be an opportunity to use a skill...say Pickpocket. So the option to attempt to pickpocket would display to the player in red text, indicating that it wasn't a spoken line.
Although these tokens don't actually perform the actions, you can still include them in your conversation to colorize the text.
Including Other Speakers
Suppose you want your conversation to appear to come from more than one NPC. For instance, he's talking to the captain of the guard, and then a lieutenant pipes in with some text, then the captain, then the player, then the lieutenant...and so on.
Build your conversation. When you see [OWNER] that refers to the NPC that starts and "owns" the conversation. If you want another NPC to have a line, click the [OWNER] line in question, then click the drop down box that is labeled Speaker Tag. This will show you the tags of all the NPCs in the area. Select the tag of the NPC who gets to speak the line. If the third-party NPC is too far away from the conversation, the player will see the "generic" portrait in the conversation window and will be told that it comes from an "unknown speaker."
If you plan to add your third-party speaker through scripting, then its name won't show up in the Speaker Tag dropdown box. Instead, you can click the Add button and you'll see a list of all the blueprints of any custom creatures, doors, or placeables in your palette, and you can select the one that's going to get to speak the line. (I've never done this, so I'm not aware of any tricks.)
"Actions Taken" and other Events
One of the key parts of figuring out NWN is realizing that scripts can start conversations and that conversations can start scripts. Now, we're going to look at how to do that.
Actions Taken
At the bottom right of the window is a series of tabs. Click on the one that reads Actions Taken. This is where you have a line of conversation start up a script. Select the line you want to have fire the script, then enter the name of the script that should be run when this line of text is spoken.
It's important to note that the script will only run if the node to which it is attached is spoken. So if you attach it to a blue player line and the player doesn't click that line of conversation, then the script won't run!
Other Actions
Here you can inject some more life into the conversation by having the speaker of the line perform an animation or play a sound. You also have access to the Journal funtions which let you change the contents of the player's game journal. (More on that later.)
Comments
Go on...guess.
Current File
You may have to click the > arrow to scroll more tabs into view. There you will find Current File. This tab actually applies to the entire conversation, not any particular selected line.
Conditional Nodes
Conditional Nodes are nodes that appear in the conversation only when certain circumstances are met. For instance, suppose the player has to go find the golden apple and bring it back to the NPC.
Create a conversation tree that looks like the one below.

As you can see, all the options for the conversation are present. However, if the player doesn't have the apple, it wouldn't make much sense for him to have the option of saying "Yes." And if he did have the apple, we don't really want him to say "Not yet." (Unless fibbing is part of our game.) So we'll put conditionals on those lines.
Now, when the conversation runs, if the apple is not in the player's inventory, the "It's right here" line won't show up at all.
Ok, programmers, let's get rid of the Not Yet line if the person does have the apple. This one is a bit tricky because you want it to appear if the item is not present.
It's been a while since I've done this, but I think you can just take away the ! in front of HasItem and that'll do the trick. You might have to experiment with it a bit, but that's the idea. Once it's been flipped, then if the player doesn't have the apple, he'll only see the "Not Yet" line. If he does have the apple, he'll only see the "Yes, right here." line.
Then, of course, on the "Yes, right here" line, you put in an Actions Taken script that removes the apple from his inventory, gives him a reward of some sort, and so on.
NOTE: In case I haven't said it elsewhere, in order to use HasItem( ) as well as a bunch of other specialized commands, you need to put #include "nw_i0_tool" at the top of your script before anything else.