# Quest creation

## A: New quest with new dialog

Preparations:

For this part of the tutorial, you will need following files from Stalker´s root directory:

• \gamedata\config\gameplay\dialogs_escape.xml
• \gamedata\config\gameplay\info_l01escape.xml
• \gamedata\config\gameplay\storyline_info_escape.xml
• \gamedata\config\gameplay\character_desc_escape.xml
• \gamedata\config\text\eng\stable_dialogs_escape.xml
• \gamedata\config\text\eng\stable_storyline_info_escape.xml

Note: if one ore more files can not be found in the game directory, they hide in the dbX files in the root directory of the game. It is necessary to unpack them first.
Here is the way how it is done:

Google for a file called dbex_rel_en.exe. Place this file in the root directory of the game, and unpack all .dbX to a proper place (warning: you will need about 6 GB free space).
To make things easyer, I made a batch file to extract the .dbX Files. Make a new File called e.g. unpack.bat. Place this file in the same directory as the dbex_rel_en.exe and the .dbx files.
Edit the unpack.bat and paste following code into it:
dbex_rel_en.exe gamedata.db0 C:\s
dbex_rel_en.exe gamedata.db1 C:\s
dbex_rel_en.exe gamedata.db2 C:\s
dbex_rel_en.exe gamedata.db3 C:\s
dbex_rel_en.exe gamedata.db4 C:\s
dbex_rel_en.exe gamedata.db5 C:\s
dbex_rel_en.exe gamedata.db6 C:\s
dbex_rel_en.exe gamedata.db7 C:\s
dbex_rel_en.exe gamedata.db8 C:\s
dbex_rel_en.exe gamedata.db9 C:\s
dbex_rel_en.exe gamedata.dba C:\s
dbex_rel_en.exe gamedata.dbb C:\s
dbex_rel_en.exe gamedata.dbc C:\s
With a klick on our new created unpack.bat all .dbX files will be extracted. In my example, to the directory C:\s.
Change this if you like your unpacked data elsewhere. Also, check whether in your particular case all dbX files are listed in the unpack.bat.
If you are missing one of the files above, or any other file mentioned later in the tutorial that you are not able to find in the game directory, you will be able to find it somewhere in the unpacked content.

It is best to make two sets of copies of the 7 files listed above. The first set will be your work copies. Why is this usefull? Because working with the files in the game directory has disadvantages:

1. you would have to search for the needed files frequently (poor overview).
2. The danger of choosing the wrong file for editing (some files have quite similar names).

The second set will be the backup. I think I don´t have to explain why it is usefull to have one ;-).

Let´s go:

Create a folder on your desktop named \Work. Within this folder, create two subfolders. Name one \tutorial quest (our working place), the other \bkp (for the backup files). Copy all 7 files abowe with their folder structure from the game folder into the \tutorial quest folder. In the \tutorial quest directroy should now be a single folder: \gamedata. Copy this folder with all content to the \bkp folder.

The Structure of the folder schould look like:

For edditing the files imho Notepad++ is a good choice. You are able to edit many files simultaneously and browse them by tabs. When you edit something, you should always be working with the files located inside the \Work\tutorial quest directory.

For applying later changes in the files listed above we create a batch file. Thus we are able to copy all files from the \tutorial quest directory to the game directory with just one click.

Create a new file in Notpad++. Paste following code inside:

xcopy "C:\Dokumente und Einstellungen\Chris\Desktop\mod\tutorial quest\gamedata" "C:\Programme\THQ\S.T.A.L.K.E.R. - Shadow of Chernobyl\gamedata" /e /y
"C:\Programme\THQ\S.T.A.L.K.E.R. - Shadow of Chernobyl\bin\XR_3DA.exe" -nointro -noprefetch

Save it inside the \Work directory. I named my file: Copy moded Files to Stalker Directory and start game.bat A click pastes the files from our \tutorial quest directory to the game directory and starts the game!!

Create another new file in Notepad++. Paste following code inside:

xcopy "C:\Dokumente und Einstellungen\Chris\Desktop\mod\tutorial quest\bkp\gamedata" "C:\Programme\THQ\S.T.A.L.K.E.R. - Shadow of Chernobyl\gamedata" /e /i
del "C:\Programme\THQ\S.T.A.L.K.E.R. - Shadow of Chernobyl\gamedata\config\gameplay\storyline_info_escape.xml"

Save it inside the \Work directory. I named my file: Backup original game Files.bat A click pastes the files from the \bkp directory to the game directory. This action restores the original content of the game.

Be aware that I have a german Windows XP version and the game was installed in the default directory. You have to alter the code inside the batch files to meet your conditions if something is different on your PC.

