Quest creation

From Mod Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 09:44, 28 April 2011 (edit)
Nicoman (Talk | contribs)

← Previous diff
Revision as of 09:45, 28 April 2011 (edit) (undo)
Nicoman (Talk | contribs)

Next diff →
Line 157: Line 157:
:Edit the unpack.bat and paste following code into it. Save the changes. :Edit the unpack.bat and paste following code into it. Save the changes.
-:<source lang="xml">+:
 +<source lang="xml">
dbex_rel_en.exe gamedata.db0 C:\s dbex_rel_en.exe gamedata.db0 C:\s
dbex_rel_en.exe gamedata.db1 C:\s dbex_rel_en.exe gamedata.db1 C:\s
Line 171: Line 172:
dbex_rel_en.exe gamedata.dbb C:\s dbex_rel_en.exe gamedata.dbb C:\s
dbex_rel_en.exe gamedata.dbc C:\s dbex_rel_en.exe gamedata.dbc C:\s
-:</source>+</source>
:With a klick on our new created unpack.bat all .dbX files will be extracted. In my example, to the directory 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.

Revision as of 09:45, 28 April 2011

Contents


A: New quest with new dialog

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

Now, 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">
	<task>new_task</task>
</info_portion>	 
 
<info_portion id="player_talked_with_wolf"></info_portion>
 
<info_portion id="player_complete_new_task"></info_portion>
The info_portion called new_task_started activates the quest called new_task.

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>
		<function_complete>escape_tasks.task_fox_complete</function_complete>
		<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 stirng_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. You will have to unpack them. 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. Save the changes.
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 case all dbX files are listed in the unpack.bat.
Mods or patches might add new dbX files! If so, simply add those to your unpack.bat.
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. E voila, now we can see 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.
<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>
                <map_location_type hint="escape_trader">blue_location</map_location_type>
		<object_story_id>Escape_Trader</object_story_id>
		<infoportion_complete>player_complete_new_task</infoportion_complete>
	</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>
		<map_location_type hint="escape_trader">blue_location</map_location_type>
		<object_story_id>Escape_Trader</object_story_id>
		<infoportion_complete>player_complete_new_task</infoportion_complete>
	</objective>
</game_task>

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

All the "skeletons" should be added to the file gamedata\config\gameplay\dialogs_escape.xml between <game_dialogs> and <dialog id=...>!

<dialog id = "volk_new_quest">
	<has_info>new_task_started</has_info>
	<dont_has_info>player_talked_with_wolf</dont_has_info>
	<dont_has_info> player_complete_new_task </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>
 
<dialog id = "esc_trader_new_quest">
<dont_has_info>player_complete_new_task</dont_has_info>
<dont_has_info>player_talked_with_wolf</dont_has_info>
<phrase_list>
	<phrase id = "0">
		<text>esc_trader_new_quest_0</text>
		<next>1</next>
	</phrase>
	<phrase id = "1">
		<text>esc_trader_new_quest_1</text>
		<give_info>new_task_started</give_info>
		<next>2</next>
	</phrase>
	<phrase id = "2">
		<text>esc_trader_new_quest_2</text>
		<action>dialogs.break_dialog</action> 
        </phrase>
</phrase_list>
</dialog>
 
<dialog id = "esc_trader_new_quest_complete">
<dont_has_info>player_complete_new_task</dont_has_info>
<phrase_list>
	<phrase id = "0">
		<text>esc_trader_new_quest_complete_0</text>
		<next>1</next>
	</phrase>
	<phrase id = "1">
		<text>esc_trader_new_quest_complete_1</text>
		<give_info>player_complete_new_task</give_info>
		<next>2</next>
	</phrase>
	<phrase id = "2">
		<text>esc_trader_new_quest_complete_2</text>
		<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.

Now we only need to add the text of three dialogs to make our quest complete. Open the file \gamedata\config\text\eng\stable_dialogs_escape.xml (if you would like to use a different language it would be the file \gamedata\config\text\yyour language\stable_dialogs_escape.xml, where "your language" would be e.g. ita, ger or similar) and add there the following new text.

Copy the following code at the end of the file right above the end tag </string_table>. Imho, in this casse also, the position of our strings inside the file is not relevant.

<string id="esc_trader_new_quest_complete_0">
	<text>I completed Wolf's task!</text>
</string>
<string id="esc_trader_new_quest_complete_1">
	<text>Good job, Marked One. I can rely on you.</text>
</string>
<string id="esc_trader_new_quest_complete_2">
	<text>My pleasure, Sidorovich.</text>
</string>
<string id="esc_trader_new_quest_0">
	<text>Hey Sidorovich. Got any work for me?</text>
</string>
<string id="esc_trader_new_quest_1">
	<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>
<string id="esc_trader_new_quest_2">
	<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>

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
parent            = trader
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:
    1. trader = Sidorovich
    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
parent            = trader
target            = wpn_fn2000
reward_item       = af_dummy_glassbeads
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

In config\gameplay\storyline_info_taskmanger.xml you have to add that :

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


Then in stable_task_manager.xml in config\text\your_language

<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!

Personal tools
In other languages