Difference between revisions of "Conversations with other characters"
(→Active Goodbye) |
(→Enter Conversation task) |
||
Line 131: | Line 131: | ||
Note that neither the Active or Passive introduction is shown in this case. It is assumed that the task that performs this action will itself print everything that Mildred needs to say at this time. | Note that neither the Active or Passive introduction is shown in this case. It is assumed that the task that performs this action will itself print everything that Mildred needs to say at this time. | ||
+ | |||
+ | <table border=0><td bgcolor="#000000" width=500> | ||
+ | <FONT COLOR=#FF0000><b>></b> pick flowers<br /></FONT> | ||
+ | <FONT COLOR=#00C080>You reach down to pluck a flower from the flower bed. | ||
+ | |||
+ | "Err, excuse me," the old lady exclaims. "That's a bit impolite isn't it?". | ||
+ | </FONT></td></table> |
Revision as of 06:38, 30 July 2012
This tutorial describes how to use conversation tree's to give a character the ability to converse with the player in a natural way, responding in a sensible way to what the player tells them and questions asked of them.
Contents
The sample game
The sample game used in this tutorial is written to C:\Program Files\Common Files\ADRIFT\Samples\Conversation.taf (or the equivalent on your operating system) by the ADRIFT installer.
Double click on it to open it in the developer, then press the run button to start the game and follow this tutorial.
This sample has two locations, and at one of these locations is a bed of flowers and a character called Mildred.
Introduction
When the game starts you will get the introduction, a description of the initial location (and Mildred) and a mention of the exit to the south:
Conversation Sample To start a conversation, type "say whatever to whomever". By the flower bed |
The title in red is from the Bibliography page of the Options.
The first text to be output is from the "Introduction & end of game" dialog box.
Because "Display first room description" is ticked, the short (in boldface) and long description of the location is shown next.
- The player can turn off the display of the short location description using the runner options.
When a character is present at a location, we would normally get a message like "The old lady is here", but in this case the mildred character has the following in her "What to show when character is in location" property.
%PCase[%CharacterName%]% is kneeling down next to the flower bed, tending the flowers.
The %CharacterName% function is used to ensure that mildred is described as "an old lady" initially, then by her proper name once the player learns what it is. The %PCase[]% function capitalises the first letter.
Finally "An exit leads south" is printed because the "Show exits from locations as well as descriptions" option has been ticked on the General tab of the games' Options.
Using a talk-to task
The simplest way to do a conversation is to write a "talk to %character%" task which simply displays a pre-written conversation. This tutorial is for a much more interactive conversation, but we should still provide a response if the player types this.
We dont know Mildred's name yet, so enter the command "talk to old lady". A "Talk to character" general task has been created which contains the message:
Try <u>say</u>ing something, <u>ask</u>ing about something or <u>tell</u>ing someone something.
So the player will see:
> talk to old lady |
This has been added to explain to the player that they need to use the "say", "ask" or "tell" commands in a conversation.
The Character Conversation tab
Conversations are usually specific to a particular character, and if you open the Mildred character and go to the Conversation tab you will see listed the thirteen conversation topics that have been added to this character.
Usually the first thing a character will say is one of the introduction topics, shown with a green arrow, which will either be active or passive.
Open the Active intro:
Notice that under "Type of topic" that both "Introduction" and "General Command" are selected.
Selecting "Introduction" indicates that this will be the first thing that the character will say, and prevents the passive introduction from being shown.
Selecting "General Command" allows you to enter a command in the same way as in a general task. But conversation commands must be preceeded by the command "say", so the player must type "say hello" to trigger the active introduction:
> say hello |
If the player had typed "say hello to old lady" then they would obviously be talking to Mildred. Because they did not say who they wanted to talk to, ADRIFT automatically checked to see if there was one other character in the same location and picked that character (printing the "to an old lady" message to say who was chosen).
If there were multiple characters at the same location then the player would have to say who they wanted to say hello to, however once a conversation has been started it will be assumed that they will continue talking to the same character and so they wont have to enter the characters name again until they leave that conversation.
Note that the default description has been set to display only once, so if we say hello again we get Alternate Description 1 which will print:
> say hi there |
Using the Restriction: be in conversation with
The description for Mildred says:
%CharacterName% looks to be around 60 years old, with silver hair. She is wearing her gardening clothes, and is kneeling down next to the flower bed
But it also has two alternate descriptions:
, busily tending the flowers.
and one with the restriction "The player character must be in conversation with character Mildred", set to display after default.
. %CharacterName% is looking up at you, trowel in one hand.
If you examine the old lady now, while you are in conversation with her, the restriction will pass and show the default description followed by the second alternate description:
> x old lady |
If we leave the conversation (by saying goodbye, which is described in the next section) the restriction will now fail, displaying the default description followed by alternate description 1.
> say goodbye |
Active Goodbye
This is the "Active goodbye" topic. It has both "Farewell" (which exits the conversation) and "General Command" selected.
The command for this topic must be preceeded by "Say", so the player can type "say goodbye", "say bye", or "say cheerio".
Enter Conversation task
Using any of the conversation commands will put the player into conversation mode, but you can also start a conversation with a task.
If you look at the "Pick flowers" task you will see that it contains a response from Mildred. Because she has spoken to the player we need to put her in conversation mode, so on the Actions tab you will see the action "Enter conversation with character Mildred".
Note that neither the Active or Passive introduction is shown in this case. It is assumed that the task that performs this action will itself print everything that Mildred needs to say at this time.
> pick flowers "Err, excuse me," the old lady exclaims. "That's a bit impolite isn't it?". |