Wikia

NWN2Wiki

Installation directories

Talk7
3,783pages on
this wiki

There are several ways to get custom content into the game, but not all are equal. Some have advantages over others and some can actually break your game install making you unable to patch your game. This document will describe various methods and highlight best practices.

NWN2 resource handlingEdit

The game manages resources from a number of possible repositories. These repositories include the .zip archives in the \data folder, resources contained in the .mod file itself, resources placed in the Override folder, resources placed in a campaign folder and resources contained in a hakpak associated to the module.

The game reads these resources in using a hierarchical methodology. This means that resource repositories are placed in a "pecking order", so to speak. In short, each repository has a priority status. What this means is that the same piece of content placed in the repositories will be overridden by the content in the highest priority repository. So, placing a placeables.2da file into the Override directory will mean that that particular 2da is now the one the game will use instead of the placeables.2da contained in the 2da.zip under the C:\Program Files\Atari\Neverwinter Nights 2\Data folder. The Override folder is higher up the pecking order than the .zip archives in the \data folder.

This is how we get content into the game without altering the base content -- we place our content into a repository that has a higher priority than the default resources. We can add new content this way and overwrite base content all without ever messing with the default game resources.


Two TreesEdit

Firstly you should notice that NWN2 creates two new directory trees when installed. One for the game installation "C:\Program Files\Atari\Neverwinter Nights 2" and one in the "My Documents" folder for user data. Whilst you could install custom content in either of these places, you should only use the "My Documents" directory. You should leave anything under the install directory unaltered. Anything found in the install directory should be able to be mirrored in the C:\Documents and Settings\YOUR_LOGIN_NAME\My Documents\Neverwinter Nights 2\ directory structure. The reasons for only adding content to the My Documents version of the directories are:

  1. Working under a single path is easier.
  2. You don't have to worry about resources conflicting between the two directory paths.
  3. Uninstalling the game will not uninstall any custom content you have installed.

Overwriting Original FilesEdit

This is a no/no and should only be used as a last resort. Changing the installation files will break the automatic updater and force the user to re-install for future updates.

Data ArchivesEdit

This is a big no-no. These archives are typically located under C:\Program Files\Atari\Neverwinter Nights 2\Data and contain most of the data the game uses. Model files, texture files, 2da files and lots of other types reside in these .zip archives. The thing to remember about these files is that they are Obsidian's files. They are Obsidian's to patch and maintain. And this means that if you alter them in the slightest you can cause the patch process to fail. The patch process relies upon comparing the file on your hard drive to a signature the patch has for that file. Altering the file can and will alter the signature which means the patcher won't know what to do with the file since it is different than the file it has the instructions for patching. There is no reason or need to alter these archives in any way. So, don't do it and don't tell anyone else to do it.

OverrideEdit

The Override directory is typically located at C:\Documents and Settings\YOUR_LOGIN_NAME\My Documents\Neverwinter Nights 2\override. Custom content placed in one of the override directories will take precedence over game defaults, campaign or module content and custom content placed elsewhere. (hak packs however have priority over the override folder, so if something is distributed in a hak you need to use another hak to override it - Kaldor Silverwand). Custom content is placed here if you want it to always be used by the game, or you want to force a module to use content without editing it yourself (such as the official campaign).

Adding content to the Override directory is not ideal for custom content because files added to the Override directory are active for any and all game sessions the user launches. That is, they are active playing the Official Campaign, they are active for any modules you download and play as well as any online sessions you play. While this may be desirable in some situations, it also means that you could be creating conflicts with other custom content in use by the module or online world you are playing. If you are creating a module or campaign, you should consider using a campaign directory or hak pack instead.

If you want to change the behavior of the official campaign or other modules you have downloaded this may be the best option. For example if you want to change the special effects of buffs so that you can see more clearly, this would be the place to put the modified special effect files.

Custom content can be placed into subdirectories within these locations, such as override\MyCustomContent - i.e. you don't need to mix all your custom content files together in the same directory. It is therefore recommended that you do this so that your custom content can be readily identified from other installed custom content. This is true also for files place in the UI directories. In this case the folders are evaluated in alphabetical order, so content in a folder called "zulu" will override content in a folder called "aardvark". (Not certain that the order is alphabetically. My testing indicates that if you have the same file in multiple subfolders then the one in the newest subfolder is used. - Kaldor Silverwand)

Campaign directoryEdit

This is something I don't have any real experience with. Basically, it is a module specific Override folder. I believe the main advantage is that a campaign can carry over journal entries between modules that share the same campaign folder. In terms of adding custom content, I would still recommend a hakpak solution for integration of custom content into a campaign.