We´re done with the preparations. Now we are able to proceed with the main concern.

### Basic dialog creation

So, lets get to creation of a dialog in which we recieve a new quest. Participating actors: Sidorovich (S) and the Marked One (M)

M: Hey Sidorovich. Got any work for me?
S: Oh, if it is not the Marked One? Alright, lets get right to it. I have the following request for you: see Wolf, he's got something.
M: No problem! On my way.

Lets say, these will be the phrases for the basic dialog. Now we need to add it in a proper format, so that the game "understands" it.

Creation of the dialog "skeleton".

To add our dialog, we need to open the file \gamedata\config\gameplay\dialogs_escape.xml for editing.

For those who are familiar with the XML language, the structure of this file will be obvious at a glance, but we will explain it in some more detail.

To add the dialog to the game, we need these so-called "tags". The following are such tags:

1. <game_dialogs> and closing </game_dialogs>

2. <dialog id = ""> and closing </dialog>

3. <phrase_list> </phrase_list>

4. <phrase id = ""> </phrase>

5. <text> </text>

6. <next> </next>

These is, pretty much, enough to create a dialog. Although, a dialog based on these tags cannot be used to create a new quest. To get a quest during a dialog we need the corresponding tag, but more about this later.

Here is what each tag means:

1. Determines the contents of the file (in this case it says that the file contains dialogs);

2. Creates a new dialog with id = "". The dialog identifier goes inbetween the quotation marks. The dialog identifiers are defined in files character_description_***.xml ;

3. This tag tells the game's XML parser that the dialog phrases are to follow. In other words, the dialog phrases are placed between <phrase_list> and </phrase_list>;

4. This tag creates a phrase with id = "". The phrase identifier goes inbetween the quotation marks (WARNING: in this case the identifier must must be a number);

5. This two tags contain the text corresponding to the phrase (for example: esc_trader_talk_info_123). The text itself is retrieved from files stable_dialogs_*****.xml that contain all phrases as text. I will tell you about this more later;

6. This tag contains a referenced (as a number) to the next phrase (or phrases).

Now, lets get to the tags that allow us to make some actions during the dialog.

<precondition> </precondition>. Presents a condition that, when met (evaluates to "true"), makes a dialog or a phrase become available to the character.

<action> </action>. This tag makes it possible to execute some action during the dialog (for example, exchange of objects between the characters... or it could be even more complicated). Inside this tag is placed a reference to some function (for instance, dialogs.actor_set_dolg makes the player a Duty member).

<give_info> </give_info>. Gives the player so-called info_portions. Info_portions can also be given through an <action>, but this would necessitate creation of a special function. Info_porition is the basis for quests. Info_poritions are defined in files info****.xml. Info_poritions might begin quests or end them. Also, info_portions allow tracking the player's actions to, for example, show corresponding dialogs. <has_info> </has_info> and <dont_has_info> </dont_has_info> are preconditions for the current phrase/dialog. The first tag checks for ownership of a certain info_portion by a player, the second — lack of.

Now we are able to crete a dialog, in which we recieve a quest. Although, we cannot create any info_portions for activating the quest.

### Info_portion creation

Open the file \gamedata\config\gameplay\info_l01escape.xml. What do we see? Right, more XML. In this case we are only interested in two tags:

<info_portion id = ""> </info_portion>
<task> </task>
The first declares the info_portion iteslf. The second declares a task (the task identifier is contained in the tag <task>).
For our example, we create three info_portions, which will be needed for the quest.:
Copy the following code somewhere in between the tags <game_information_portions> </game_information_portions>. Imho, the exact position of our new info_portions inside the file is not relevant. I have pasted them behind the tag <info_portion id="tutorial_alarm_played"></info_portion>.
<info_portion id="new_task_started">
</info_portion>

<info_portion id="player_talked_with_wolf"></info_portion>

<info_portion id="player_complete_new_task"></info_portion>

### Creation of a new quest

The quests themselves are contained in files tasks_*****.xml.

Open the file \gamedata\config\gameplay\tasks_escape.xml. Good old XML.

For an example, examine the following quest:

