What fun would an adventure be if there were no other characters to talk to? Not a lot, it has to be said.
How much you go into dialog depends of course on your game style.
Generally, Sierra games used to just have one fixed line of dialog which
the characters would talk about, possibly changing if you talked to the
same person again.
Lucasarts games (and some Sierra titles such as QFG) on the other hand,
had complete dialog trees through which you could choose your topics to
talk about.
AGS lets you do it whichever way you want. We'll start off by looking at the complete dialog tree approach, and then see how easy it is to cut it down to get a Sierra-style system.
Now, before we go any further, let's consider for a moment what conversation structure we want. It's going to be a lot easier to implement if we have this planned in advance. For this tutorial, we'll go for a structure like this:
Our planned dialog tree
In other words, when we first speak to the other character, we will say
"Greetings!". After he replies, we will then be presented with
three options to choose from.
The "Tell me more about your wares" option will then lead us to
be able to ask a different set of questions.
Before we begin, we need to create a second character - we can't just
have Roger talking to himself! Go to the "Characters" pane, and
click the "New Character" button tucked away underneath the list
box. Give the new character a name, I'll call him Merchant.
Now - and this bit is vital - you also need to set this new character's script
name. This is the name by which we refer to him when creating our
dialogs. I'll just use "MERCHANT" as the script name.
Ok, all done? Go to the "Dialogs" pane in the editor, and we are presented with a rather empty looking screen:
The "Dialogs" pane
Conversations in AGS are made up of topics. A topic consists of a set of options that the player can talk about - not all of which are necessarily available to the player at the start of the game. When the player selects an option from a topic, the topic's dialog script is run.
Each topic can contain some startup text, which is displayed before the options are presented to the player. Our "Greetings" line qualifies for this, so we don't need to make a special topic for it.
Right, let's make our first topic. Click the "New option" button three times, and three new rows will appear in the window. Type an option into each:
We've inserted three options for topic 0
While we're at it, let's create the next set of options too. Click the "New topic" button (you may have to scroll down to see it - it's hidden under the topic list box), and a new blank Topic 1 is created. Again, create three new options and type them in.
Now, go back to the first topic (select "Topic 0" in the list box), and then click the "Edit script" button. You'll be presented with a new window that looks similar to this:
The dialog script editor
Each of the "@" lines is an entry point. These define the different places where your script can start. The "@S" entry point happens when the topic is first entered - and so this is where we want our "Greetings" text to be displayed.
Dialog scripting is very simple. It takes the form:
CHARID: "Text to say"
So, in between the "@S" and the "@1" lines, insert a couple of new lines, and type the following:
EGO: "Greetings!"
MERCHANT: "Hello there!"
return
Remember, these are the script names of the characters. The "return" is essential, because it tells AGS to stop running the script at that point and to display the options to the player.
The numbered entry points will be run when the player selects the appropriate option - for example, if the player clicks the "Who are you?" option, then entry point @1 will run.
Here's a finished script for this topic:
Our finished dialog script
The goto-dialog command takes the
player to another topic - in this case, topic 1 (with questions about the
merchant's wares).
The stop command tells AGS to end the conversation and return to
the game (whereas return returns them to the list of options to
talk about).
Go to the File menu, and choose "Exit and save changes" to save our script. But we're not quite done! We've got to deal with our second topic too!
Select "Topic 1" in the list, and then click the "Edit script" button. Fill it in however you like. You can use the goto-previous command to take the player back to the first list of options when they get bored of talking about his wares.
Here's my completed script for topic 1:
Dialog script for topic 1
As you can see, it's done very similarly to the first one. Notice the use of "return" in the startup entry point, to make sure that it doesn't go on and run the next bit of script straight away.
We're almost done! All we've got to do now is add a way for the player to initiate the conversation.
Go back to the "Characters" pane, and select your new character (MERCHANT). Change his starting room to room 1 (ie. the same as the player character), and position him at let's say X:260, Y:130. You can always change this later.
Now, still with the Merchant selected, click the Interaction button. Using your skills from earlier on in this tutorial, add a "Game - Run Dialog" command for when the player talks to the Merchant. Close the window, save the game, and we're all set!
Test the game, talk to the Merchant, and try out the conversation.
More on conversations
You may have noticed the "Show" and "Say" tickboxes on the Dialogs pane. You'll have noticed that when the player selects an option, the player character will say the option text. However, there are times when you won't want this to happen, and if you un-tick the "Say" box for an option, the character won't repeat the text when the player selects it.
The "Show" box determines whether the option is initially available to the player. If you uncheck it, then that option won't appear to start with. You can enable it later using the option-on dialog script command, or the "Game - Enable dialog option" interaction command.
There is also a dialog script command called option-off, which you can use to stop a particular option from appearing once the character has found out all the vital information. See the manual reference for more.
If there is only one option enabled for a topic, then the game selects it automatically. You can use this to make Sierra-style conversations, because the options will never be shown to the player in this case.
Go to part 9: Cursors and fonts
Tutorial last updated 20 April 2003. Copyright (c) 2003 Chris Jones.