CCG V3-1 Conversion:Part 2 Portraits
From NWN1 Custom Content Guide
Contents |
Character Portraits
|
This section covers the subject of portrait conversion and how you add portraits for a Player Character (PC) and a Non-Player Character (NPC) into NWN. Some of this material (at least the basics on PC Portraits) can be found on Bioware’s site (http://nwn.bioware.com/builders/portraits.html).
Part 1: Understanding How NWN Represents Portraits
Start with the best resolution portrait you have. You will need to make several versions of this image in different sizes. An image retains much better detail when scaling down than you can get when trying to enlarge an image.
You are going to have to make some changes to your base image to make sure that it meets the standards for NWN. It will have to be converted to an uncompressed, 24-bit, Targa Bitmap (TGA) file if it is not already in that format. Also, you will need images of the correct sizes.
There are a total of 5 different portrait sizes.
| Size | Suffix | Required Image Dimensions(width x height) | Used Image Dimensions (width x height) | Displayed on... |
| Huge | _h | 256X512 pixel | 256X400 pixel | During character creation on the selection screen |
| Large | _l | 128X256 pixel | 128X200 pixel | Character sheet |
| Medium | _m | 64X128 pixel | 64X100 pixel | Your portrait on the main screen |
| Small | _s | 32X64 pixel | 32X50 pixel | Other party members on main game screen |
| Tiny | _t | 16X32 pixel | 16X25 pixel | Pop-up dialogue screen |
|
Part 2: Creating Your Portrait Files
Even though the game will only use 256X400 pixels instead of the full 256X512 (it simply ignores the remaining 112 height pixels), it is still important that you adhere to these 5 portrait sizes. It is important to know that the game uses 256X400 pixels when you are cropping a portrait or picture.
I will use Micrografx Picture Publisher to resize my portrait. There are lots of freeware and shareware image manipulation programs available (see the listing at the beginning of this document).
Here is the starting image (actually, this is a jpeg compressed image to conserve space in this tutorial – I’ll do that with all the photos I show here).
Now, this image is too large (it is 400X492) for any of the portraits. We are going to resize it. It is also not in the right aspect ratio (400X492 is not proportional to 256X400, for example). We cannot fix this by resizing. We must crop as well. If we simply resize the picture to 256X400 in one step, it will be distorted. Not pretty. People’s faces get stretched or compressed and the resulting portrait looks very awkward.
|
We start by resizing and then cropping again (to get the dimensions right). We will do this once for each image size, starting with the largest. There are many ways to do this – you won’t use the entire image and you can be creative about which pieces you keep. How much do I resize by? I want to keep as much of the face in this photo as possible because it is already cropped so tightly. So I will resize the image to get the height to 400 pixels for the huge image (not 512 pixels – that is the final file size) while keeping the aspect ratio constant so there are no size distortions. In Micrografx Picture Publisher I use Image | Size to do this and make sure that Allow Size Distortion is not checked.
Why did I choose the height and not resize to get the width to 256 pixels first? If I resized to the width first with no size distortions, my picture would only be 315 pixels high. This would be too short for NWN. However, depending on the original dimensions of your portrait, you may need to do the width first.
After I resized the height, I crop the width down to 256 pixels, giving me an even tighter crop on the face. Now I add the extra 112 pixels to the bottom of the file. It does not matter what color this extra data is. In Micrografx Picture Publisher I use Image | Expand to do this. I did not use Image | Size like I did before because that will stretch the whole image.
|
Save the file with the _h.tga suffix. And then do it again for each of the different sizes (if you want to use these as NPC portraits, you might want to read the next section about more detailed naming standards first, to save yourself trouble going back and doing it later).
Be creative. The smaller images do not need to show the entire portrait. You might choose to crop differently as you move to the smaller image sizes, having a fuller figure portrait or head-and-chest shot for the larger sizes but cropping down to a tight image of the face for the smaller pictures. I would do this so you retain some detail in the smaller photos instead of cutting them down to nothing more than an unrecognizable, tiny stick figure. I don’t show that technique here because my image is such a close crop on the face already.
Part 3: Using Your Portrait for a PC
Now that you have created your portraits, if you want to use them for a PC, just drop them into your /portraits subfolder of your NWN game directory. Note: for other people in a multiplayer game to see your character as you see it, they will also need a copy of your portrait files. Zip them up and mail them off to the other players. I would suggest using at least some of the naming standards that are applicable for an NPC below.
Part 4: Using Your Portrait for a NPC
It is a little more complicated to use the new portraits for an NPC. You need to set them up as resources available to your game. To do that, you need to follow certain naming standards. You must declare your portraits as available resources to the game. You do that in a 2da file just like we did for our trident in the previous tutorial. Then it is time to go back to the hakpak editor to bring all of the pieces together.
|
A Rose by Any Other Name
…would not work for NPC Portraits either.
You need to change your portrait filenames to meet the NWN standard. This is necessary because there are strict requirements in the portraits.2da file for NPC portraits.
If you extract a portrait from one of the data files in your NWN folder, you will see the NWN naming system. You should take advantage of this system, although some variation is allowed. The following is a description of this system.
The default or generic human male portrait in NWN is named po_hu_m_99_X.tga. The components stand for:
| po_ | Portrait |
| hu_ | Human |
| m_ | male (_f for female) |
| 99_ | Id number |
| X | Image size identifier(h, l, m, s, or t) |
You must keep at least two of these abbreviations: namely po_ and X. Say you have a portrait called halfelf.tga and it was divided into the 5 different Bioware standard portrait sizes in the previous step:
JemyM |
1. Halfelfmale_h.tga 2. Halfelfmale_l.tga 3. Halfelfmale_m.tga 4. Halfelfmale_s.tga, and 5. Halfelfmale_t.tga.
They could be named like this:
1. po_ha_m_37_h.tga 2. po_ha_m_37_l.tga 3. po_ha_m_37_m.tga 4. po_ha_m_37_s.tga 5. po_ha_m_37_t.tga
The Portraits Resource File
The resource file is where we indicate to NWN that our new portraits exist. Like we discussed in the weapon tutorial, I would suggest you open up NWN Explorer and select the 2da.bif file - but don’t do it. Use the portraits.2da file in your \source\2dasource.zip (remember that note earlier about Bioware patches?). Go ahead and take a look at it. You should see this:
2DA V2.0
BaseResRef Sex Race InanimateType Plot LowGore
0 **** 4 **** **** **** ****
1 dw_f_01_ 1 0 **** 0 ****
2 dw_f_02_ 1 0 **** 0 ****
3 dw_f_03_ 1 0 **** 0 ****
4 dw_f_04_ 1 0 **** 0 ****
These different entries are the resources available to the game as portraits. Every resource has several columns attached to it. Check below to find out what the different columns represent:
| Column | Description | Values |
| An integer ID# identifying the portrait internally. | When choosing an ID for a .2da file, use one of the User999 rows. | |
| BaseResRef | Refers to the base resource for the model that this portrait represents. | Refer to Appearance.2da. They are used in the Aurora Toolset filter when adding a portrait file to an NPC. |
| Sex | Gender, actually. | The number comes from the first column in the 2da file gender.2da from the 2da.bif file (you can view the contents of this file using NWN Explorer as well).
0 Male 1 Female 2 Both 3 Other 4 None |
| Race | This number is used for the toolset filter when selecting a portrait for your NPC. | The number comes from the first column in the 2da file racialtypes.2da from the 2da.bif file (you can view the contents of this file using NWN Explorer).
0 Dwarf 1 Elf 2 Gnome 3 Halfling 4 Half-Elf 5 Half-Orc 6 Human Etc. **** if it is a placeable and not a creature |
| InanimateType | The type of placeable. | Refers to placeabletypes.2da
0 Battlefield 1 Containers 2 Military 3 Misc 4 Misc_Interior 5 Parks_Nature 6 Penants_Signs 7 Trades_Academic 8 Visual_Effects **** if it is a creature and not a placeable |
| Plot | Is this a plot portrait? Generally no. |
0 if no 1 if yes **** if it is really a placeable anyway (1 equates to TRUE if you know C or C++) |
| LowGore | The portrait to use in place of this one if the game is set to low gore mode. If you create a really messy portrait, find or create a substitute, low gore, portrait here. | Portrait name (generally **** for creatures). |
Your First NPC Resource
|
Begin editing the portraits.2da and adding a new resource, so your portrait can be recognized by the game.
I have created an elven female portrait with the file names ‘po_el_f_50_X.tga’, where X represents the size of the portrait.
Add the last line you see below, under the resource ID 571 (the first User999 space)
570 kobb_ 4 15 **** 0 **** 571 koba_ 4 15 **** 0 **** 572 el_f_50_ 1 1 **** 0 ****
|
As you can see I’ve omitted the po_ and the X (where X is the size of the portrait) in the resource entry. This is why, earlier, we told you that you had to start and end your portraits with that prefix and suffix. Also the extension .tga is not necessary either. The game already knows that the prefix it should use is po_, the suffix is h, l, m, s or t, and the extension required for all portraits is .tga.
So to conclude, you do not need to add po_ and _X (where X is the size of the portrait) to the resource entry.
Your New Portrait(s) and The Toolset
Now that you have created your portrait TGA files in the standard formats and edited the portraits.2da file, it is time to add them to a hakpak. Refer to the appendix for detailed instructions on using the hakpak editor.
Open the hakpak utility. Now that it is opened, choose Resource | Add. Now you add your modified portraits.2da file and your new portraits (with all its 5 sizes) to the hakpak. All the files should now be displayed in the hakpak window. If you’ve only added one portrait, there should be a total of 6 files in the hakpak now.
Add a title to your hakpak, and a description of the contents. Save the hakpak.
|
- Open up the Aurora Toolset. If it was still open from before, save and close the module and toolset then re-open the toolset.
- Create a new module or open an existing one.
- Select Edit | Module Properties…
- Click on the Advanced tab.
- From the drop-down for the Hak file, add your hakpak. If it does not appear in the drop-down, your hakpak is probably not in the /hak folder of your game directory.
- Save and close the module and then reload it.
- Select the Area you created.
- Create a new NPC using the Creature Wizard.
- Select Next.
- Select Elf and Next.
- Select a Class and Next.
- Select Female, and then press the Select Portrait button.
« Weapons | Character Portraits | Voice Sets »
