Contents

Dialog Introduction

Firstly, there are two methods for creating dialogs. As briefly documented in the article on Quest creation, there is a 'static' dialog tree which allows for a fairly simple conversation to be defined. Additionally, you can create 'dynamic' or script controlled dialogs.

Static vs Dynamic - which to use.

For most dialogs, the static dialog will be simpler and sufficient. It will define a pre-planned conversation tree that can branch either by user selection, or the use of 'preconditions'.

Dynamic dialogs will use script to determine how the conversation progresses instead of a pre-planned tree. In the standard game, nearly every stalker has the option of having 'cool info' that more or less randomly gives a response when you ask if they know anything interesting. This uses a 'dynamic' dialog with script 'randomly' deciding which response the stalker will give.

Static Dialogs

A simple static dialog might be as follows.

1 - Hey, man, what's up?

2 - Not much, how are things with you?

11 - Pretty good, thanks.

111- Good to hear, keep it up.

or

12 - I've been better.

121- Well, tomorrow's a new day, here's hoping for better luck.

or

13 - I'm scraping bottom here, man.

131- That sucks, mate. Sorry to hear it.

So a simple conversation with one opening line, one response, and three branches for the third response. We may choose to let the user pick one of the three branches, or limit which are available with preconditions.

To define this dialog statically, we would make a dialog xml structure, and insert it into one of the dialog*.xml files in the config\gameplay folder.

Preconditions

Both Dynamic and Static dialogs allow the use of the <precondition> tag. Preconditions are script functions that must return 'true' for the dialog to be enabled. Many precondition functions are defined in dialog_manager.script.

It is important to note any errors in dialog_manager.script will prevent the dialog_manager global from being assigned and will crash the game immediately with the message

Which dialog*.xml to use

You will have noticed there are several dialog*.xml files in the config/gameplay folder. One is generically named dialog.xml, and the rest have a zone name in them (IE. dialog_escape.xml) Very basically, all zones will include the dialog.xml and the zone specific xml... so if your new dialog will only show up in one zone, add it to the zone specific (to keep resource usage down), but if it will be used in multiple zones (all zones), you may add it to the dialog.xml.

Text Strings

In all of the dialogs, you have put an identifier, not the actual text you want to appear. This is to allow multiple language versions of the game. You must add entries to the appropriate stable_dialog*.xml file(s) for the languages you will support.

How to add dialogs to characters

Dialogs are added to characters via <start_dialog> or <actor_dialog> tags in the character definition. These determine who is speaker1 and who is speaker2. <start_dialog> tags indicate the npc is starting the conversation and is speaker1.

If your dialog is for a specific character, you simply add it to that character's definition. If your dialog should be available to all characters, you may add it to character_dialogs.xml, and it will show up for everyone EXCEPT special characters (unless preconditions limit it further).

So, if we wanted our static dialog to show up for all random characters, we would add