Jump to content

BG2 Kit Creation: Installing with WeiDU


Recommended Posts

First, I've received PMs and a few emails asking me to hurry up and finish the next part of the tutorial. Thanks all, for your interest, and apologies all, for the delay. :)

Today's topic will cover using WeiDU as a distribution and installation tool. For those of you who do not know how to use WeiDU or are building your first mod, I've also included a section with a basic WeiDU mod set-up. For those of you already familiar in the ways of tp2, you can skip down to the next section. :)

Creating a WeiDU Mod - The Basics

A WeiDU mod is essentially the WeiDU program itself, a list of instructions that tells the WeiDU program what to do (the tp2 file, discussed more below) and the files required for your mod--such as items, spells, etc. Your first step is to grab the actual WeiDU program at weidu.org; the current version is v155. Find the weidu.exe program and rename it to Setup-MyMod.exe. Throughout this tutorial, I will use MyMod; however when creating your mod replace MyMod with the name of your mod.

As an aside, the examples included with WeiDU itself, as well as the documentation, are a source of tutorials in and of themselves.

The next step is to create a folder named MyMod that will hold, among other items, the backup folder and other files for your mod. Inside the MyMod folder, create another folder named backup. When a WeiDU mod is installed, any files that are changed or altered are stored in the backup folder for uninstallation purposes. You'll also want to add a single text file or something inside your backup folder. (If you compress your mod into ZIP or RAR format, some programs will ignore empty folders when decompressing it. This can lead to a missing backup folder, which, in turn, will cause installation of your mod to fail. We add a meaningless file to the folder to make it non-empty.)

Finally, we create the tp2 file. The tp2 file is a text file that tells WeiDU how to install and uninstall your mod. A tp2 file esentially contains a header--containing information such as the author, language options, etc.--and a section for every mod component. So create a text file named Setup-MyMod.tp2 and place it inside the MyMod folder. You can use any text editor for working with the tp2 file, though I would recommend Visual Studio Code together with the BGforge MLS extension created by @Magus for syntax highlighting and autocompletion. (Note: Text editor recommendation last updated in January 2021.)

Once created, open your tp2 in your editor of choice. Throughout the syntax, you'll see comments from me. In the tp2 file anything between a /* and the closing */ is a comment and ignored by WeiDU. Another form of comment is // which tells WeiDU to ignore everything from // to the end of the line. To start with, we need to create the header. So add this to your tp2:

BACKUP ~MyMod/backup~ // so WeiDU can uninstall
AUTHOR ~myemail@mydomain.com~ // contact address displayed if installation fails

These are the bare minimum required for a mod. There are additional commands you can add to the header; I refer the reader to the WeiDU documentations for a full list. After the header, you'll need to add commands for each component of your mod.

BEGIN ~Tutorial Kit~ // name of this component

You can have as many BEGINs as you like; each BEGIN is a new component for your mod. When we discuss using the ADD_KIT command, below, you'll need to add it after BEGIN.

Finally, on to the ADD_KIT command

ADD_KIT is a powerful command for WeiDU that will modify almost all files necessary to create a kit. Probably the best way is to first post code in full, then we'll go back over it line-by-line. This is the Silverstar of Selûne kit from Cleric Remix, which we will use as an example.

// internal name of the kit
ADD_KIT ~C!Selune~

 // appended to CLASWEAP.2da
 ~C!Selune                0           0           1           1           0           1           0           0~

 // appended column-wise to WEAPPROF.2da
 ~C!Selune 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0~

 // appended to ABCLASRQ.2da
 ~C!Selune                0       0       0       0       9       0~

 // appended to ABCLSMOD.2da
 ~C!Selune                0       0       0       0       0       0~

 // appended to ABDCDSRQ.2da
 ~C!Selune                0       0       0       0       17      0~

 // appended to ABDCSCRQ.2da
 ~C!Selune                0       0       0       0       15      0~

 // appended to ALIGNMNT.2da
 ~C!Selune                0       0       0       1       0       0       1       1       0~

 // appended to DUALCLAS.2da
 ~C!Selune                1       0       1       1       0       1~

 // path to your CLAB-style 2da file
 ~Cleric_Remix/Selune/C!Selune.2da~

 // PC races and classes allowed to use this kit, from KITTABLE.2da
 ~K_C_D K_C_E K_C_G K_C_H K_C_HE K_C_HL K_C_HO~

 // usability flags, added to the end of the KITLIST.2da entry
 ~0x00004000     3~

 // HLA table to use; see LUABBR.2da
 ~C!3~

 // list of starting equipment for PCs starting in ToB. Appended column-wise to 25STWEAP.2da
 ~CHAN09 * HELM07 BAG20 RING06 RING31 * BOOT01 AMUL19 BRAC16 BELT06 AROW11,40 BULL03,40 BOLT06,40 POTN52,5 POTN4,2 POTN14,5 HAM07 SW1H27 STAF08~

 // Lower, mixed, and help kit names and descriptions, added to KITLIST.2da
 SAY ~Silverstar of Selûne~
 SAY ~Silverstar of Selûne~
 SAY ~SILVERSTAR OF SELÛNE: Description cut due to length~

