PRC Server Pack Install

The server pack contains many useful utilities for running a server with the PRC. It is available as a Windows installer or a rar archive for manual installation. This covers manually installing the server pack and what to do with the components. While it is designed for a server running on Windows, the server pack is still useful for Linux servers because it contains the precacher.

The current version of the server pack is 1.8.3.

Why Do a Manual Install?

Installing the Server Pack - File List

If you have a previous version of the server pack, uninstall that first. Download and unpack the rar file. It should contain the following:

Installing the Server Pack - NWNx

The server pack contains NWNx, various NWNx plugins and the NWNx documentation. Further information and the Linux binaries can be found on the NWNx site. To install the NWNx core, put the following files in your NWN directory:

That's it - installed. Look at nwnx.ini to configure it. The default .ini is usually fine, all you need to do is add the name of the module to load in the right place leaving out the .mod extension eg.
Module = "MyModule"

The most common NWNx plugins are included in the server pack. While they are optional, the Conversation Character Creator requires the ODBC (database) and Letoscript plugins to work.

ODBC Plugin (nwnx_odbc.dll)

This provides the database connectivity. The online documentation for the plugin covers pretty much everything. There's a copy of it in the server pack (nwnx_odbc2.html). The PRC scripts include the APS functions in inc_2dacache.nss and the initialisation function is already in the PRC's module load event script. Therefore there is no need to import the APS erf.

To use MySQL with the ODBC plugin, you need to download it from the MySQL website. Follow their install instructions. If using their Windows installer, the defaults are generally ok, but check the option to add mySQL to the PATH variable. You'll only have to add it later otherwise. Also see Appendix A: Creating a NWN user and database.

LetoScript Plugin (LetoScript.dll, nwnx_leto.dll)

The server pack comes with LetoScript version 3+24, which uses the Unicorn syntax. For the LetoScript functions to work, the server needs to be using servervault characters - strangely enough Letoscript can't edit files on a remote computer. Also be aware that LetoScript works out the bic filename by using the first 16 characters of the PC's first name + last name.

Profiler Plugin (nwnx_profiler.dll)

The plugin profiles running scripts, logging how often a script has been called and how much time it took to complete. The online documentation explains how it can be used. There's also a copy of it in the server pack (nwnx_profiler.html). It's not required for any PRC functions, but it's very useful.

Installing the Server Pack - The Precacher

Why Bother?

Using the NWNx database as the 2da cache is required for the Conversation Character Creator to work.

In a single player game, the PRC scripts read 2da data from the Bioware database (that's what the PRC_DATA.xxx files are for). For the Conversation Character Creator, the Bioware one isn't really fast enough, so the 2das for character creation are stored in the database used by NWNx. The precacher reads the PRC and some Bioware 2das into the database as doing this while playing causes the game to become unresponsive.

Running the precacher on Windows

First, install the PRC, then put the following files in the main NWN install directory:

Double click on the appropriate batch file (precacher sqlite prc.bat for sqlite, precacher mysql.bat for mySQL).

Running the precacher on Linux

First, in the directory where you extracted prc.jar, create a directory called precacher2das. Add the following files to the precacher2das directory:

Using the command line, go to the directory prc.jar is in and enter: java -Xmx100m -jar prc.jar 2datosql precacher2das MySQL

Note: this method will also work for Windows if you don't want to use the batch file.

Note for modules using custom content

If you are using custom content that modifies 2das used by the conversation character creator, then those 2das will need to be used by the precacher. If the default ones are used, the custom content will not show up in the ConvoCC (e.g. to get custom appearances to show up as options, you would need to precache using your custom appearance.2da instead of the default Bioware one).

The convoCC uses the following 2das:

Installing the Server Pack - Making the 2DA Cache Database

Using sqlite

After the precacher has finished, a file called sqlite.db will have been created. This is the database and it just needs moving to the NWN install directory on the server.

Using mySQL

This assumes mySQL is in the PATH for Windows. The precacher creates a file called out.sql, which needs moving to the server where the mySQL database is going to be created.

  1. open a command prompt
  2. go to the directory you put out.sql in
  3. type: mysql -u user -p databasename < out.sql > out.log (replace the user and databasename with whatever it should be)
  4. enter the password when prompted

For Linux, the command line is:
cat out.sql| mysql -u user -p databasename

There are several arguments that mysql takes, eg -u username and –user=username are equivalent, see the MySQL manual.

The log file will be empty, but it stops mySQL echoing a confirmation after every line of the sql file (it has a lot of lines) and it stops if it encounters an error.

Note: the Linux version of NWNx only has MySQL support, also there is no Linux version of sqlite.

That's It

Suggestions please, particularly if something's missing or incorrect.

Except for the mini FAQ

Q1. I don't know how to run an installer/open a command prompt/change directory etc. Why didn't you include that in the instructions?

A. If the instructions covered every detail, they would be huge. Try the NWNx and MySQL documentation or the PRC forums to get help for anything not covered here.

Appendix A: Creating a NWN user and database

To use the NWNx database plugin with MySQL, you need to create:

There is an example setup file (newMySQLinstall.sql) to to this for you. It will create a database and a user that has rights to read and modify that database. You should edit the file to change the example password to something sensible ("password" is not a sensible password!). The username and database name are fine to be left as is for most setups.

To get the MySQL server to read newMySQLinstall.sql file, you should do the following:

  1. open a command prompt
  2. go to the directory you put newMySQLinstall.sql in
  3. type: mysql -u root -p < newMySQLinstall.sql
  4. enter the password when prompted

You usually need to log in as root to create a user and a database. On Windows, you need to add MySQL's bin directory to the PATH variable unless you did that already.

Credits

The ODBC and profiler plugins are from nwnx.org and virusman's site (see this NWNx forum thread) , the LetoScript plugin from Project Leto's sourceforge site. SQLite is avaliable from www.sqlite.org. The Precacher is based on a version made for the PRC by Yuritch, but rewritten into java by the PRC.