<game_task id="esc_help_wounded_from_raid" prio="485">
<title>esc_help_wounded_from_raid</title>
<objective>
<text>esc_help_wounded_from_raid_0</text>
<icon>ui_iconsTotal_esc_help_wounded_from_raid</icon>
<infoportion_set_complete>garbage_meetstalker_start</infoportion_set_complete>
<article>esc_fox_help</article>
</objective>
<objective>
<text>esc_help_wounded_from_raid_1</text>
<map_location_type hint="esc_fox">green_location</map_location_type>
<object_story_id>Escape_stalker_from_raid</object_story_id>
<infoportion_complete>escape_fox_heal</infoportion_complete>
<infoportion_fail>esc_dogs_return</infoportion_fail>
</objective>
<objective>
<text>esc_help_wounded_from_raid_2</text>
<map_location_type hint="esc_fox">green_location</map_location_type>
<object_story_id>Escape_stalker_from_raid</object_story_id>
<infoportion_complete>escape_stalker_done</infoportion_complete>
</objective>
</game_task>

Piece by piece:

<game_task id="esc_help_wounded_from_raid" prio="485">
</game_task>
Defines the name (id) of the new quest. In thic case, it is esc_help_wounded_from_raid. prio = "" defines the priority of the task. The higher the priority, the higher the likelyhood that the current quest marker will be switched to ours.

<title>esc_help_wounded_from_raid</title>
Defines the title of the quest. The title can be either text or a link. In this case a link to text in file \gamedata\config\text\eng\string_Table_tasks_escape.xml has been used.

<icon>ui_iconsTotal_esc_help_wounded_from_raid</icon>
Defines the quest icon in the quest list when you open the pda.
All pda mission icons are inside the file \gamedata\textures\ui\ui_iconstotal.dds. The File can be watched or edited with image processing programs like Gimp 2.0 or Photoshop (DDS Plugin needed).
But how to pick a certain icon? This is an important detail if you make your own mission later.
It´s is a bit tricky, for the file in which the correlations between icons and their descriptions (e.g. ui_iconsTotal_esc_help_wounded_from_raid) are made is packed in some .dbX File in the root directory of the game. If you haven´t done it already, you will have to unpack them. Check how it is done in the beginning of this tutorial. Then come back and read on.
Now we are able to access our file in which the corelations are made. Go to the now unpacked .dbX file content and open the file \config\ui\ui_iconstotal.xml. Taka a look at the correlations between icons and their IDs.
In our case the correlation reads as follows: <texture id="ui_iconsTotal_esc_help_wounded_from_raid" x="83" y="188" width="83" height="47" />. Open the file \gamedata\textures\ui\ui_iconstotal.dds. Start at the upper left corner of the image. Now go x="83" pixels to the right, and y="188" pixels down. You should be exactly at the upper left corner of the icon correlated to ui_iconsTotal_esc_help_wounded_from_raid. Got it?
The rest is quite simple, look for your favorite icon, check the coordinates of its upper left corner and search the correlated id in the \config\ui\ui_iconstotal.xml. Copy the ID between the Tags <icon></icon> in your quest.

<function_complete>escape_tasks.task_fox_complete</function_complete>
Calls function called task_fox_complete from the file escape_tasks.script. Execution of this function creates an info_porition that ends the current task, given that all conditions of the function are met.

<infoportion_complete>escape_fox_heal</infoportion_complete>
If the player recieves this info_portion, the current task will be finished.

<infoportion_fail>esc_dogs_return</infoportion_fail>
If the player recieves this info_portion, the current task will be failed.

<article>esc_fox_help</article>
Defines the article with the id="esc_fox_help", which is located in the file \gamedata\config\gameplay\storyline_info_escape.xml:
<article id="esc_fox_help" name="esc_help_wounded_from_raid" article_type="task" group="esc_help_wounded_from_raid/0">

<text>help_to_fox</text>
</article>
article_type="task" defines the type of the following text. In this case, the text will be displayed in the pda when you check the toggle map/text button.
<text>help_to_fox</text> defines the text with the string id="help_to_fox", which is located in the file \gamedata\config\gameplay\stable_storyline_info_escape.xml
<string id="help_to_fox">

"Fox has come back from his raid and is asking for help. Perhaps he knows something about Strelok."</text>
</string>
Qute self explanatory: The text between the <text></text> tags will be desplayed. As said, in this case as the quest description.

<map_location_type hint="esc_fox">green_location</map_location_type>
Creates a marker on the map, with the hint esc_fox and type green_location.

<object_story_id>Escape_stalker_from_raid</object_story_id>
Points to the sid in file gamedata\config\game_story_ids.ltx

<infoportion_set_complete>garbage_meetstalker_start</infoportion_set_complete>
Automatically sets the current subtask to "Finished" if the player has the proper info_portion. //!!!!!! Not sure — never used it.

<text>esc_help_wounded_from_raid_0</text>
Contains the description of a subtask. Can contain text or a reference to text.

Lets create a quest for our dialog:

Coppy following code to the very end of the file gamedata\config\gameplay\tasks_escape.xml.

