While the old Sierra games were mainly based on action and not talking, the
Lucasarts games took the opposite approach.
If you want to create a game with conversations where the player can choose
from a list of optional topics to talk about, you can now with the new Dialog
Editor. Go to the "Dialogs" node.
Conversations are made up of Topics. A "topic" is a list of choices from
which the player can choose. You may have up to 30 choices in a topic.
However, not all of them need to be available to the player at the start of the
game - you can enable various options for conversation once the player has
said or done other things. For example, when you talk to the man in the demo
game, the first option is just "Hi". Once he has said this, however, a new
option becomes available.
The Dialog Editor is quite self-explanatory. Double-click a dialog topic
to open up its window. You'll see the list of options for the topic on
the left, and the dialog script on the right. Each option
has a couple of checkboxes to its right:
- The "Show" column specifies whether that option is available to the player
at the start of the game.
- The "Say" column defines whether the character
says the option when the player clicks it. The default is on, but if you
want options describing the player's actions rather than the actual words,
you may want to turn this column off for that dialog.
Dialog scripts
You control what happens when the player chooses an option by editing
the script on the right. This is called the dialog script, and is a
simplified version of scripting streamlined for conversations.
With a newly created dialog topic, all you will see in the script is a number
of lines starting with an '@' symbol. In the dialog script, these signify the starting points of
the script for each option. For example, when the player clicks on option 3,
the script will begin on the line following "@3". There is also a special
starting point, called "@S". This is run when the conversation starts, before
any choices are given to the player. This could be used to display a "Hello"
message or something similar.
To display some speech, you begin the line with the character's SCRIPT NAME
(not full name), followed by a colon, then a space, and then what you want
them to say. For example, if my main character's script name is EGO, I would
write
ego: "I am very happy today because it's my birthday."
The character name is used by the system to choose the correct colour for
the text.
IMPORTANT: Do NOT include the "c" at the start of the character's
script name here.
You can also use the special character name "narrator", which
displays the text in the pop-up message box instead of as speech text; and the
alias "player", which will say it as the current player character - useful if
you don't know which character the player will be controlling when they speak
the conversation.
If you just use ... as the text for a character to say, the game will
pause briefly as if they are stopping to think, and nothing will be displayed.
To signal the end of the script for this option, place a "return" command on
the last line of it. For example,
@1
ego: "Hello. How are you?"
narrator: The man looks you in the eye.
otherman: ...
otherman: "I'm fine."
return
"return" tells AGS to go back and display the choices again to the player.
If you use "stop" instead of return, then the conversation is ended. Alternatively,
you can use "goto-dialog" or "goto-previous", which abort the current dialog script
and transfer control to the new dialog.
NOTE: Do NOT indent these lines with spaces or tabs. Indented lines
signify that AGS should interpret the line as a normal scripting command
rather than a dialog scripting command.
The dialog commands available are:
- goto-dialog X
Switches the current topic to Topic X, and displays the current list of
choices for that topic.
- goto-previous
Returns to the previous topic that this one was called from. If the dialog
started on this topic, then the dialog will be stopped.
- option-off X
Turns option X for the current topic off, meaning it won't be displayed in
the list of choices next time.
- option-off-forever X
Turns option X off permanently. It will never again be displayed, not even
if an "option-on" command is used.
- option-on X
Turns option X for the current topic on, including it in the list of choices
to the player next time they are displayed.
- return
Stops the script and returns to the list of choices.
- stop
Stops the conversation and returns the player to the game.
For an example of a dialog script, load the demo game into the editor and
look at the script for its topic 0.
Using scripting commands in dialogs
Often the provided dialog scripting commands won't be enough for what you want
to do in the dialog. You might want to give the player an inventory item or
add some points to their score, for example.
AGS now lets you put normal scripting commands in your dialog script, by indenting
the line with spaces or tabs. For example:
@1
ego: "Hello. How are you?"
narrator: The man looks you in the eye.
player.AddInventory(iKey);
Display("This line is displayed from a normal script command");
otherman: "I'm fine."
return
Here, you can see dialog script commands being used, but also then a
couple of normal scripting commands have been inserted, on indented lines.
When working with dialog scripts, the this keyword allows you to access
the currently running dialog.
If you want to conditionally break out of the dialog
script, the special tokens RUN_DIALOG_GOTO_PREVIOUS, RUN_DIALOG_RETURN
and RUN_DIALOG_STOP_DIALOG are available which you can return from inside
a script block. For example:
@1
ego: "Hello. How are you?"
narrator: The man looks you in the eye.
if (player.HasInventory(iKey)) {
player.Say("Actually, I'd better go.");
return RUN_DIALOG_STOP_DIALOG;
}
otherman: "Here's a key for you."
return
Parser input
You'll notice in the dialog editor, the property grid has an option called "ShowTextParser".
If you enable this, a text box will be displayed below the predefined options in the game,
which allows the player to type in their own input.
If they type in something themselves, then the dialog_request global script function
will be run, with its parameter being the dialog topic number that the player was in.
AGS automatically calls ParseText with the text they typed in before it calls dialog_request,
so you can use Said() calls to respond. See the text parser section
for more info.
|