Adding New Character Classes to JA Singleplayer

Introduction

Getting a custom model into Jedi Academy (JA) is great and all, but many people want to take it one step further and have their model of choice available as a character option. Hopefully you have read Replacing Jaden Korr in Jedi Academy, and with any luck I haven't scared you off yet :) If you don't already know how to get custom models and skins into JA, Tutorial 1 is probably worth at least skimming through, and I recommend that you get your model extracted and set up as described there. It will make this tutorial less confusing (I hope), and I will be assuming that you have gone through those steps.

As the title indicates, this tutorial will walk you through how to take a custom model (either from JA itself or a custom one) and add it to the available options for the characters customization. Once you have the custom model usable in JA (as explained in Part 1), then it is now ready to be added to the character customization process. But first, there are a few things we will need before we start:

WinZip: This will enable us to open, alter, and create .pk3 files (same as a .zip file).
Wordpad: Any text editor will do, really. I use Wordpad instead of Notepad for this because some of the files we will be editing might be too big for Notepad to open.
Graphics Software: You'll need something to create icons for the character options. I like Paintshop Pro, but Photoshop is just as good, or anything equivalent.
ModView (optional): This is the model viewing tool released by Raven to view all the models in Jedi Academy.

Once you have these things, we have everything we need. But before we get started, let me come right out and say that I by no means know all the ins and outs of this stuff, and there are still things I'm not sure how to do fully, most noticeably how to get the colour selections to work properly. Hopefully that won't upset you too much, and you won't throw up your hands just yet. Once again I will be using a Mace Windu model as a running example.

Part 1: Extracting the Model

Extract the model you want to use as described in Replacing Jaden Korr in Jedi Academy, step 1. In a nutshell, create a directory (e.g. "mod") and extract your model into that directory, making sure that all the paths are set up correctly for it. If you are using a JO model, edit the model_default.skin to turn any required surfaces on or off. See, didn't I tell you to read the first tutorial? :) Once the model is extracted and in a usable JA form, we can now begin the process of adding it to the character customization screen.

Part 2: Creating Head, Torso, and Lower Skins

In the character customization screen, players are able to select from different heads, torsos, and lower bodies. To add such options for our model, we need to specify what textures apply to what options. So we will take what is in the model_default.skin file and divide it up into head, torso, and lower skins.

Step 1:
Open up the model_default.skin file in your text editor. Note that the majority of entries indicate whether they are a part of the head, torso, or legs or hips. For the Mace model, the model_default.skin file looks like:

head,models/players/qui-zan/head.tga
head_ears,models/players/qui-zan/head.tga

torso,models/players/qui-zan/torso.jpg
r_arm,models/players/qui-zan/torso.jpg
l_arm,models/players/qui-zan/torso.jpg
r_hand,models/players/qui-zan/hands.jpg
l_hand,models/players/qui-zan/hands.jpg
l_leg,models/players/qui-zan/legs.jpg
r_leg,models/players/qui-zan/legs.jpg
hips,models/players/qui-zan/hips.jpg
hips_belt,models/players/qui-zan/hips_belt.jpg
head_eyes_mouth,models/players/qui-zan/mouth.tga
torso_cap_head_off,models/players/stormtrooper/caps.jpg
head_cap_torso_off,models/players/stormtrooper/caps.jpg
torso_cap_hips_off,models/players/stormtrooper/caps.jpg
hips_cap_torso_off,models/players/stormtrooper/caps.jpg
r_leg_cap_hips_off,models/players/stormtrooper/caps.jpg
l_leg_cap_hips_off,models/players/stormtrooper/caps.jpg
r_hand_cap_r_arm_off,models/players/stormtrooper/caps.jpg
l_hand_cap_l_arm_off,models/players/stormtrooper/caps.jpg
r_arm_cap_torso_off,models/players/stormtrooper/caps.jpg
torso_cap_r_arm_off,models/players/stormtrooper/caps.jpg
l_arm_cap_torso_off,models/players/stormtrooper/caps.jpg
torso_cap_l_arm_off,models/players/stormtrooper/caps.jpg
hips_cap_l_leg_off,models/players/stormtrooper/caps.jpg
hips_cap_r_leg_off,models/players/stormtrooper/caps.jpg
robe,*off
torso_robe,*off

Step 2:
We are going to need different skin files for each of our options. To begin with, let’s just worry about taking the basic skin and turning that into one set of options for the model. After that, it will be easy to add other options in the same manner. To start, create three text files, head_a1.skin, torso_a1.skin, lower_a1.skin. Note: To my knowledge, the names need to include the words “head, “torso” and “lower” respectively for them to be recognized by the game as options relating to those parts. I haven’t played around with this to be sure, but for now I suggest you just follow the naming convention above.