<game_task id="new_task">
<title>Talk to Wolf</title>
<objective>
<text>Go to Sidorovich</text>
<icon>ui_iconsTotal_find_item</icon>
</objective>
<objective>
<text>Talk to Wolf</text>
<map_location_type hint="volk">green_location</map_location_type>
<object_story_id>Escape_novice_lager_volk</object_story_id>
<infoportion_complete>player_talked_with_wolf</infoportion_complete>
</objective>
<objective>
<text>Go to Sidorovich</text>
</objective>
</game_task>

Now, create the skeletons for the dialog of our quest. We need three: one for Wolf and two for Sidorovich.

All three "skeletons" below are to be pasted to the file gamedata\config\gameplay\dialogs_escape.xml between <game_dialogs> and <dialog id=...>!

<dialog id = "volk_new_quest">
<dont_has_info>player_talked_with_wolf</dont_has_info>
<phrase_list>
<phrase id = "0">
<text>esc_volk_new_quest_0</text>
<next>1</next>
</phrase>
<phrase id = "1">
<text>esc_volk_new_quest_1</text>
<give_info>player_talked_with_wolf</give_info>
<next>2</next>
</phrase>
<phrase id = "2">
<text>esc_volk_new_quest_2</text>
<action>dialogs.break_dialog</action>
</phrase>
</phrase_list>
</dialog>

<dont_has_info>player_talked_with_wolf</dont_has_info>
<phrase_list>
<phrase id = "0">
<next>1</next>
</phrase>
<phrase id = "1">
<next>2</next>
</phrase>
<phrase id = "2">
<action>dialogs.break_dialog</action>
</phrase>
</phrase_list>
</dialog>

<phrase_list>
<phrase id = "0">
<next>1</next>
</phrase>
<phrase id = "1">
<next>2</next>
</phrase>
<phrase id = "2">
<action>dialogs.break_dialog</action>
</phrase>
</phrase_list>
</dialog>

Carefully keep the proper order of the tags and EXACT identifiers — in the file with your dialog, as well as in all other files where you use tags and your own identifiers (for example, identifiers in the dialog file must be the same as in the file with text). Otherwise, all you will get is a series of crashes with cryptic logs. I had problems myself when I tried to activate the quest in this article.

Note: look at the existing dialogs created by the developers. This will make your life easier.

Now, go to the file gamedata\config\gameplay\character_desc_escape.xml

Find there the NPC with id = "escape_trader" and copy the two new <actor_dialog></actor_dialog> right above the end tag </specific_character>.

<actor_dialog>esc_trader_new_quest_complete </actor_dialog>
<actor_dialog>esc_trader_new_quest </actor_dialog>

Now, find the NPC with id = "esc_wolf" and add one actor_dialog. Again, right above the end tag </specific_character>.

<actor_dialog> volk_new_quest </actor_dialog>

Note: <actor_dialog> is a dialog that can be activated by the player himself at whim. A <start_dialog> activates when certain conditions are met, and is normally inaccessible.

Next, we need to add the text of the three dialogs. Open the file \gamedata\config\text\eng\stable_dialogs_escape.xml and paste the following code at the end of the file right above the end tag </string_table>. Imho, in this case, too, the position of our strings inside the file is not relevant.
Note: If you would like to use a different language it would be the file \gamedata\config\text\your language\stable_dialogs_escape.xml, where "your language" is to be replaced by e.g. ita, ger or similar.

<string id="esc_trader_new_quest_complete_0">
</string>
<text>Good job, Marked One. I can rely on you.</text>
</string>
<text>My pleasure, Sidorovich.</text>
</string>
<text>Hey Sidorovich. Got any work for me?</text>
</string>
<text>Oh, if it is not the Marked One? Alright, lets get right to it. I have the following request for you: see Wolf, he's got something.</text>
</string>
<text>No problem! On my way.</text>
</string>
<string id="esc_volk_new_quest_0">
<text>Yo, Wolf. Sidorovich sent me to you, says you have something for me to do.</text>
</string>
<string id="esc_volk_new_quest_1">
<text>Hello, Marked One. You still listen to that old hack? Everything is cool. Go tell him that.</text>
</string>
<string id="esc_volk_new_quest_2">
<text>Alright, I'm off.</text>
</string>

Open the file \gamedata\config\gameplaystoryline_info_escape.xml and paste the following code somewhere inside.

<article id="new_task_descr" name="new_task" article_type="task" group="new_task/0">
</article>

And last, open the file \gamedata\config\gameplay\stable_storyline_info_escape.xml and paste the following code somewhere inside.

<string id="task_description">
<text>I am told to go to Wolf, I hope he has some valuable info for me!!</text>
</string>

