Earlier Bioware titles stored the dialog tree and the actual text in the same file. In Jade Empire that is no longer the case. The dialog tree is spread over hundreds of dialog files that are associated with the speaker who "owns" them. The text data is consolidated into a single file named dialog.tlk. The reason for separating the dialog trees and the text is most likely to facilitate i18n. Only the dialog.tlk needs to be translated to create a different language version. Players can also easily swap the subtitles and other in-game texts by using a different version of the dialog.tlk. Note that while one file was good enough for the English version, other language versions of Jade Empire have not one but two TLKs. The second one is called dialogf.tlk. The "f" stands for "female". The contents of dialog.tlk and dialogf.tlk are virtually identical. The only differences lie in the pronouns and the articles.
Editing Lines of DialogEdit
The dialog.tlk contains a list of entries that consist of the StrRef, the actual text and a reference to the associated sound file. The StrRef (string reference) is simply the number of the entry in the list. It is used internally by the DLG files (see below), but also by various script functions like ActionSpeakStringByStrRef e.g.
You can edit the dialog.tlk with a tool named TalkEd
Usage of TalkEd is relatively simple. You open the dialog.tlk which is in the root directory of your Jade Empire installation. You then have to pick an interval of entries to display. For performance reasons you might want to pick a relatively narrow interval. The middle pane shows the list with the StrRefs, the entry texts and the sound references and the bottom pane shows a preview of the currently selected entry. For some peculiar reason the bottom pane is read-only. You have to double-click on an entry in the middle pane to bring up the editing window.
The text you can add here is mostly static but there is a small number of magic tokens that will be replaced at run-time. They are always surrounded by the triangular brackets: < and >. Take the string "Greetings <sir/madam>!" as an example. <sir/madam> would be replaced at run-time either by "sir" or by "madam" - depending on the gender of the PC. Another example would be "Greetings <FullName>!". <FullName> would be replaced by the name the player has given to his character. The full list of the available tokens can be found in stringtokens.2da. Note that some of these like "lawful/chaotic" clearly date back to older Bioware games like Neverwinter Nights and probably don't work in Jade Empire. The ones with StrRefs should be fine though.
Editing the actual ConversationsEdit
The actual dialog trees are stored in files with the extension *.dlg. DLG files are GFF files. That means you could edit them with K-GFF. There is however a special tool for DLGs: the Jade Empire DLGEditor. The JE DLGEditor is a bit buggy and will every once in a while produce bloat and defective files that you can only repair with K-GFF, but more often than not the JE DLGEditor is much more convenient than K-GFF.
Before you get started toying around with the dialog editor:
- Turn off "Automatically Apply Changes" in the "Edit" menu. Leaving this option turned on will very frequently result in unwanted changes and all kinds of annoyances. After you've turned this option off an "Apply Changes" button will appear in the lower right corner. Don't forget to click it!
- Make frequent saves under different names! Cutting, deleting and even the Undo do not always work properly and using them might damage the dialog. If possible only work additively and never remove anything
Following these two basic rules will save you a lot of grieve! ;)
When you run the dialog editor for the first time, you need to go to the File menu and set the TLK file path to your dialog.tlk and the TLK editor path to TalkEd.
The dialog editor shows dialog as a tree. At the root of the tree you will see the name and path of the file you're editing:
When you click on the filename, the bottom pane will show the list of available speakers:
The "tags" you see here are actually the filenames of the speakers' CRE files. The player is always part of any dialog and no tag has to be added for him or her. You add a new speaker by filling in the "New Tag" field and clicking the right arrow. You remove speakers by selecting their tag in the list and clicking the left arrow.
The first speaker on the list is the "owner" of the conversation. Be careful not to change an existing conversation's owner! Only NPCs can "own" conversations.
The dialog tree is organized in "entries" and "replies". Directly below the root of the tree is at least one entry which can have any number of replies... each of which can have any number of entries... and so on.
Both entries and replies are allowed to be empty. Empty entries and replies have no speaker and no line of dialog. They're only important for the scripts that run on them. The dialog editor shows the word "(continue)" for empty dialog nodes.
Clicking on any dialog node will bring up its editing options in the bottom pane:
The most important of these fields are Speaker, Listener and StrRef.
Speaker is the tag of the character that speaks the line of dialog, on which the camera is trained and at whom the listener looks. The listener is the tag of the character the speaker faces.
Unless you want to leave the node empty you have to either add a speaker or a listener. If the speaker field is set to (none) the player is the speaker. If the listener field is (none) the player is the listener.
The StrRef is the line number in the dialog.tlk (see above). When you work with the dialog editor you will always have to have TalkEd opened as well. Paste the StrRef from TalkEd to the dialog editor and the line will appear.
The other options are documented on the DLG Files page.
Adding new entries and replies is pretty straight forward. Just right-click any node and choose "Add Entry" or "Add Reply" from the context menu. There is however a rather special scenario: When you've played the game, you surely noticed that a lot of the dialog loops back on itself. To create that effect in the dialog editor you need to navigate to the line to which you want to loop and copy it. Then navigate to the node where the loop should start, right-click and choose "Paste as Copy" from the context menu. That will create a loop. Instead of displaying the dialog recursively the dialog editor will simply show "(already listed)" to indicate a loop.