A little bit of tutorial

Hey guys, i've made a little tutorial as some people asked me how to do it.

Adding parts to an existing car mod

Step 1 : preparing your work

First you need to get both programs resdecode and resconvert.
If you want to import a part from another car, you need to be sure the scale is the same, if not you’ll need to mess with scx files and that’s not what I will be teaching here.
Ok let’s assume you made sure the part is the same scale.
You will need 3 kind of files for each part :

1 The mesh files : .scx and .tex (optional) files in /meshes folder
2 The script files cfg and java (which will be in the /scripts/src folder)
3 The textures files (not needed everytime)

So once you’ve found the files related to the parts you want to import, just copy and paste them in the destination folder (if asked to overwrite, just rename instead)
One last thing to do is convert rpk files of the concerned cars.
To use resdecode/resconvert open your console command.
Get to the folder where you put both exe files. You should have copied both rpk in the same folder to make things easier. Let’s name this folder d:/projects
So you have to type “resdecode Nissan_silvia_s15” (e.g.) then you’ll get a .rdb file which is openable with notepad.
We’ll name the second rpk/rdb Nissan_silvia_s15_2 for the exeample
Once you’ve decoded both rpk files you’re ready for next step.





Step 2 rpk work
Open both rdb files then open the first cfg you’ve copied.
In this cfg there are 4 important lines click, mesh, render and resource ID (texture is less important for minor parts.)

In the rdb file where te part comes from first search for the click reference (0x0000000c1 in our example)
Copy this group of lines
<FILE 00000049.res >
typeof 9
superid 0x00000001
typeid 0x000000C1
alias click
isparentcompatible 1.00
</FILE>
<FILE 00000049.rsd >
shape cars\racers\nissan_silvia_s15_data\meshes\FR_door.scx
</FILE>

All the lines are important don’t forget any of them.

Then paste it in the destination .rdb between other “click” parts don’t bother changing the file number it doesn’t matter.
Don’t forget to change folder’s link (shape cars\racers\nissan_silvia_s15_data) to the new car’s folder.


Then search the mesh lines (0x000000077) same as for click lines…


Then search for the render lines (0x00000076) be careful there are more lines than for click and mesh.

<FILE 00000625.res >
typeof 14
superid 0x00000005
typeid 0x00000076
alias FR
isparentcompatible 1.00
</FILE>
<FILE 00000625.rsd >
mesh 0x00000077
flags 8.000
lod_amp 3.000
shd_center 0.000 0.000 0.000
shd_diru 0.000 0.000 0.000
shd_dirv 0.000 0.000 0.000
shd_vbase 0.000 0.000 0.000
shd_vup 0.000 0.000 0.000
texture 0x00020025
texture 0x0000003b
</FILE>

Now you see you have another texture ID than 0x00020025 (which is paintable material)
You have to search the Silvia rdb for the texture line and see which file it links to. Copy this file to your destination folder. Copy the texture lines to the rdb too.
Now there are only script files left

<FILE 00000800.res >
typeof 8
superid 0x00000008
typeid 0x000000A6
alias FR
isparentcompatible 1.00
</FILE>
<FILE 00000800.rsd >
script cars\racers\nissan_silvia_s15_data\scripts\Silvia_S15_FR_door.class
native part cars\racers\nissan_silvia_s15_data\scripts\FR_door.cfg
lod_amp 3.000
</FILE>

Same as other lines : copy/paste.


After copying all those lines you’ll have to check if the ID’s aren’t already existing in the rdb.
So in the destination rdb, search for each typeID. If you find more than one instance, rename it placing a hex value before the other digits (typeID 0x00000AA6 instead of 0x000000A6 e.g.) (hex values are 0 to 9 or A to F)
Check the superID and rename it the same as the other parts from the same kind. That will assign the part’s category in catalog.

Exeample :

Superid 0x00000189
typeid 0x00004422
alias L
isparentcompatible 1.00
</FILE>
<FILE 00000438.rsd >
script cars\racers\Mazda_RX7_FD_data\scripts\Baiern_L_sideskirt_3.class
native part cars\racers\Mazda_RX7_FD_data\scripts\L_sideskirt_3.cfg
lod_amp 3.000
</FILE>

Browse many lines above until you see :

<FILE 00000428.res >
typeof 8
superid 0x0004F242
typeid 0x00000189
alias >Stock
isparentcompatible 1.00
</FILE>
<FILE 00000428.rsd >
lod_amp 3.000
</FILE>

This line is useful because it hides the parts in catalog when you’re building another car.
So superID 0x0004F242 is the basic catalog ID for stock body parts.
For this exeample car, the ID will be 0x00000189

Rebuild your rdb typing resconvert Nissan_silvia_s15_2 (e.g. remember?)
Now you’re ready for step 3

Step 3 script work

If you had to change typeID in the rdb file, don’t forget to change it in the cfg file too.
Now open the java file in the src folder. Rename it if needed for both lines

public class Silvia_S15_FR_door extends FrontDoor
{
public Silvia_S15_FR_door( int id )

It has to be the same as the file name. Change the description as you want and you’re done.






Take the cfg file for the part and the main cfg of the destination car.
You have to make sure the slot number is the same or else you won’t be able to attach your new part

slot 0.000 0.000 0.000 0.000 0.000 0.000 22 ; FR_door
attach 0x00000006 22 ; chassis->FR_door
Also check for the physics files

body 0.015 -0.041 0.000 0.000 0.000 0.000 30.000 cars\racers\nissan_silvia_s15_data\meshes\_phys_FR_door.scx ;0x0000001A

If not present, copy/paste it from the original car folder and rename the path.

Now that’s all, congratulations, you’ve added one more part.


If you encounter issues with textures on your newly added part, then you have to change the loading order.
Get back to the render entry in the .rpk/rdb. You certainly will have more than one texture line

Exeample :

<FILE 00000280.res >
typeof 14
superid 0x00000005
typeid 0x000005B8
alias F
isparentcompatible 1.00
</FILE>
<FILE 00000280.rsd >
mesh 0x000004B9
flags 8.000
lod_amp 3.000
shd_center 0.000 0.000 0.000
shd_diru 0.000 0.000 0.000
shd_dirv 0.000 0.000 0.000
shd_vbase 0.000 0.000 0.000
shd_vup 0.000 0.000 0.000
texture 0x00000000
texture 0x000000BD
texture 0x000000BA
</FILE>

Open the .tex file related to your mesh file, it will tell you the loading order of textures.
Simply change texture lines position and try again (rebuild rpk and so).
 
No comments yet