Quest creation
From Mod Wiki
Revision as of 19:05, 25 April 2011 (edit) Nicoman (Talk | contribs) ← Previous diff |
Revision as of 19:17, 25 April 2011 (edit) (undo) Nicoman (Talk | contribs) Next diff → |
||
Line 79: | Line 79: | ||
For our example, we create three info_portions, which will be needed for the quest. | 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>. | + | 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>. |
<source lang="xml"> | <source lang="xml"> | ||
Line 288: | Line 288: | ||
Now, go to the file '''gamedata\config\gameplay\character_desc_escape.xml''' | Now, go to the file '''gamedata\config\gameplay\character_desc_escape.xml''' | ||
- | Find there the NPC with <tt>id = "escape_trader"</tt> and | + | Find there the NPC with <tt>id = "escape_trader"</tt> and copy the two new <tt><actor_dialog></actor_dialog></tt> right above the end tag </specific_character>. |
<source lang="xml"> | <source lang="xml"> | ||
Line 295: | Line 295: | ||
</source> | </source> | ||
- | Now, find | + | Now, find the NPC with <tt>id = "esc_wolf"</tt> and add one actor_dialog. Again, right above the end tag </specific_character>. |
<source lang="xml"> | <source lang="xml"> | ||
Line 303: | Line 303: | ||
Note: <tt><actor_dialog></tt> is a dialog that can be activated by the player himself at whim. A <tt><start_dialog></tt> activates when certain conditions are met, and is normally inaccessible. | Note: <tt><actor_dialog></tt> is a dialog that can be activated by the player himself at whim. A <tt><start_dialog></tt> 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\y'''your language'''\stable_dialogs_escape.xml, where "your language" would be e.g. ita, ger or similar) and add there the following new text | + | 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\y'''your 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. | ||
<source lang="xml"> | <source lang="xml"> |
Revision as of 19:17, 25 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.
<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> <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> <icon>ui_iconsTotal_find_item</icon> <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>
Here you must use a reference to an icon from the file ui_iconstotal, or else when you try to look in the "Quests" section in the PDA, the game will crash. Just for an example, I used an item search icon.
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:
- type it says the type of a quest, there are 6 types of quests:
- eliminate_lager - you have to kill a group of stalkers\monsters
- defend_lager - you have to defend a place
- kill_stalker - you have to kill a stalker
- find_item - you have to find an item, a weapon or a suit
- find_artefact - you have to find an artefact
- monster_part - you have to find a part of a monster
- parent this is the npc that give you the task, only those stalkers can give you a task:
- trader = Sidorovich
- barman = Barman
- ecolog = Saharov
- dolg = Voronin
- freedom = Lukash
- wolf = Wolf
- shustriy = Nimble, the prisoner at factory
- drunk_dolg = Brome, the drunk dutyer at Bar
- hunter = Hunter, the rookie that lost bm16 in Rostok
- zastava_commander = Sergeant Kitsenko
- petrenko = Petrenko
- lisiy = Baldy
- mercenary = Snitch
- text this is the name of the quest that you see, this is a string_id in stable_task_manager.xml in text dir
- description this is the description of the quest, like the field "text"
- community this is the community field, but it is not used, so you have to let him as it is,
community = actor
- prior this is the priority, you will get first the task with a lower prior number, this can be omitted.
- target this is the objective, that we have to kill/find. It can be :
- a section of an object, like "af_drops" or "wpn_vintorez"
target = outfit_specnaz_m1
- a specific character id ( you find them in character_desc_[level_name].xml ), like "sim_stalker_master_chuchelo"
target = sim_stalker_master_chuchelo
- a smart_terrain (you find them in all.spawn, so you should read the article Editing all.spawn)
target = ros_smart_monster5
- a section of an object, like "af_drops" or "wpn_vintorez"
- 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
- reward_money this is your reward in money, eg
reward_money = 3500
- reward_rank this tell us the increase of marked one's rank, eg
reward_rank = 5
- reward_reputation this tell us the increase of marked one's reputation, eg
reward_reputation = +25
do not forget to add the "+" - 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. - 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 - 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 ? - 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!