The campaign directory is used for content (scripts, conversations, blueprints) that is shared across all the modules in a campaign. Putting common resources in the campaign folder reduces the size of the modules and speeds load time. The campaign folder content is higher in the hierarchy than module content. So if there is a module script that needs to be updated then releasing the new version in the campaign folder will allow the new script to work, even with already saved games. For this reason it is good practice to have yoru modules always have on client enter scripts named, even if they do not exist. That way if you need to have something change in the module after its release you can simply release an on client enter script in the campaign folder. While NWN1 usd modules for everything, best practice is for NWN2 adventures to be released as campaigns. - Kaldor Silverwand

UIEdit

Custom UI files may be placed here. This normally includes .xml and .tga files, though it seems to also work with .2da's.

Some modules (mostly persistent worlds) have their own UI. Players who visit different PWs, each with their own UI, need to be able to tell the game which UI to load. This is done by a setting in the nwn.ini file. By default this is set to:

[UI Options]
CurrentGUI=default

Changing this setting allows you to specify which UI folder to load. With the default setting, each folder is evaluated in alphabetical order. UI/zzz/my.xml will override UI/aaa/my.xml

If you install your UI mod in this way then it's behavior will depend on the nwn.ini setting, other UIs installed and the alphabetical ordering of them.

Note that as of patch 1.04 content placed in the UI folder must be within its own directory or in the "UI/custom" folder.


Hak PacksEdit

The hak directory contains custom content packaged in a compressed archive or .hak file. Content in a hak file will only be loaded if the module being played calls for it. Module specific custom content uses hak files.

Adding content using a hakpak:

This is the preferred method of custom content distribution. A hakpak is simply an archive file (like a .zip, but not compressed) which holds numerous other files. hakpaks are placed in the C:\Documents and Settings\YOUR_LOGIN_NAME\My Documents\Neverwinter Nights 2\hak folder. Unlike the Override directory method, hakpaks are only in effect for the module they are associated to. This means they will not alter any game sessions where the module being played doesn't have the hakpak attached to it. This makes hakpaks much more of a targeted approach to custom content deployment; whereas, the override method is much more of a blunt instrument approach.

This method also avoids the possibility of overwriting some of the files between custom content packages. Since each hakpak contains all of the files for the custom content package, there is no possibility of one hakpak overwriting the contents of another. For example, you could have three custom content packages for three different modules you downloaded with each hakpak containing a placeables.2da. Using the Override method you may overwrite the placeables.2da twice when you unpack the 2nd and 3rd custom content package into the Override (unless they are contained in separate directories, in which case they will conflict) -- this will break functionality of package one and package two. Using the hakpak method you will have three individual hakpaks sitting in your \hak folder and each one will only become active when you launch a module that has the hakpak associated to it. Otherwise, the haks sit innocently in the \hak folder not interfering with each other or the base game install.

Creating and adding hakpaksEdit

A lot of misinformation seems to be floating about regarding hakpaks, so I'll attempt to explain the basics as clearly as possible. As stated above, a hakpak, at its simplest, is just an archive file. NWN2 did not ship with a tool to let us create hakpaks, but we do have tools available to let us do this thanks to the community. NWN2 style hakpaks are slightly different from NWN1 style hakpaks -- NWN2 uses an updated version of the file format (v1.1 as opposed to NWN1 v1.0). This means that the hak editor for NWN1 will not give us the full functionality needed for creating NWN2 hakpaks (for example, it will not accept any of the new file formats introduced in NWN2 [.mdb, .bbx, .pfx, etc.]).

So, we need a tool to do the job for us. ERFinder by Tanita is the tool I have been using and it works very well. There is also another tool I'm aware of called Encapsulated Resource File Editor by Ranmanu, but I haven't experimented with it too much. The process for using these tools is relatively straightforward: you add your custom content files through the program interface and then save as a .hak giving it a file name. Make sure the hak is in the C:\Documents and Settings\YOUR_LOGIN_NAME\My Documents\Neverwinter Nights 2\hak folder.

Now, we have our hakpak, but a hakpak is not active unless it is associated to a module. The process of associating a hakpak to a module is done through the toolset. Open your mod in the toolset and go to View --> Module Properties. In the properties tab you will see a listing for hakpaks. Click on it. A new window will open. Click the Add button and a new entry will appear on the top right. Click where it says FileName, navigate to your C:\Documents and Settings\YOUR_LOGIN_NAME\My Documents\Neverwinter Nights 2\hak folder and choose your hakpak. Press OK, save your module and you're done. Whatever the hak adds or changes should now be active in the toolset for that module as well as active in-game when that module is played. Multiple hakpaks:

Multiple hakpaks can be attached to a single module. They are added in the same way as described above. As you add hakpaks you will see the list on the top left of the hakpak interface panel grow. As mentioned above, hakpaks are safer than loose files because you can never run the risk of overwriting a file when installing multiple packages. However, this doesn't mean you don't need to deal with resource conflicts at all. If you have two or more hakpaks that contain the same resource, then you will have a resource conflict. The way this is dealt with is the same as I described above regarding resource repositories -- hakpaks are subject to a hierarchical priority system. The priority is determined by the hakpak's position in the hak list displayed on the hakpak interface panel. You will notice that haks are numbered from 0 onwards. * Currently, the toolset will take the last hakpak listed as the highest priority hak on the list. If you had three haks numbered 0, 1 and 2, then the hakpak listed as number 2 would be the highest priority. So, if hakpak number 2 had the same resource as hakpak number 0 or hakpak number 1, then the resource from hakpak number 2 would be the one used.

The way resource conflicts between haks are resolved is through the creation of a "master" or "control" hakpak and placing it in the highest priority position. The idea here is to take your conflicting resources, merge them and then place them in a hakpak. So, for example, we have two hakpaks that both contain a placeables.2da. The first hakpak adds a placeable at line 2000 of the 2da and the second hakpak adds a placeable at line 2100. We would create a placeables.2da where we copy line 2000 from the first hakpak's placeables.2da and a paste it in at line 2000 and then copy in line 2100 from the second placeables.2da. This way we have a single placeables.2da that contains the entries from both hakpaks (Note: I'm omitting some steps for the merging of 2da's [i.e. padding] as the subject is beyond the scope of this document). We then place that new placeables.2da in our control hak and set that hak in our hak list so it has priority over hak one and two. Hakpak Issues:

  • Note: The priority system is broken as of v1.04. The toolset should be taking hakpak number 0 as the highest priority. This is the way the game engine reads it, so when you want to run your module you need to move your haks to the opposite order.

Sometimes you will find a resource instance or resource type that will not function from a hakpak. This list is shrinking as Obsidian has been correcting these issues. If you find something that does not work from a hakpak let Obsidian know -- they can't fix it if they don't know about it. It should be said that I have added tiles, placeables, base items, visual effects, GUI .xml files, .dds textures and more all through the hakpak system alone. So, while you may find some items that won't function at this time, the problem is not nearly as wide spread as I have seen some declare it to be. For example, I have seen "2da's do not work from hakpaks". This is plainly incorrect. I believe nwn2_deities.2da is not working from a hakpak right now, but that is far from saying no 2da works from a hakpak. Also, some items that won't work from a hakpak also don't work from the Override. This is likely because those resources are from specialized folders like the UI folder. Obsidian also seems to be working on adding this content to be supported through the hak system (i.e. the UI .xml files work from haks).

Haks currently aren't loaded until after a player creates a character. This means any changes to the character creation process you make via a hakpak aren't in effect until it's too late. Obsidian has stated they will be fixing this so that all content will be loaded before the player hits the character creation screen.

FAQEdit

Q: I'm just a player. What do I do with haks?

A: Place them in your C:\Documents and Settings\YOUR_LOGIN_NAME\My Documents\Neverwinter Nights 2\hak folder. When you downloaded the hak it probably came in a .zip or .rar file -- you need to unpack it and place the file(s) with a .hak extension in the folder. You don't need the .rar or .zip in that folder.

Q: I'm a player and a builder. What do I do with haks?

A: Place them in your C:\Documents and Settings\YOUR_LOGIN_NAME\My Documents\Neverwinter Nights 2\hak folder. When you downloaded the hak it probably came in a .zip or .rar file -- you need to unpack it and place the file(s) with a .hak extension in the folder. You don't need the .rar or .zip in that folder.

Q: I'm a player, a builder and a custom content developer. What do I do with haks and how should I develop content?

A: Place haks in your C:\Documents and Settings\YOUR_LOGIN_NAME\My Documents\Neverwinter Nights 2\hak folder. When you downloaded the hak it probably came in a .zip or .rar file -- you need to unpack it and place the file(s) with a .hak extension in the folder. You don't need the .rar or .zip in that folder. You can use the Override directory for developing your custom content as it easier to add/remove files from it than updating a hakpak numerous times as you make changes. Note that if a file is in a hakpak associated to a module, then adding that same file to the Override will do nothing for that module as hakpaks take priority over the Override folder. Best practice is to develop your content first using the Override directory and a test module with no haks associated. Then, when your project is complete, package the files from the Override into a hakpak, associate the hakpak to your test or demo module and remove the files from the Override. When everything checks out (play your demo module, open the module in the toolset to see that your content is present, etc.), package your hak into a .rar or .zip file along with a demo module to showcase your work, if you wish. You should provide a version number for your content, a readme file and also ensure your hakpak has a unique name or prefix (to avoid conflicts with other hak creators). For example, I preface my hak names with "Heed_". Your initials or anything else fairly unique to yourself should do.

Around Wikia's network

Random Wiki