CCG V3-1 Conversion:Part 8 Custom Races
From NWN1 Custom Content Guide
Contents |
Custom Races
First let me define what I mean by a custom race: a custom race refers to a creature that you can play as a PC or use as an NPC. Custom races were not really possible until recently. To be more specific: you could create unique Non-Player Characters but not real custom races for Player Characters.
For example, it has always been possible to create a custom monster model and use that model in a module as an NPC. The problem occurs when you try to use that model for a PC. The issue is that many of the features of the game engine’s character creation screens are hard-coded and not accessible to the end user. Some people have worked around this problem by using the SetAppearance() command from the counsole but this is kludgy at best.
Halfelf and CODI have now released the NWN Character Creator (CC) (http://nwvault.ign.com/Files/other/data/1050041596353.shtml), a program that solves this problem. This is a terrific utility that essentially duplicates the functions of NWN character creator but it is fully driven by .2da files and features are not hard-coded. This allows you to add your own races with their own special feats and abilities and their own model files.
|
Part 1: Custom Race Resource Files
I won’t talk about how to use the Character Creator any more than I discuss how to use the Aurora Toolset – you can find those details in the CC documentation that Papermonk has written. But I will talk about the files you need to make it work.
You can create custom races in several ways:
- Races that use existing models (like a Drow elf using the standard elf model),
- Races that use entirely new models (like a Wemic).
Start by defining your race in appearance.2da if it isn’t already there. All of the rules I discussed for creatures in the previous section still apply. In our example, we are going to set up the giant crab as a playable PC. I mean, c’mon, everybody has dreamed of playing as a giant crab, haven’t they?
Racialtypes
Next we set up the racialtypes.2da file to properly define our new race.
| Column | Description | Values |
| The first column is the set ID | This must be sequential; CC gets upset if you skip numbers. | |
| LABEL | The label for the creature. | Typically set to the creature’s name. |
| Abrev | This is a 2 letter abbreviation of the name. It should be unique. | |
| Name | This refers to the proper name of the creature (start with an uppercase letter). In our case Crab. | This is a dialog.tlk reference number. |
| ConverName | This is the conversation-name; how would you refer to the race if something was made by them? Turn the name into an adjective. This would be Dwarven if it was a dwarf. But in the case of our crab, it remains Crab (Crabbbish? Crabby? Crabben? Crabilish?). It starts with an uppercase letter. | This is a dialog.tlk reference number. |
| ConverNameLower | This is an entirely lowercase version of the previous. | This is a dialog.tlk reference number. |
| NamePlural | What do you call a group of your creatures? In this case, Crabs. It starts with an uppercase letter. | This is a dialog.tlk reference number. |
| Description | This is a description for the race. It should describe what the race is like, its feats and abilities. | This is a dialog.tlk reference number. |
| Appearance | This refers to the line of their appearance resource entry in appearance.2da. This can refer to an existing model or to a new one. | |
StrAdjust DexAdjust IntAdjust ChaAdjust WisAdjust ConAdjust | These lines all define the statistic modifications. | These can be positive, negative or zero for no adjustment. |
| Endurance | Racial endurance value. | Medium critters get a base of 30, small (e.g. Halflings) have 20. |
| Favored | This is the favored class. I think most crabs are closet monks. | This is an index into the classes.2da resource file. |
| Feats Table | This refers to the feats table for the race. | You need to create a custom feats table. The naming standard should be RACE_FEAT_<a short abbreviation for your race of 4-6 characters>. For example, RACE_FEAT_WEMIC. |
| Biography | This is a short blurb about why the character left home to be an adventurer, etc. | This is a dialog.tlk reference number. |
| PlayerRace | Is this a player (PC) race. |
0 for no 1 for yes |
| Constant | This refers to the constant used in the nwscript.nss file. | Format is typically RACIAL_TYPE_<short abbreviation of your race> |
| Age | This is the starting age for the character. | In years. |
| ToolsetDefaultClass | This is the default class when you hit Recommended for a character’s class. | Interestingly in the default racialtypes.2da, Bioware has set all the races to fighter (value 4). In CODI’s version (the one that comes with CODI’s pcpack.hak, they make this the same as the Favored Class). |
Dialog.tlk
Now that you have set up racialtypes.2da, go and create the corresponding entries in dialog.tlk using a tlk editor. Yes, I know. Nasty business, that.
Racial Feats
The next table you may need to set up is to specify any racial feats your character may have. You can either re-use an existing table (for example, most elven sub-races have the same feats as a standard elf) or create a new one. This is the Drow racial feats table:
FeatLabel FeatIndex 0 immunitysleep 235 1 hardinessenchantment 236 2 skillaffinitylisten 237 3 skillaffinitysearch 238 4 skillaffinityspot 239 5 keensense 240 6 darkvision 228
The one difference between the Drow and the standard elven races is that the Drow has darkvision in place of low light vision. This is a new 2da file that you must create if you can’t re-use an existing one. The naming standard for these tables comes from the racialtypes.2da file, the Feats Table column. There are three columns:
| Column | Description | Values |
| The first column is the set ID | This must be sequential; CC gets upset if you skip numbers. | |
| FeatLabel | The label for the feat. | Typically set to the feat label from feats.2da although sometimes it is different. It does not seem to matter. |
| FeatIndex | The ID of the feat. | From feats.2da. |
To create this table, map the feats of your new race to the ones available in feats.2da. In some cases the corresponding feat will not exist because it has not been implemented in the game engine and you will have to do without. In other cases you may need to compromise and find a similar feat.
Racial Special Abilities
The last table represents special racial abilities. This allows your Drow to actually cast darkness or your half-dragon to use a dragon’s breath weapon. Again, it is a new 2da file. The naming standard for this file is the same as the racial feats file with spec in place of feat: race_spec_<short name for race>.2da. Again, here is the Drow:
SpecLabel SpellNumber SpellFlags SpellLevel 0 Darkness 36 1 3 1 FaerieFire 415 1 1
There are five columns:
| Column | Description | Values |
| The first column is the set ID | This must be sequential; CC gets upset if you skip numbers. | |
| SpecLabel | The label for the special ability. | Typically set to the spell label from spells.2da. |
| SpellNumber | The ID of the spell. | From spells.2da. |
| SpellFlags | If true, the spell is automatically enabled for the character on spawn. If set to false, the character must rest first. |
0 for false 1 for true |
| SpellLevel | Effective level at which the spell is cast. | Must be 0 for creature abilities. Otherwise set it to the caster level at which you want the spell to be cast. |
To have a special ability that can be used multiple times before rest, add multiple entries to this table. To create this table, map the special abilities of your new race to the ones available in spells.2da. In some cases the corresponding spell will not exist because it has not been implemented in the game engine and you will have to do without (or create it using the techniques in this tutorial). In other cases you may need to compromise and find a similar spell.
Effective Character Level (ECL)
Refer to the Character Creator documentation for other information on specializing your race including setting ECL, custom skins, etc.
Part 2: The Dynamic Character Model
Now that we have defined our crab as a custom race, let’s talk briefly about a special kind of model: dynamic character models. A dynamic model is one where you can drop new armor, helmets, and other items into the correct slots of a character’s inventory and (s)he will automatically don them. Contrast this to a ‘static’ creature, like our crab, that cannot wear armour at all. The crab’s appearance does not change in the game. Suppose I want to create a dynamic creature – like a Wemic. Not everybody is happy playing as a crab (personally I don’t know why not!) What is different about a dynamic model? Let’s start with an experiment. Create an elven NPC using the Aurora toolset. Edit her properties and open her inventory. Now change her armor by assigning a new set of clothes into the armor slot. Close the inventory screen and notice her appearance has changed. Now create an NPC using the Aribeth model in the Aurora toolset. Change her armor on the NPC inventory screen. Notice that this time the armor does not change in her appearance.
Why do they behave differently? Let’s open the model files directly and you will see why. Extract aribeth.mdl using NWN Explorer. Open it up and take a look. Aribeth is a creature like any other creature (our crab, a demon, etc.). Some of the NPCs are created as static models (including Aribeth and Sethos) while others use the PC model base. So what is special about the PC model base? Extract pmh0.mdl using NWN Explorer. Open it up and take a look. It consists of a series of dummy nodes, one for each armor piece (head, neck, torso, left bicep, right bicep, etc.). There is no geometry in this file!
|
In the Creatures section we talked about creatures as a hierarchy of linked objects that are animated to build our final model. That is how Aribeth was built. However, in the section on armor, we talked about PC’s as individual parts (remember pmh0_chest001, etc.?). How do PC models work when you contrast all of these individual parts with the single, linked model that makes up a creature? The answer is that they are one and the same. When NWN is building your character it takes the nodes in the PC model file and substitutes in the armor parts (corresponding to the type of armor you are wearing). The nodes tell NWN where to put each part by aligning the pivot point of your armor part with the origin of the corresponding node. The nodes are linked into a hierarchy just like the objects in a normal creature model.
|
Think of these PC models as roadmaps that tell NWN how to tie all of the PC model parts together into a single creature - a template for where each piece must go. That template has the name (oh-oh, here we go with naming standards again) pxy0.mdl where
x = m (male) or f (female),
y is the abbreviation for the race (e.g., h for human), and
0 represents the phenotype (standard). You don’t need to create a 2 version (large phenotype) because the game uses the same template for standard and large.
More than just nodes
Now for the fun part: you actually can put geometry in this file. I created a Wemic as a PC model by deleting the lower leg nodes (pelvis, thighs, shins and feet) and then substituting into the template the actual geometry for a lion’s body (minus the lion’s neck and head) and then linking all of the parts together. When you change the Wemic’s armor it only changes the appearance of the upper body (the part where I left the nodes in place). In fact, the Aurora toolset is smart enough to realize that there are no leg nodes so it does not even give you the option of changing these.
In the case of the Wemic, this is a little tricky: the Wemic uses a skinmesh and skinmesh models are special when it comes to working in the game. The key is that the skinmesh bones must appear in your model’s hierarchy before any PC nodes – refer to the notes about skinmesh models in the previous section for more on this. Also, it does not seem to be possible to use a skinmesh as a dynamic part – by definition a dynamic part is one of the PC nodes so your skinmesh cannot satisfy that condition. In any case, the outcome when you break this rule is clear: the skin becomes distorted and pulled around an inappropriate node in the model when viewed in-game. You will know it when you see it.
Bringing it all together
Here is the process for building a dynamic model (a Wemic):
- Create the model
- In this example, start with the basic Lion model (cat_lion.mdl) and the individual parts for a static human NPC model (in other words, create a static model – either from scratch or from existing models). Follow all the instructions in the Creatures tutorial to develop the model, animations and textures on this base.
- Make the model dynamic
- Next make the model dynamic by swapping in the PC half-orc nodes for the model’s upper body. This may seem counter-intuitive: the human and half-orc models are interchangeable? They are! The biggest difference is that the the proportions are slightly off but remember from the Creatures section that most of the animation keys are rotations so the proportions of the model don’t count. The one exception to this is rootdummy which includes translations. However, as long as the lion’s lower body does not change, the rootdummy translations continue to work fine. I switched to a half-orc because the Wemic’s lower body looked too big for the human. Save the PC model as pmw0.mdl.
- Create the armor components
- Now you have a dynamic model but no armor parts to swap in and out for it. What to do? Copy the half-orc armor parts. There are hundreds of them. I copied them and used the NWN Tileset renaming utility but now you can use NWNArmory to rename them internally and externally from pfo0_<partname>.mdl and pmo0_<partname>.mdl to pfw0_<partname>.mdl and pmw0_<partname>.mdl. Normally you would make these for the large phenotype as well. I chose not to do this though because the large phenotype looked really wacked on the Wemic body.
- You must create armor parts corresponding to each of the standard models – if you don’t and somebody drops unsupported armor into the inventory of your new character, your character’s body parts will disappear.
- Make the female version
- When you have the male working, create a female version of the base PC model. In the case of the Wemic, the primary difference is that the female’s nodes are closer together, the lower body is smaller and of course it has a different tail. I used the female half-orc PC model as a starting point for this again because it has all the nodes in the right place.
That is all that you have to do. You do not need new textures for each armor part (I only used one new texture and that is for the lower body) because all of the armor pieces use the human, standard phenotype PLTs as discussed in the section on armor.
A couple of final notes:
- If you are creating a dynamic character model, you need to set “NAME” to “Custom_model” and “RACE” to the single digit character of the race in your PC model name as it is set up in appearance.2da (e.g., ‘h’ for human, ‘w’ for the Wemic).
- If your model does not match the dimensions of one of the existing characters, you will need to create entirely new models for the hundreds of armor parts. In some cases you can do this by scaling existing armour parts (say, lengthening the elf model parts along the z-axis to make a githerzai). I’ve developed a scaling utility (NWNArmory) that automates much of this process.
If your model does not match an existing race at all (say a PC spider with customizable armor), you will need to match the node names to the standard PC names as best you can (it is okay to leave some out) and then provide custom armor parts for each of the standard armor pieces. A tremendous amount of work. The good news is that many of the current armor parts are not unique – they are based on a common set of models with new PLTs. So instead of having to do 1,000 new pieces, you may get away with only 200 new pieces (what, doesn’t having to do only 200 new models make you feel better?). Or something along those lines.
NWNArmory
In the section of this tutorial on armor I talked about my new tool, NWNArmory. This tool can be used to take an armor piece for one race and create all of the other racial versions. Even better if you want to create a PC race, it can take all of the standard Bioware models and create the pieces you need for a new race.
Let's say you want to create a brand new race. Maybe it will be slightly taller and skinnier than an elf (a githerzai, say). There are hundreds of model pieces out there if you want your new race to be able to wear all available types of armor. But you can tell NWN Armory how your new race differs from one of the standard races (say an elf) and it will transform those hundreds of pieces for you. How do you make it work?
- First, you need to decide how your new race will differ from an existing race. In the case of the githerzai, extract all of the standard elf parts. Now choose the unclothed parts (the ‘001’ models). Using your modeling tool, decide how much to stretch these parts across the x, y and z axes to create your githerzai’s dimensions. Write those transforms down.
- Now create a transform initialization (.ini) file and copy this into NWNArmory.ini. The .ini file consists of a series of transform groups. Each group consists of a match string (you tell NWN Armory which models this group applies to), a substitute string (you tell NWN Armory how to rename the model based on the original name), and the definition of the transform for that group. In the transform you essentially tell NWN Armory how to scale the original model (x, y and z-axis scaling factors) and how to rotate it (about the x, y, and z-axis respectively). Refer to the help file of NWNArmory for details on how to do this.
- Then you fire up NWN Armory and tell it to use all of the elf part models as base models (you may want to do this in several passes because there are lots of them).
- Tell NWN Armory where to put the transformed models.
- Go. What this program will do is compare each input file against the list of transform groups you gave it. Where there is a match, it will rename the model and apply the transforms you specify, and save the resulting model in the output directory.
« Creatures | Custom Races | Visual Effects »