Step 3:
Now we need to put the information from the .surf file into the the .skin file. Open up the .skin file in Notepad. You will see a bunch of lines in the form “entry,path”. For Mace, we have:

head,models/players/samuel_l/head.tga
head_ears,models/players/samuel_l/head.tga
torso,models/players/samuel_l/torso.jpg
r_arm,models/players/samuel_l/torso.jpg
l_arm,models/players/samuel_l/torso.jpg
r_hand,models/players/samuel_l/hands.jpg
l_hand,models/players/samuel_l/hands.jpg
l_leg,models/players/samuel_l/legs.jpg
r_leg,models/players/samuel_l/legs.jpg
hips,models/players/samuel_l/hips.jpg
hips_belt,models/players/samuel_l/hips_belt.jpg
head_eyes_mouth,models/players/samuel_l/mouth.tga
torso_cap_head_off,models/players/stormtrooper/caps.jpg
head_cap_torso_off,models/players/stormtrooper/caps.jpg
torso_cap_hips_off,models/players/stormtrooper/caps.jpg
hips_cap_torso_off,models/players/stormtrooper/caps.jpg
r_leg_cap_hips_off,models/players/stormtrooper/caps.jpg
l_leg_cap_hips_off,models/players/stormtrooper/caps.jpg
r_hand_cap_r_arm_off,models/players/stormtrooper/caps.jpg
l_hand_cap_l_arm_off,models/players/stormtrooper/caps.jpg
r_arm_cap_torso_off,models/players/stormtrooper/caps.jpg
torso_cap_r_arm_off,models/players/stormtrooper/caps.jpg
l_arm_cap_torso_off,models/players/stormtrooper/caps.jpg
torso_cap_l_arm_off,models/players/stormtrooper/caps.jpg
hips_cap_l_leg_off,models/players/stormtrooper/caps.jpg
hips_cap_r_leg_off,models/players/stormtrooper/caps.jpg

As you can see, there are no entries for the robe and torso_robe mentioned in the .surf file, so we have to add them, and indicate that we want these surfaces off. To do this, we add the following lines to the .skin file:

robe,*off
torso_robe,*off

Save the file. Now everything that JA needs to know about the model is the in the .skin file.

Step 4:
Now we have one set of options for out models. To create more options, simply take the model_whatever.skin file and break it up in the same manner. This time you could call your option files something like head_b1.skin, torso_b1.skin, and lower_b1.skin. Suppose that you wanted more options, perhaps to be able to select the red and blue skins for the model. Simply divide up the model_red.skin and model_blue.skin files in the same manner and stick them into the appropriate head, torso, and lower files. Wash and repeat for all the options you want.

Part 3: Creating Icons for Character Options

Options are great and all, but they wouldn’t be much good if you didn’t know what you were selecting in the character selection menu. So we need some icons to indicate what each option is. This can be as simple or as tricky as you want to make it.

Unfortunately, I haven’t worked out how everything for how to add the colour selection for the skin trims and things of that sort. It does take a little bit of work, and involves transparencies and ugly things like that. For those of you who are feeling really adventurous, you can have a look at a great little tutorial at Lucasforums which covers this. Perhaps that might help you a bit.

In the mean time, I will show you have to add normal icons that don’t use the colour selection mechanism.

Step 1:
Open up your graphics program and create a blank image that is 128x128 pixels. This is the required size for the selection icons. Basically, you put whatever you want to use to represent each option in the icon file. What I tend to do is load the model and skin in ModView and take a screenshot and then take the part you want and put it in the icon image. You could just as easily do this with screenshots from the game or something like that. In any event, add whatever image you want to the icon image.

Step 2:
Now we will save the icon file. I suggest you save it in .jpg format (though that probably doesn’t matter) with the following naming convention:

icon_[your head, tosro, or lower.skin filename].jpg

e.g icon_head_a1.jpg
icon_torso_a1.jpg
icon_lower_a1.jpg

Do the same for all your other options so that you have icons for each.

Part 4: Indicating Model is a Character Selection

So now that we have skin file and icons for all of our options. Now we need to indicate that this model is supposed to be used for the character selection process. To do this, we need a playerchoice.txt file in the model directory.