You're finished with the quest creation!

## B: New quest with existing dialogs

### Optional Quest

This part of the tutorial will explain how to create optional quests like "Find the artefact". On the first hand, using this way, you will edit only a file, on the other hand you cannot use a custom dialogue. The file which we have to edit is task_manager.ltx in config\misc dir. Opening it, we can see a section called [list], this is the list of avaible tasks. Then there are a lots of section, each section describes a task. EG

[tm_find_artefact_2]
type              = artefact
community         = actor
text              = tm_find_artefact_2_text
description       = tm_find_artefact_2_descr
target            = af_cristall_flower
reward_money      = 3000
reward_reputation = +20
reward_rank       = 3
reward_item       = vodka
time              = 86400
prior             = 2

As you can see there are some editable fields, they are:

1. type it says the type of a quest, there are 6 types of quests:
1. eliminate_lager - you have to kill a group of stalkers\monsters
2. defend_lager - you have to defend a place
3. kill_stalker - you have to kill a stalker
4. find_item - you have to find an item, a weapon or a suit
5. find_artefact - you have to find an artefact
6. monster_part - you have to find a part of a monster
2. parent this is the npc that give you the task, only those stalkers can give you a task:
2. barman = Barman
3. ecolog = Saharov
4. dolg = Voronin
5. freedom = Lukash
6. wolf = Wolf
7. shustriy = Nimble, the prisoner at factory
8. drunk_dolg = Brome, the drunk dutyer at Bar
9. hunter = Hunter, the rookie that lost bm16 in Rostok
10. zastava_commander = Sergeant Kitsenko
11. petrenko = Petrenko
12. lisiy = Baldy
13. mercenary = Snitch
3. text this is the name of the quest that you see, this is a string_id in stable_task_manager.xml in text dir
4. description this is the description of the quest, like the field "text"
5. community this is the community field, but it is not used, so you have to let him as it is,
community = actor
6. prior this is the priority, you will get first the task with a lower prior number, this can be omitted.
7. target this is the objective, that we have to kill/find. It can be :
1. a section of an object, like "af_drops" or "wpn_vintorez"
target = outfit_specnaz_m1
2. a specific character id ( you find them in character_desc_[level_name].xml ), like "sim_stalker_master_chuchelo"
target = sim_stalker_master_chuchelo
3. a smart_terrain (you find them in all.spawn, so you should read the article Editing all.spawn)
target = ros_smart_monster5
8. reward_item this is your reward in equipment, you have to write here the object section, eg
reward_item = ammo_5.56x45_ap, ammo_5.56x45_ap, ammo_5.56x45_ap, ammo_m209, ammo_m209
9. reward_money this is your reward in money, eg
reward_money = 3500
10. reward_rank this tell us the increase of marked one's rank, eg
reward_rank = 5
11. reward_reputation this tell us the increase of marked one's reputation, eg
reward_reputation = +25
do not forget to add the "+"
12. reward_relation this tell us the increase of marked one's relation with a faction: freedom and duty(dolg)
reward_relation = freedom, +150, dolg, -150
As we can read, we have to write first the faction, a comma and then a positive or negative number.
13. time this tell us how many days we have to complete the task, eg
time = 86400
and 86400 is a day, because it is in secs, so 1 * 24 * 60 * 60 = 86400
14. condlist the task will be given if you have ( or you have not) that infoportion, eg
condlist = {+esc_darklab_documents_read}
Did you get docs in x18 lab ?
15. init_condition it says the condition, that you have to meet, if you want to complete this task
init_condition= {=actor_on_level(l01_Escape) +agroprom_military_case_have}
In this example, you need to have "agroprom_military_case_have" infoportion and you have to stay in escape level.

Warning. In this file there are storyline related quests but it's better to do not edit them.

### Example

This is our new compiled quest: in task_manager.txt

[trader_find_item_2]
type              = find_item
condlist          = {+esc_serious_talk}
community         = actor
text              = my_quest_name
description       = my_quest_descr
target            = wpn_fn2000
reward_money      = 10000
reward_reputation = +25
reward_rank       = 5
time              = 86400

Do not forget to add the quest name [trader_find_item_2] under [list] section

<article id="my_quest_descr" name="find_item" article_type="task">
<text>my_quest_string_id</text>
</article>

<string id="trader_find_item_2">
<text>Find a fn2000 for Sidorovich</text>
</string>
<string id="my_quest_string_id">
<text>Sidorovich wants a new fn2000</text>
</string>
<string id="my_quest_name">
<text>Marked One, bring me a fn2000 and i will give you a lots of money....</text>
</string>

You're finished with the quest creation!