Questedit is used to create the quest tree that represents all the quests available in the game and the steps required to complete them. The quest tree is necessary for:
- keeping track of the player's progress in the game
- conditionals in dialogues, based on quest completion
- automatic entry creation in the log book.
- triggering quest-related events
Creating Quest Data File
Until the completion of the graphical quest editor (of which so far only the user interface designed with glade exists), a little Python script exists to create the quest tree from an XML file. The script is called convert_quests.py and is located in the test/ directory . To use it, run
python convert_quests.py <quest_tree.xml>
The syntax of the XML file is the following:
<quests> <quest name="Quest_1"> <code>Part_1 and (Step_1 or Step_2)</code> <log> <on_start> <topic>Quest 1</topic> <text>Quest 1 Started</text> <id>logbook.quest_1a</id> </on_start> <on_completion> <topic>Quest 1</topic> <text>Quest 1 Completed</text> <id>logbook.quest_1b</id> </on_completion> </log> <parts> <quest name="Part_1"> <code>(Step_3 and Step_4) or (Step_4 and Step_5)</code> <parts> <quest name="Step_3"/> <quest name="Step_4"/> <quest name="Step_5"/> </parts> </quest> <quest name="Step_1"/> <quest name="Step_2"/> </parts> </quest> </quests>
- quests is the root of the quest tree. It can contain 1 to n quest nodes as its only children.
- quest nodes represent a single node in the quest tree. They can have one code, log and parts element, either of which is optional. If no parts element is given, the node is a leaf of the quest tree. The name attribute is the name used to address the quest node from within the engine.
- code, if present, will contain the completion rule, i.e. which combination of child nodes need to be completed in order to complete the quest step represented by this node. It is not allowed in leaf nodes.
- log, if present, can be used to specify automatic entries into a log book. It can contain the elements on_start and on_completion.
- on_start contains the log entry that is added to the log book when this quest step is started, i.e. when at least one of it's direct childs is completed. Mandatory elements are topic, text and id.
- on_completion contains the log entry that is added to the log book when this quest is completed, i.e. when either all child quests or those denoted by the completion rule are completed. Mandatory elements are topic, text and id.
- topic is the heading that is displayed in the log book above each entry.
- text is the actual text for the log entry.
- id is a unique identifier for each log book entry.
- parts, if present contains 1 to n quest nodes, which further divide the current quest part into more steps.