OK, so now line by line. You'll notice that with most of these I've removed the comments.

ADD_KIT ~C!Selune~

C!Selune, in this example, is the internal name of the kit as it will be referred to in the game files. The internal name you specify here will need to be consistent throughout the rest of the ADD_KIT command.

 // appended to CLASWEAP.2da
 ~C!Selune                0           0           1           1           0           1           0           0~
 // appended column-wise to WEAPPROF.2da
 ~C!Selune 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0~
 // appended to ABCLASRQ.2da
 ~C!Selune                0       0       0       0       9       0~
 // appended to ABCLSMOD.2da
 ~C!Selune                0       0       0       0       0       0~
 // appended to ABDCDSRQ.2da
 ~C!Selune                0       0       0       0       17      0~
 // appended to ABDCSCRQ.2da
 ~C!Selune                0       0       0       0       15      0~
 // appended to ALIGNMNT.2da
 ~C!Selune                0       0       0       1       0       0       1       1       0~
 // appended to DUALCLAS.2da
 ~C!Selune                1       0       1       1       0       1~

Appends data to the various 2da files. For a refresher on the various 2das, see part two of the tutorial. The spacing between entries is actually unimportant, as it can be one space or several. However, for convenience, I have spaced out the entries here so that they will line up with the columns in a default installation. Data that is appended column-wise is added in a column, rather than a row.

 ~Cleric_Remix/Selune/C!Selune.2da~

This is the path to your CLAB-style 2da file for the kit. If you were to use MYKIT.2da and put it inside the MyMod folder, than this line would be ~MyMod/MYKIT.2da~ instead. The filename can not exceed eight characters.

 ~K_C_D K_C_E K_C_G K_C_H K_C_HE K_C_HL K_C_HO~

This line determines what combinations of class and race to make the kit available for a player character, as found in KITTABLE.2da. If you want the kit to not be available to the characters created by the player, then use ~~ instead. Creating non-player kits can be useful if you want to give an NPC or a monster a powerful or unique kit, but don't want the player to have access to it. It can also be used for special modifications to an existing kit for an NPC. Chloe, for example, uses a Kensai kit that is not available to the PC that disallows dual-classing.

 ~0x00004000     3~

The usability flags for KITLIST.2da. I have again spaced these to match the columns, though this is not strictly necessary. Refer back to part two for more information on the usability flags.

 ~C!3~

Determines which HLA table to use for the kit. (If the kit is installed on an SoA-only game, the lines delaing with ToB are ignored.) If you use a custom table, you'll need to copy it over separately (covered below).

 ~CHAN09 * HELM07 BAG20 RING06 RING31 * BOOT01 AMUL19 BRAC16 BELT06 AROW11,40 BULL03,40 BOLT06,40 POTN52,5 POTN4,2 POTN14,5 HAM07 SW1H27 STAF08~

A list of starting equipment for a PC using this kit in ToB, appended column-wise to 25STWEAP.2da. If you don't want a kit to have a piece of equipment in a particular slot, you can use a * instead. This line is also ignored on a ToB-only installation.

 SAY ~Silverstar of Selûne~
 SAY ~Silverstar of Selûne~
 SAY ~SILVERSTAR OF SELÛNE: Description cut due to length~

And finally, the name and description of your kit. These correspond to the lower, mixed, and help descriptions of your kit in KITLIST.2da. While many mods treat the mixed and lower strngs differently, I have yet to see a difference and usually use the same string for them. The third SAY, with its longer description, can run over more than one line.

So if we were to combine these, and exclude the comments. it would look like:

ADD_KIT ~C!Selune~
 ~C!Selune                0           0           1           1           0           1           0           0~
 ~C!Selune 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0~
 ~C!Selune                0       0       0       0       9       0~
 ~C!Selune                0       0       0       0       0       0~
 ~C!Selune                0       0       0       0       17      0~
 ~C!Selune                0       0       0       0       15      0~
 ~C!Selune                0       0       0       1       0       0       1       1       0~
 ~C!Selune                1       0       1       1       0       1~
 ~Cleric_Remix/Selune/C!Selune.2da~
 ~K_C_D K_C_E K_C_G K_C_H K_C_HE K_C_HL K_C_HO~
 ~0x00004000     3~
 ~C!3~
 ~CHAN09 * HELM07 BAG20 RING06 RING31 * BOOT01 AMUL19 BRAC16 BELT06 AROW11,40 BULL03,40 BOLT06,40 POTN52,5 POTN4,2 POTN14,5 HAM07 SW1H27 STAF08~
 SAY ~Silverstar of Selûne~
 SAY ~Silverstar of Selûne~
 SAY ~SILVERSTAR OF SELÛNE: Description cut due to length~

Cool, but what about all the spells, items, and other fun stuff I need for the mod?

Adding spells, items, and other nifty WeiDU commands pertaining to kits will be covered in the fourth and final installment.

Please post discussion and comments to the kit creation series discussion thread here at The Gibberlings Three and we will do our best to answer your questions.

Complete Series

Edited by Mike1072
Link to comment
Guest
This topic is now closed to further replies.
×
×
  • Create New...