With the unfortunate proliferation of primitive mods we are currently seeing, I thought it might be helpful to have a simple and straightforward introduction to how to make WeiDU mods. Due to the vast scope of IE modding and WeiDU, this is in no way a comprehensive treatment of what you can do with modern techniques, but it should be serviceable for a fair share of the mods we are seeing posted here. If you then feel like learning more, so much the better.
Short introduction to WeiDU
WeiDU is a mod-distribution tool and mod manager [1] for the Infinity engine. Since shortly after its inception in the earlier half of the last decade, WeiDU is the de facto standard for IE mods (to the point where you had to look under the right rock to find a non-WeiDU mod). Salient features include patching of existing game resources [2], a powerful language for creating (complex) dialogue, automatic backups of game resources for facile mod uninstallations and a scripting system for mod installation and configuration.
You could say that WeiDU has a lot of depth and maybe the WeiDU way (such as it is) can seem opaque and daunting to the novice modder. However, a WeiDU mod need not be complicated. The simplest sort of mod could consist of as little as a file–folder structure and four lines of install script (of which three lines would be largely the same across all mods).
The latest version of WeiDU is normally available from WeiDU.org. It can also be worthwhile to check the forum.
Sample WeiDU mod
A WeiDU mod consists of two things: 1) a mod folder, which houses any files you include in your mod and will house the backups created during mod installation, and 2) a installation script called a TP2 file, conventionally located inside the mod folder. Customarily, the mod is distributed together with a copy of WeiDU itself, but this is not a formal requirement. The copy of WeiDU would be named setup-mod_name.exe, where mod_name is the name of the mod folder.
The mod folder should have a name that is reasonably likely to be unique, since all mod folders exist as sub-folders in the game folder. For example, wisp_item_mod would be a better name for a mod folder than item_mod. [3]
The TP2 file should have the file extension "TP2", have the same name as the mod folder and be located directly inside the mod folder. [4]
Any other files you wish to include should likewise be placed in the mod folder, preferably in sub-folders of their own if the files can be grouped like that.
As a simple example of a WeiDU mod, say I wanted to distribute a few item files for others to enjoy. Maybe I had made some changes, which I felt improved the quality of the game, to these files with my editor of choice. I could call this mod "Wisp's item mod", with a mod folder called wisp_item_mod, containing a TP2 file called wisp_item_mod.tp2 and the sub-folder copy, which would contain my altered item files.
I would write the following TP2 file for this mod (commented for your benefit):
/*
* Note:
*
* Lines starting with double slashes (//) are comments and are completely ignored by WeiDU.
* They are strictly for your convenience (and whoever else reads your TP2 file).
*
* Likewise, text enclosed in matching, reverse pairs of slashes (/) and asterisks (*),
* like this text, is commented, with the difference that this text can span multiple lines.
* These block quotes can not be nested. Starting each line with an asterisk is just
* convention to make the comment look more distinguished.
*
* So-called strings are used to enclose spaces and special characters. They carry some
* significance beyond that, but we need not go into that now. WeiDU has a few notations
* for strings. Pairs of tildes (~) and double typewriter quotes (") are normally used.
* Each can enclose the other, but never itself.
*
*/
/*
* BACKUP declares where WeiDU should put the information it uses to uninstall your mod.
* Conventionally, this is a folder called "backup" located directly inside your mod folder.
* There is no need to create this folder yourself, or take steps to make sure it exists when
* the user tries to install your mod. This is a folder-path declaration, so there are "wrong"
* things to write here, but conventional wisdom applies. Note that WeiDU will automatically
* convert slashes into backslashes and vice versa, as needed. Case is irrelevant (with one
* exception that is only relevant to installing mods on GNU/Linux).
*/
BACKUP ~wisp_item_mod/backup~
/*
* AUTHOR declares what information should be displayed to the user in the event there is some
* error while installing your mod. Normally, it will ask the user to email the mod's debug file
* to whatever AUTHOR declares. This means it should preferably be something useful, like an actual
* email address, or some other way in which you can be reached. This is simple text, so there are
* no limitations on what you can write.
*/
AUTHOR ~Wisp, at some forum~
/*
* BEGIN declares a mod component, which the user can install. A mod can have multiple components, but
* must have at least one. The text is displayed to the user when the mod is installed and is printed
* to the log file. This is likewise simple text, so spaces and special character are completely
* acceptable.
*/
BEGIN ~Wisp's item mod~
/*
* COPY is the substance of this TP2 file. COPY declares that WeiDU should copy a file, or the files in
* a folder to a destination file or destination folder. In this case, every file located in the "copy"
* sub-folder will be copied into the override folder. Should there already be files with the same name
* in the override folder, WeiDU will place them in your backup folder and restore them when the mod
* is uninstalled. This is once again a folder-path (or file-path) declaration, so it needs to be
* written correctly.
*/
COPY ~wisp_item_mod/copy~ ~override~ //Don't forget to delete the existing files, if you make use of this mod template.
This is barely scratching the surface of what WeiDU can do, but perhaps it can serve as a useful starting point. It is certainly preferable to simply handing people a handful of files, for them to manage themselves. For a more hands-on example, the faux-mod itself can be found attached to this post. Poke, probe and prod it to your content. You can use this as a template for any mod which merely places files in the override (or another folder).
Naturally, I will answer any questions you may have about things I left out, did not adequately explain or just took for granted.
Footnotes
1. Yes, it is a mod manager. It may not be graphical, but it will handle your mods for you if you, say, decide to uninstall the second mod of a set of three.
2. Including the TLK file, which is the single resource containing all of the game's text (save a handful of hardcoded exceptions). The TLK file stands out, because without patching you could not use two mods which both added/altered game text.
3. The folder name should preferably not contain spaces and non-alphanumeric characters, though they can sometimes be used without problems. Conventionally, the underscore (among others) carries no special significance and can safely be used. The name does not have to be pretty, just functional.
4. You may occasionally see WeiDU mods that come with a TP2 file prefixed with "setup-" and/or is located outside the mod folder. These are older practices that are unnecessary and not recommended today, respectively.