Conversations with other characters

From ADRIFT 5 Manual Wiki
Jump to: navigation, search

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.

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
This is a very basic sample of conversation trees in ADRIFT 5.

To start a conversation, type "say whatever to whomever".

By the flower bed
There is a small flower bed here, with pretty flowers in it. An old lady is kneeling down next to the flower bed, tending the flowers. An exit leads south.

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.

ConversationIntro.jpg

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
Try saying something, asking about something or telling someone something.

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.

ConversationMildred.jpg

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:

ConversationActiveIntro.jpg

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
(to an old lady)

"Hello there", you say

She looks up from her gardening. "Oh hello there, what can i do for you?"

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
"Hello again", you say cheerily

"Ah hello again to you too, How are you?"

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
The old lady 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. She is looking up at you, trowel in one hand.

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
"Well, I gotta go and explore this place. Bye for now."

"OK, Bye then". The old lady goes back to tending the flowers.


> x old lady
The old lady 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, busily tending the flowers.

Active Goodbye

This is the "Active goodbye" topic. It has both "Farewell" (which exits the conversation) and "General Command" selected.

ConversationActiveGoodbye.jpg

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
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?".

General Commands

Topics that have "General Command" selected, but neither "Introduction" or "Farewell", are things that the player can say to the character during the conversation.

In the example, these are the "Fine thanks", "Introduce yourself", "Nothing much" and "Say Sorry" topics.

Here is the "Introduce yourself" topic:

ConversationIntroduceSelf.jpg

The text of the conversation repeats the text they entered back to them, and tells the player Mildreds proper name.

> say my name is john smith
"Oh, by the way, I'm John smith.", you say.

"Ah, hello John smith, I'm Mildred. It's nice to meet you."

Now that the player knows what the characters proper name is we need to set its "is this character known to the player" property, so that the %CharacterName% function will now display the characters Proper name (Mildred), and also so that the player can refer to the character as Mildred in commands:

ActionKnownToPlayer.jpg

Asking

The remaining topic types are "Ask" and "Tell".

These both use a comma separated list of keywords which are matched to the players input.

When the player Ask's Mildred about something, whatever words they type are checked against the keywords in all the Ask topics and whichever topic is the best match is displayed.

The same thing happens for Tell topics when the player Tell's Mildred about something. Note that the same topic can be both an Ask and Tell topic if you want the same topic to respond to both commands.

Here is Mildred's "Ask about flowers" topic:

ConversationAskFlowers.jpg

If the player now types "ask about" followed by any text that contains the word "flowers", then this topic will be displayed:

> ask about roses, petunia's and other flowers
"So, what's with the flowers?", you ask.

"Gardening is my hobby", Mildred replies. "Do you like them?"

Conversation Tree

On Mildred's conversation tab you will have noticed that several of the topics are indented under the "ask about flowers" topic.

These define topics that are only used when their parent topic has just been displayed.

The "ask about flowers" topic ends with Mildred asking the player "Do you like them?".

If the player answers this question by typing "say no", then the general command "Reply No (want flower)" topic will be run.

If they "say yes" then Mildred will ask if you want one, which moves the conversation to the two topics under that node and which also accept yes/no answers in this particular example.

The "Reply Yes (want flower)" topic contains an action which moves a "flower" object into the players inventory, so if the player answers "say yes" to both questions then they will get the flower:

> ask about roses, petunia's and other flowers
"So, what's with the flowers?", you ask.

"Gardening is my hobby", Mildred replies. "Do you like them?"
> say yes
"Yes, I love flowers", you exclaim.

"Really?", Mildred asks. "Would you like one?"
> say yes
"Ooh, that would be lovely, thank you."

Mildred picks one of the flowers from the garden and hands it to you. "There you go."
> inventory
You are wearing nothing, and are carrying a flower.

Passive Goodbye

The passive goodbye can be triggered either by leaving the location or starting a conversation with a different character.

Move south to the other location:

> south
Mildred goes back to tending the flowers. You move south.

Somewhere else
If you were in mid-conversation with she and you moved here, she will have gone back to tending the flowers (implicit farewell). An exit leads north.

If you move north again you will see that Mildred is now tending the flowers, and is not in conversation with you.

Passive Intro

The passive introduction is shown if you start a conversation with the character by using any Ask, Tell or Say topic except for an Active Intro.

If we had asked Mildred about the flowers while we were NOT in conversation with her, she would have given her passive introduction before responding to the question.

> ask mildred about flowers
Mildred looks around in surprise as you begin to speak. "So, what's with the flowers?", you ask.

"Gardening is my hobby", she replies. "Do you like them?"


<<< Character WalksMain PageUsing an event to delay a poisons effect >>>