NWN2daTool is a Microsoft Excel spreadsheet workbook designed for manipulating .2da files, created by Syrus Greycloak with help from Sunjammer. It is an easy tool for beginners to use, and is very flexible and powerful for those users who understand Visual Basic for Applications (VBA) programming. Knowledge of programming is not required to use this tool.
All functions run from buttons located on the NWN2daTool tab of the workbook. Renaming the spreadsheet tool will break it, requiring familiarity with VBA to fix.
Importing a .2da file Edit
- Click the "Import 2da File" button.
- In the open file dialog, navigate to the directory where the .2da file is stored, and choose the file to open.
- Excel will ask for a prefix to prepend to the name of the .2da file. This allows keeping multiple copies of the same .2da. For example, if both the BioWare and CEP versions of appearance.2da are to be imported, a prefix of "BIO" could be added the BioWare file, and a prefix of "CEP" to the CEP version. The prefix will be visible in the new worksheet created.
- The .2da will then be imported, with .2da columns converted to spreadsheet columns.
Merging sheets Edit
Sheets that are to be merged must have the same 3 header lines — the line stating the file type ("2DA V2.0"), a blank line, and the line containing the column headers. Only information that is different from the original file needs to be kept in the sheet(s) that is/are to be merged.
- Click the "Merge 2da Files" button.
- Select the sheet into which the new information is to be merged, usually the original BioWare file.
- Select the sheet from which the new information will be retrieved.
- Click OK.
The two sheets will be merged together. This is done by creating a copy of the original sheet, copying the new data at the bottom, and performing a sort. Any lines with duplicate line numbers result in the previous line being deleted. Thus the new information is kept if there are duplicate lines. The sheet to which the new data is being added must be properly padded so that line numbers run consecutively.
This process can be repeated multiple times on the new sheets that are created. Each merge will create a new sheet and the color highlighting the new data will change.
Exporting .2da files Edit
- Click the "Export 2da File" button.
- Choose the sheet to be exported.
- Use the save file dialog to choose where the file will be exported.
The export routine will then write the .2da file to the chosen location, in the proper format, lining up the columns contained in the file for easier reading in other programs. For new sheets created by the merge process, the export routine will automatically strip off the occurrences of "new" that were appended to the .2da sheet name.
Possible extensions Edit
Users with a knowledge of VBA can tailor this tool to achieve much greater functionality. Examples of what can be done include, but are not limited to, the following:
- stripping out padding lines and comparing sheets to the original BioWare sheets to automate the process of making mergeable sheets,
- automatically padding a sheet to the proper length required, and
- automating the import, merge, and export routines to build multiple .2da files.
Other uses not requiring knowledge of VBA include the following.
- Keeping a copy of a custom .tlk file in the workbook allows the use of formulas to calculate references to that talk file, by adding the indices of the custom .tlk to the offset 16,777,216 (which indicates a StringRef into the custom talk table).
- Custom .2da files can be created with ease to be referenced by the
Get2DAString()command from scripts in the game.
- New columns can be added to existing .2da files, which can then be referenced by
Get2DAString()from scripts in the game.