Everything You Never Wanted To Know About Module Reskinning And Have Been Forced To Find Out.
I. Tools Required
- KotOR Tool – essential for all KotOR modding.
- GFF Editor OR K-GFF – to edit the module files. (Note that for this tutorial I shall be using a standard Bioware GFF Editor; however, if you wish to use cameras in your mod, you may wish to use tk102’s K-GFF, as the standard GFF editor will screw them up.)
- Picture editor – PSP, Photoshop, the Gimp or something else. For this tutorial, I shall be using the Gimp, v2.0.
- HEX Editor – For this tutorial, I shall be using xvi_32 by Christian Maas.
- stoffe -mkb-‘s ErfEdit v02a8.
- A legal copy of Star Wars: Knights of the Old Republic for PC
- Notepad or a similar basic text editor.
- One human(oid) brain, still encased in body, preferably living.
I.I – Skills Required
-Some understanding of KotOR Tool.
-Some understanding of module/GFF Editing and the files involved.
-Some understanding of skinning.
-Some knowledge of HEX Editing.
Ever wanted your new module to be a little less same-y? Ever wanted to re-skin a module for your mod, but keep the original looking the same? Well, now you can!
This is an area which has been somewhat overlooked in the past, I feel, partly because it hasn't been in much demand. However, now such demand is increasing, and there aren't that many people who know exactly what to do. So I present to you a tutorial on this subject
Note that while I've gone into sometimes rather too-great detail for most people, this is NOT an all-singing, all-dancing tutorial. This tutorial does not cover re-skinning, HEX-Editing, using KotOR Tool, or module editing.
It DOES cover module re-skinning, and what to do to make that re-skin apply only to your new module.
III: Preparations, And Extracting Files
III.I – Preliminary Groundwork
To start with, I recommend creating a new folder. Call it anything you like – as an example, ‘New Module Project’. It’s best to choose something clear, so you can remember what’s in this folder later on.
Open the folder, and create a new folder inside it. I would call this one ‘Module’, for clarity.
III.II – Module File Extraction
Now, open up KotOR Tool, and select ‘KotOR I’.
Go to RIMs-->Modules, and select the name of your chosen module – for this tutorial, kas_m23ab.rim . Extract both kas_m23ab.rim and kas_m23ab_s.rim into the folder ‘Module’ that you created in your ‘New Module Project’.
III.III – Lightmaps, Layouts And Visibility
Close the RIMs-->Modules tree, and open BIFs.
Take a deep breath. Yes, there are a lot of options, but don’t panic!
Click on layouts.bif, and select ‘Layouts’, then scroll down until you find m23ab.lyt .
Click ‘Extract file’, and save it to the ‘New Module Project’ folder.
Now, close layouts.bif and open lightmaps7.bif and scroll down until you find the files which have names beginning ‘m23ab’ – these are the lightmaps for our module. Extract all of the files beginning ‘m23ab’, from m23ab_01a_lm0 to m23ab_01a_lm6 to the ‘New Module Project’ folder.
Now, close the TGA Images tab, and open the Extra Texture Info tab.
Again, scroll down until you reach m23ab_01a_lm0, and extract all seven files, from m23ab_01a_lm0.txi to m23ab_01a_lm6.txi, and then close the tab.
Now, open the vis tab, and select and extract m23ab.vis.
Now close lightmaps7.bif .
III.IV – Textures And Models And Walkmesh, Oh My!
This next bit is a little more complex, so follow these instructions carefully.
Open models.bif-->Aurora Model, and scroll down until you find m23ab_01a.mdl .
Double-click on m23ab.mdl, so that the Model Extraction Options box comes up.
Change the export path to your ‘New Module Project’ folder, and click OK.
(Note: Ensure that the ‘number of consecutive models to extract’ box is set to 1.).
When the notification that the extraction is complete comes up, click ‘OK’, and open the folder, and delete the file named m23ab_01a-ascii.mdl.
Now, in KotOR Tool, highlight m23ab_01a.mdl again, and click the ‘Extract File’ button. Extract it to your ‘New Module Project’ folder, and close the Aurora Model tab.
Open the Aurora Model Extension tab, and scroll down until you find the file named m23ab_01a.mdx . This file you should extract to the ‘New Module Project’ folder, and then close the Aurora Model Extension tab.
Lastly, open the Walkmesh tab, and scroll down until you find a file named m23ab_01a.wok . Extract this file to the ‘New Module Project’ folder, and close BIFs.
Congratulations! You have now extracted everything that is used by the game in creating this module.
IV. – Reskinning and Lightmapping.
Now, using KotOR Tool, open ERFs, and select TexturePacks. For this mod, we will use Texture Pack A, so select swpc_tex_tpa.erf . Open the subtree marked ‘L’, and scroll down to the files marked LSI.
Extract the following files and their TXI files (Note: To extract the TXI files, check the box marked ‘Export Selection to TXI file’, and highlight everything in the white text box):
All these will extract as .tga files.
Close KotOR Tool.
Now, open in the GIMP lka_bark01.tga and LSI_wall11.tga . You will probably notice that lka_bark01 is much bigger than LSI_wall11. This doesn’t matter. Copy LSI_wall11, and past it on top of lka_bark01. You will probably have to past it several times to make it cover the entire texture, but never mind. Once you’re done, save it, and close both files.
Now, reskin the rest of the files named ‘lka’, (Note: Some editing of the changed textures may be required- do so at your own discretion ) and save them.
Delete all the files beginning ‘LSI’, and rename the ‘lka’ files to begin ‘lz1’, or some similarly unique identifier. Do not change the rest of the filename – only the first three letters.
Now, open the file named m23ab_01a_lm0.tga with the GIMP. This file is a lightmap, a type of file we know very little about. I do not recommend anything more than very basic editing of the type I will show you now.
Go to Layer-->Colours-->Hue-Saturation.
Move the slider next to the word ‘Hue’ all the way to one end. You will see the colours on the image change with it. Now, move the ‘lightness’ slider until the number next to it reads as ’30’. Finally, move the ‘Saturation’ slider back until the number next to it reads ‘-30’. Save and close the file, and repeat this process for the other lightmap (m23ab_01a_lm0-m23ab_01a_lm6) files.
Close the GIMP, and rename the lightmap files so that the name is changed from ‘m23ab’ to ‘m65aa’, or some similarly unique identifier.
While you’re at it, open the .lyt file with notepad, and change any references to ‘m23ab’ to ‘m65aa’. Close it, and then rename the file to ‘m65aa.lyt’. Do exactly the same with the .vis file. Also, rename the WOK file to m65aa.wok.
Optional: Creating A Mini-Map
It won’t crash your game if you don’t include one, but it is a useful thing to add in, and is a nice touch to add in
Open up KotOR Tool, and open ERFs. Select swpc_tex_gui.erf , and scroll down to ‘L’. Open ‘L’, and scroll down again until you find a file named lbl_mapm23ab.tpc. Double-click it so that the image viewer window comes up, and click ‘write file’. Select to write it to your ‘New Module Project’ folder, and save it as lbl_mapm65aa.tga .
Close KotOR Tool, and open the new file in the GIMP. Using the Hue-Saturation tool, change the Hue to -180, and the Saturation to -50. Now, paint over the now-orange bar where the door is in the module in blue, with the paintbrush set to Normal, and the Opacity at 100%. I recommend a 3 pixel fuzzy tip.
Save and close the file, close the GIMP, and place the file in your override. Et Voila, one mini-map.
V. HEX-Editing And The Model Files
These things having been completed, open up your model file (m23ab.mdl) with your HEX Editor. You should be familiar with this device if you have ever done much work with lightsabre models.
On one side, you will see box after box of numbers. Ignore this. On the other, there will be what appears to be a random selection of characters, as well as (hopefully) ‘m23ab_01a’ without the quotes. You need to ensure that this side is selected, and so shows up in white.
Now, from the top menu bar, click ‘Search’, and then ‘Find’. Set it to search down, and search for a text string. Then, in the box provided for the search term, type ‘23ab’. Now click OK.
It will now highlight the ‘2’ of that first instance of ‘m23ab’. Now, type ‘65aa’. You will see the ‘23ab’ change to ‘65aa’. Now press ‘F3’ to find the next instance, and do the same thing to it. Keep doing this, until a box comes up saying ‘string not found’.
Now scroll back up to the top of the file. Open the ‘Find’ box again, and now change the search term from ‘23ab’ to ‘lka’. Now, replace all the instances of ‘lka’ with ‘lz1’. When this is done, save the file, and close the HEX Editor.
Now, rename the file to ‘m65aa_01a.mdl’. Also rename the .mdx file to ‘m65aa_01a.mdx’.
You have now created a completely new module, complete with textures, lightmaps, walkmesh etc.
Now all you have to do is implement it.
VI. Module File Editing.
Now, open the folder named ‘Module’, and open the file named ‘m23ab.are’ with your GFF Editor or K-GFF.
Scroll down until you find a CExoLocString marked ‘Name’. Set the STRREF to -1 and the Language to whichever language this mod is for (0 is English, and I believe that the others are listed in Darth333’s Recruitable Character tutorial). Type in a name – say, for example ‘Sith Military Hut’. This is what will show up above the map in-game, if you choose to create one.
Next, scroll down to ‘Rooms’, and open the sub-tab. Change the CExoString marked ‘Name’ from m23ab_01a to m65aa_01a. Finally change the ‘Tag’ entry to ‘m65aa’ without the quotes.
Now save and close the .are file, and rename it to m65aa.are .
Next, open the file named ‘module.ifo’. Find the List marked Mod_Area_List, and opening the struct within, change the Area_Name CResRef to m65aa. Find the CResRef called Mod_Entry_Area, and change its value to m65aa.
Now find the CExoLocString marked ‘Mod_Name’ and change the value in this to ‘m65aa’. Now save and close the file. Do NOT rename it.
Now, rename m23ab.git and m23ab.pth to m65aa.git and m65aa.pth respectively.
Now, open ErfEdit, and go to File-->New. Save the file as ‘m65aa’, and ensure the file type you have chosen is .mod .
Click the button with an open folder and a text file coming out of it, and select to open resources from the ‘New Module Project\Module’ folder. Select *all* the files inside, and click ‘Open’. Now, go to File-->Save. Now close ErfEdit.
Finally, copy m65aa.mod to your SWKotOR\modules\ folder, and take the files from the New Module Project folder (but NOT the ‘Module’ folder), and put them in your SWKotOR\Override\ folder. Now load the game, and type ‘warp m65aa’ into the console without quotes, and hit enter. This should take you to your new module.
So there you have it – you have now created your very own custom module file! Congratulations, and good luck :)