Conversations with other characters

From ADRIFT 5 Manual Wiki
Revision as of 00:16, 20 July 2012 by Saabie (Talk | contribs) (Using a talk-to task)

Jump to: navigation, search

Construction.gif

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 from 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.

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

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

Active Goodbye

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.