Step 1:
Open up the assets1.pk3 file in your GameData/base directory and find the playerchoice.txt file in the models/players/jedi_hm directory. Extract that into your models/players/ directory. Step 2:
This file does two things, it specifies that this model is a player choice, and also the available colours options. Since I haven’t taught you how to have colour variable icons, I suggest you get rid of the colour options. If you have done the work to have variable colour icons, or you don’t care, you can leave the colour options specified in this file alone. The format of the file looks like this:

//colorshadername {action block}

*white
{
setcvar ui_char_color_red 255
setcvar ui_char_color_green 255
setcvar ui_char_color_blue 255
}

gfx/menus/players/jedi_hm/tintchoice_hm_yellow1
{
setcvar ui_char_color_red 252
setcvar ui_char_color_green 243
setcvar ui_char_color_blue 180
}

gfx/menus/players/jedi_hm/tintchoice_hm_blue1
{
setcvar ui_char_color_red 69
setcvar ui_char_color_green 109
setcvar ui_char_color_blue 255
}

other colours…


To get rid of the colour options, we will delete the colour definition entries, so we end up with a file that looks like:

//colorshadername {action block}

*white
{
setcvar ui_char_color_red 255
setcvar ui_char_color_green 255
setcvar ui_char_color_blue 255
}


Save the file. Now the model is ready to be used as a player choice in the character customization menu.

Part 5: Giving a Name to the New Character Class

Next we need to give our character class a name. Because of the way JA is set up, this can be a little tricky, so I suggest that you set things up to make sure that you don’t run into problems. The issue is that all the strings (text and things of that sort) are all defined in the MENU.str files. There is one of these files for each language option. You only need to worry about adding the character class name for the language you use, but you can do them all for completeness if you like. If you have a couple of mods that have their own MENU.str file, only the last one loaded will be used in the game. So I suggest that you do the following steps:

Step 1:
Open up assets0.pk3 in the GameData/base directory and Extract the MENU.str into another directory, for example menu. Make sure the path information is included when you do, so that the file ends up in the menu/strings/English directory.

Step 2:
Open this up the MENU.str file and you will see entries for all of the available character classes, which will be in the form:

REFERENCE [ directory] (e.g. JEDI_HF for the models/players/jedi_hf directory)
NOTES "For character menu"
LANG_ENGLISH "[What the character class is called]"


So just above the JEDI_HF entry, add the information for your class. Since my Mace model has a directory of models/player/samuel_l the entry might look like:

VERSION "1"
CONFIG "W:\bin\stringed.cfg"
FILENOTES ""

REFERENCE SAMUEL_L
NOTES "For character menu"
LANG_ENGLISH "Mace Windu"


REFERENCE JEDI_HF
NOTES "For character menu"
LANG_ENGLISH "Human Female"


Save the file. Now the game knows what to call the new class.

Part 6: Packaging the Model for Use in JA

Now that we have edited what we want, we need to gather everything together. Just like I explained in the last tutorial, the easiest way is to create a zip file and then just change the extention to .pk3. So to do that:

Step 1:
Start up WinZip and go to our mod directory. Under "Folders" click Recursive Folders. This includes the directory information the game will need.

Step 2:
Then select "models" (without going into that directory), and click Add with Wildcards. This will put all the necessary files into the .zip file. To confirm, make sure the model and texture files are there, with models/players/ listed under “path”. Also make sure that the .npc file is there with ext_data/npcs/ as the path.

Step 3:
Finally, change the extention of our .zip file to .pk3. This can be done by manually renaming the file.

Step 4:
Move this .pk3 file into the GameData/base directory. The game loads every file with a .pk3 extention in alphabetical order. So make sure the name of your .pk3 comes after assets3.pk3. For example, mace.pk3.

Step 5:
You may have noticed that we have only packages up the model itself, and not the MENU.str file which contains the name of our class. The reason why I had you put this file in a directory other than mods is because I suggest you make a separate .pk3 for this file. Repeat steps 1-4 for this file. From now on, whenever you have another mod which alters this file, (such as different class and additional saber hilts), put their changes in this file as well, so that they will all be loaded correctly, instead of some changes overwriting others.

Everything is now set where it should be. Now try it out in the game!

Closing

Well I hope this tutorial has helped add a new character class to JA. You should be able to now add any character classes with whatever options you want. In the next tutorial, I will walk you through How to Add Lightsaber Hilts to Singleplayer. Hopefully I have confused you too much so far.

Feel free to send comments, and thanks for reading.

Acknowledgements

A big shout out to everyone who has helped me learn how to edit Jedi Outcast and Jedi Academy over at Lucasforums. You guys have helped me solve many annoying problems, and I really appreciate all your hard work. A lot of my knowledge comes from those great people.