In this tutorial I am going to use the Blista Compact as example.
What are you going to learn today?
- Getting your vehicle sorted out so it can be put ingame;
- Putting carcols on your vehicle;
- Linking the dummy’s to the model so it can be exported correctly;
- Making a custom colission model;
- Putting the textures in the .txd;
- Editting the data lines.
First, I’ll list what programmes you need (click the links for download):
- 3dsMax or Gmax (same programmes, different costs);
- Kam’s scripts: 3dsMax version, Gmax version (all this nonsense that the scripts don’t work in 3dsMax 9 is bullsh*t, I work with 3dsMax 9 and use Kam’s scripts and everything works fine) (just READ the README included in the .ZIP how to install the scripts);
- http://projectcerber...fg-studio-2.rar ">CFG Studio 2.
Getting your vehicle sorted out so it can be put ingame
Okay, so we’ve got all the programmes now. Before we start to do anything to get the car ingame, you must assure a few things:
- Your car is on scale. If you haven’t scaled it yet, do this first. The easiest way is to import a SA vehicle with Kam’s scripts (DFF IO > Import) and scale it.
- Your materials must be “Gta Materials”. Just open the material editor, and at each material you click the “Standard”-button (the name on the button could be something else) and then choose “Gta Material”. The texturemaps should stay the same, so if you add the texture-files again they should be mapped correctly.
- Your textures must be in .bmp or .tga format. If they’re not, fix that.
ADDING CARCOLS, REFLECTIONS ETC.
If you got this all right, it will save some work later. Here’s a little sub-tutorial, how to put carcols on your vehicle.
First, some facts you must know before you are going to add carcols to your vehicle.
- Some vehicles support only óne carcolor. In this case that is the “primary carcolor”. An example of this is the Sabre. Other vehicles support two carcols, for example the Blista Compact. In this case there is a “primary” and a “secondairy” carcolor. Last but not least, there are only a few vehicles in San Andreas that support four carcolors. The best example of this is the Cement Truck. As far as I know the only vehicle in San Andreas with four carcolors. The amount of carcolors that a vehicle supports is hardcoded, so you must choose a vehicle that supports the amount of carcolors you use. How do you know if a vehicle supports multiple carcolors? Just open “carcols.dat” in the “data” folder with Notepad. Search your vehicle in this file (Ctrl+F) and see if the numbers in the pairs in the row after the vehicle name are the same (for example, “43, 53” means that it uses a primary carcolor and a secondairy, “66,66” only a primary carcolor)
- Carcolors are defined in “carcols.dat”. This file can be found in the “data” folder and can be opened with Notepad (almost all files in the “data” folder (and subfolders) can be opened with Notepad). How this file works is explained later in this tutorial.
- More about carcols is explained later in this tutorial.
Ok, so I hope you chose the right vehicle to edit. Back to the materials.
Select your material (I assume that all your materials are Gta-Materials now). Open the “Color guide”-list. You’ll see a list of ‘names’. If you have a normal material, default is “None”. (If you have a piece of model that has no texture or something like that, but you want it to have carcolor, you just put a material on it with a diffuse color.) If this material is a primary carcolor, select “Primary”, if it is secondairy carcolor select “Secondary”. Easy. You can also define textures as “Right front light” etc., but when I do this the parts on the model that use this texture turn out black ingame. I have to sort this out. If anyone got a solution for this, feel free to post it.
You can add a specular highlight and a reflection also. For the reflection, just check the “Export reflection section” box and give the “Reflection section” an amount of 20, for example. If you have an reflection texture of your own, just choose thatone now (must be in .bmp or .tga format). If you want to use an SA-reflection texture, open “vehicle.txd” in “Gta San Andreas\models\generic” with TxdWorkshop and export “vehicleenvmap128” to somewhere you like.
Every texture you use from the “vehicle.txd” in “Gta San Andreas\models\generic” on your model must not be put into the .txd of your vehicle. If your model appears ingame, San Andreas first looks for the texture in the .txd of the vehicle itself and when the texture isn’t in the .txd of the vehicle, it searches the texture in vehicle.txd. So, if you use the “vehicleenvmap128” texture from vehicle.txd you must not put it in the .txd of your vehicle, but if you use another reflection image it must be put in the .txd of the vehicle.
Ok, so you selected a texture. The reflection texture will be mapped properly automatically ingame, but you must scale the texture. Do this bust just changing the values in the “Tiling” boxes. If this is done, click the “Go to parent” button.
Check the “Export SA Specular Section” button. Click on the coloured square that is probably white. Set it a grey-tone. The lighter this colour is, the more visible the reflection is ingame. I’m using RGB = 84,84,84. If you have a chrome texture, , make it white. If it’s just a reflection for the carcols, make it a greytone. Set the “Spec/Ref Blend” a very small number. I’m using “0,085”.
On my model I have a material that hasn’t got a texture, but is primary carcolor and has a reflection. My material looks like this:
Hope you get the materials part. Let’s move on to assembling the vehicle.
ASSEMBLING THE MODEL
This probably is the most difficult part of the whole tutorial. In this part we are going to assemble the parts of the vehicle.
Every dff-model is divided in two parts. As you maybe know, buildings have an .dff and a .col. The .dff is the model you see ingame. The .col (colission) is the model that makes you able to walk on. When it comes to vehicles, the .col is included in the .dff. If I say “the .dff-model” in this part of the tutorial, I mean the model part, not the .col/colission part.
First a few facts about the model.
- A .dff-model is built op of different things. First, you have the model-parts: the chassis, the doors, the wheel etc., the parts you see ingame.
- The ‘most important’ model is the chassis, the part where all the other parts are ‘based on’.
- All .dff’s have a “chassis_vlo” part. This is the model you see from far away. It is in fact the same as buildings have a LOD. If the vehicle closes in, it will change automatically into the ‘detailed’ model.
- Some parts, like doors, have an “ok” and a “damaged” version. If a vehicle spawns, it spawns “ok”. But, if you hit a wall or something with that, the colission of the door will colide with the colission of the wall, and the “ok” part will be changed into the “damaged” part.
- Second, there are dummy’s. Dummy’s are indicators. Every model-part is linked to a model. You can see the dummy’s as nails to hold the wooden blocks ( = the model parts) together. The dummy’s are not only indicators, they are also ‘axis’. For example, doors are attached to dummy’s. If you open a door, the door will rotate around the coördinates of the dummy where it is attached to. Further, if a bumper is damaged, it bounces a little bit up and down. In this case the the dummy is the axis the bumper ‘rotates’, so bounces, around.
- Some vehicles have “omni’s”. These omni’s can have different functions. In the most cases they function as lights. Planes have omni’s at the end of the wings: they function as the blinking lights.
As said before, I’m going to use the Blista Compact as example in this tutorial. It would be very handy if you import the .dff into 3dsMax too, so you can see what I’m talking about. To get the .dff, just export it from Gta3.img with the ImgTool (push F2 to search in Gta3.img).
NOTE: Some vehicles use a different name in the data-files as they have ingame. The Blista Compact is just called “blistac” and the Roadtrain is called “petro”, for example. You can’t know these names, you’ll have to sort them out.
So, I have exported “blistac.dff” from Gta3.img and imported it into 3dsMax. Import it in 3dsMax (click on the DFF IO button on the right in the “Kam’s Gta Scripts” list, click on “Import” and select your model). If you import it this way, the model-part of the .dff is imported. Later, at the colission part, will become clear that the colission part can be imported with the “COL IO”
Everything that the .dff-model contains is displayed. When assembling the model, one very important tool comes in.
Click on “Graph Editors” in the menu. If there is a “scenematic view” in the “Saved scenematic views” section, open thatone. If there isn’t one already, click “New scenematic view”. Next times, when we open the scenematic view, always open the scenematic view in the “Saved scenematic views” section.
Okay, back to the scenematic view. In the scenematic view the whole model is displayed very claryfied. First click the “reference mode” button ( ) , so everything is a bit better sorted out. You can see how the whole model is built up, how some parts are ‘part’ (i’m calling it “linked” in the rest of the tutorial) of other parts. All model parts are blue, alle dummy’s are green and omni’s are always yellow, but as there are no omni’s in this model I won’t talk about them anymore.
In the scenematic view you’ll probably see that all model parts are somehow linked to dummy’s.
On top of everything, there is the dummy that has the same name as the vehicle it belongs to (in this case that dummy is called “blistac”. This dummy has coördinates X(0,0) Y(0,0) and Z(0,0) (check this by selecting the dummy and selecting the move tool, the boxes in the bottom of the screen should display numbers).
As you probably see, the most important dummy after the blistac-dummy, is the chassis_dummy-dummy. This is the dummy where all parts of the model are linked to: the bumpers, doors, chassis-model, bonnet, boot etc. All coördinates of this dummy must also be 0.0.
There is a reason that the coördinates of these dummy’s must always be 0,0. For example, the chassis_dummy-dummy has got the coördinates X(5,1), Y(6,4) and Z(0,0). When you export the whole thing, the coördinates of this dummy are set back to 0,0. This maybe doesn’t seem a problem, but it actually is a big problem. The chassis_dummy moves to a place that you don’t want it to be and everything that is linked to this dummy moves with it, so your whole model is displaced.
First of all, the most important model part is the chassis. The chassis is the static part of the car. It’s the interior and the rest of the car, where all the doors, exhausts, bonnet’s, hoods, bumpers etc. are attached to. The chassis is a must-have for the .dff.
The chassis_vlo part is a lowpoly model of the whole car, which is visible when you see the car at a distance. As soon the car comes closer, it will change to it’s detailed shape, with the normal chassis, doors, bumpers etc.
As said before, all model-parts like the doors, chassis-model etc. are linked to the chassis_dummy-dummy. I take the “door_lf_dummy”. The name means: dummy of the left front door. There are two models linked to this dummy: door_lf_ok and door_lf_dam. The _ok-model is the model that is “ok”, the not-damaged part. When the vehicle collides with something, the _ok-model changes into the _dam-model. If you open the door, it will rotate around the door_lf_dummy-dummy.
Same for the rear bumper, for example. When the rearbumper gets damaged, the model changes to the damaged model. It bounces a little bit up and down, because it isn’t attached to the frame nicely anymore (to say it that way). The place where it rotates around/the place where it is still attached to the frame is the dummy.
The rear bumper has also got a numplate attached to it. The numplate has also got an _ok and a _dam model. You can see how these are named and linked in the scenematic view. If you have a car that has place for a numplate, it could be nice to use this numplate for it, because it is the default San Andreas one.
In the scenematic view you will also see dummy’s that are named ug_something. These are dummy’s that indicate where the tuningparts, like spoilers, nitro bottles and hoodscoops, are placed. I will speak about the tuningparts later.
The wheels can be found linked to the blistac-dummy. Wheel_rf_dummy = wheel right front, wheel_lf_dummy = wheel left front, wheel_rr_dummy = wheel right rear and wheel_lr_dummy = wheel left rear. The most vehicles in San Andreas that have wheels have only óne wheel model. The wheel model is always attached to the wheel_rf_dummy. Ingame, the model will be duplicated and pasted to every other dummy automatically. Some vehicles, like bikes, use another system for the wheels. The tractor uses different front and rear wheels. Boats never have wheels. The Quad is a car, not a bike. It has another animation, but it is built up and put in SA as a car. If you don’t link any model to the wheel_rf dummy, there is no wheel displayed ingame but the vehicle will work.
Right under the blistac-dummy there are a lot of dummy’s linked. I’m talking about the dummy’s that don’t have anything to do with the model. For example, there is the headlights-dummy. This dummy indicates where the lights are, so the beams of the frontlights are coming from the right place. Same for the taillights-dummy. If the cars has ‘two lightbulbs’ you can clone the headlights-dummy and call it “headlights2” (same for taillights). The light-dummy’s are always placed on the right side of the vehicle, and ingame the beams will come from the same place mirorred on the left side.
The Blista Compact .dff has the exhaust-dummy linked to the chassis_dummy. It can also be linked to the blistac-dummy, just like the lights. The exhaust-dummy indicates where the exhaust-fumes appear. It is often placed on the right side. If your car exhaust on both left and right side of the car, you use óne dummy and put it where the exhaust fumes should come on the right side. Later, when editting the handling, you can adjust it so that the fumes will also appear on the left side.
The ped_frontseat dummy indictates where the body is placed when there is someone in the car. If it is a two-person car, there is only a ped_frontseat dummy. It is placed on the right side and is mirorred on the left side. To give it some indication, the ped_frontseat-dummy is the place where the ass is of the person that drives the car. There is also a ped_backseat-dummy, works the same as the ped-frontseat-dummy. The ped_backseat-dummy is only used when it is a four-person car. Also important: if you have a two person vehicle and only use the ped_frontseat-dummy, you only have to use the door_lf and door_rf. However, if you have a fourperson vehicle and also use the ped_backseat-dummy, you must also put door_rr and door_lr in it (not if it is a car that doesn’t have doors: this can be set later in handling.cfg, will be explained later).
There are a lot of other dummy’s like these. I’m going to list them up later.
There are a lot of different ways how the parts of the .dff (dummy’s, models and omni’s) can be linked. Sometimes Rockstar links the chassis_dummy to the blistac-dummy and all the doors, bumpers etc. to the chassis_dummy, but sometime the doors, bumpers etc. are just linked directly to the blistac-dummy. Sometimes there isn’t an chassis_dummy at all and all parts are directly linked to the blistac-dummy.
This is the minimum that a .dff should contain (excluding the colission file):
http://www.megaupload.com/?d=89B8IF3W">I’ve made a .dff that contains everything that can be added. Download it here.
Just import the .dff into 3dsMax and check the scenematic view to see what’s possible to add. Don’t mind the model itself. Everything that is in this file and that is not in the picture above, is an option.
Okay, enough blabla, let’s get back to work.
Now you know how a .dff model is built op. With this knowledges, you can start to put your own model together. Scale your whole model, and set it into place.
You must change some coördinates. The scale of all modelparts should be 100 and the rotation should be X(0,0), Y(0,0) and Z(0,0). Further, the coördinates of the chassis should all be zero. You can set the scale back to 100, set the rotationvalues back to 0,0 or make all coördinates zero without changing the model’s size, rotation or place.
Click “Hierarchy” and click the “Affect pivot only” button, so it turns blue. Check all boxes at the bottom of the list.
Click one part of the model (for example the chassis). Select the rotate tool, and type “0” in every box at the bottom of the screen. Select the scale tool and make all values in the boxes at the bottom of the screen 100. For the chassis you set all coördinates to 0,0. For all parts like doors, bonnets, wings, bumpers etc. you set the coördinates so that they fit the axis where it rotates or bounces around. Instead of typing values in the boxes, you can also just move the axis of the models in the viewports by dragging the arrows; this is easier when you must set the coördinates right for rotationaxis of a door for example.
Important: the _ok and _dam-part of the same model-part must have the same coördinates (for example, front_bumper_ok and front_bumper_dam must have the same coördinates).
If you’re done with changing etc., you click on the “Affect pivot only” button again so it turns grey again.
Now you must place the dummy’s at the same coördinates as the parts they belong too. To get all dummy’s you could possible need, just use my For example, door_lf_dummy must have the same coördinates as door_lf_ok and door_lf_dam. Change the dummy’s coördinates by moving it. When moving the dummy’s, do not use the affect pivot only function! The boss-dummy and the chassis_dummy must have coördinates X(0,0), Y(0,0) and Z(0,0), the coördinates of the other dummy’s doesn’t make sense.
Okay, so when all dummy’s have the same coördinates as the parts they belong to, you can start linking the whole thing up! Open the scenematic view again. First, you arrange the dummy’s. You can link things by selecting the “connect” tool in the scenematic view screen.
Link the dummy’s properly to eachother by pointing your mouse on the dummy that must be “under” the other dummy, click and hold your left mouse button, drag it too the button it must be linked too and release the mouse button. A line should be created between them now. Do this with all dummy’s, until all dummy’s are linked properly.
If you’re done with the dummy’s, start linking the model-parts to the dummy’s where they belong too, same as you did with the dummy’s.
If you got everything linked nicely, click, still in the scenematic view screen, “File” and click on “Connect”. You’re done with the .dff. Now we’re going to export it.
Select your whole model (Ctrl+A). Open the DFF IO script again. If you want to make a custom colission now, export the .dff without a colission. We will re-import it later so we can add the custom colission file to it. Be sure to use these options:
Be sure you have the “No colission” box checked. The rest of the options is default. Click the “Export” button and export it somewhere you like. Go further to the “Custom Colission” part.
If you don’t need a custom colission, you can use a SA one. If you have added or deleted bumpers, doors or something else like that, you must use a custom colission, because otherwise the damaged parts won’t by synchronised ingame if the vehicle collides with something. If your vehicle doesn’t use any damaged parts, using an original SA colission isn’t a problem.
First, you must choose a vehicle which looks like your vehicle. The colission looks probably like the one you need. Export the .dff from Gta3.img. In 3dsMax, click on the “Select COL3/COLL” button and choose the .dff you just exported. Be sure the “Skip COL” box isn’t checked and leave the rest deault, like on the screen above. If you don’t add a colission, the game will crash. Click the “Export” button and export your model. You’re done with the whole .dff. Now only the .txd and the rest of the data-editting is left. Go further at the “The Txd” part.
First, we import the colission. Open the Colission IO script. Click on “Open colission file”. Now, you can choose. If you have already made a colission file you can re-import it. By default only .col files are viewed now. If you change “COL File (.col)” in the “Open SA Vehicle DFF File” screen into “DFF File (.dff)”, you can also see the .dff’s. As said before, the .dff contains the colissions of the vehicle. So, you just choose a .dff now so you can start editting it. In this case, that is the Blista Compact (blistac.dff). When you choose the blistac.dff, it will be put in the list under the “Open colission file” button. Click the “Load” button to load it into the scene.
The colission includes a few things:
- The “shadowcolission”: if you use 32bit resolution, San Andreas displays dynamic shadows. The model that creates the shadow (the sun shines on it blabla) is the shadowcolission. It is a lowpoly model of the vehicle itself with a special material.
- The colission itself: a lowpoly model that, in case of a car, just contains a few planes. The planes represent the top (roof) of the car and the underside of the car. The best way to model such a colission is to import your .dff, delete everything but the chaassis and use it as a template.
- Spheres. Spheres represent the mass of the colission. Also, they can also collide. Normal spheres that just represent the mass and are used as a fill-up, are named “Default” (or “Default01” for example, which name is created when you clone it). There are also spheres that have a name, like “frontbumper”. If this sphere, that sticks out of the whole thing, collides with something, for example the colission of a wall or of another vehicle, that’s a sign that the _ok model of, for example, the frontbumper must be changed into the _dam model.
- A big sphere and cube around it. They represent the boundaries of the vehicle and have something to do with the camera. Nothing important, they are added automatically when you export a colission.
Left the shadowcolission, the normal chassis in the middle and the colission model on the right.
You can delete the big sphere and cube. They aren’t needed and will be added automatically when you export the colission.
Just a model is enough for the colission model, it doesn’t need a material (adding a material doesn’t make any sense, because it is invisible).
The shadowcolission is the model that shapes the shape of the shadow of the car. If you have finished the model, open the material editor. Pick a free material, click on the “Select material from object” button, click on the original SA shadow model (it’s black), select your new shadow model, get back to the material editor and click “Assign material to selection” . Your shadow model is done.
Your shadow and colission models are done now. Make sure they have coördinates X(0,0), Y(0,0) and Z(0,0). If not, use the “Affect pivot only” method do fix it.
You can use them now as a template where you are going to place the spheres in. Only parts that also have a damaged model need special spheres. Maybe you think so, but you can’t just pick a sphere, name it as “Frontbumper” and think it works. The spheres that represent the frontbumper have a special material assigned to them that makes them represent the frontbumper.
The way to built the sphere-model up, is to search through a few dff’s so that you have spheres of each part of the model. You can move, clone (right mouse button > clone > select “copy”) and scale the spheres so they fit the model. Be sure that the spheres stick a bit out of the model. If you’re done with the spheres that represent the parts, fill the rest of the model up with normal “Default” spheres.
If you’re done with the spheres, select the shadow, colission and all the spheres and open the Colission IO script again. Click on the “Colission Mesh” button and click on your colission. Click on the “Shadow mesh” button and on your shadow model. Type the name of the .dff in the box above the “Export” button, click on “Export” and save it somewhere you like. After you saved it you delete everything.
Re-import your .dff, open the scenematic view, select everything, File > Connect, close the scenematic view, be sure everything is selected, open the DFF IO script, default settings, click on the “Select COL3\COLL” button, set view as “DFF File (.dff)” instead of “COL File (.col)”, select your col file, hit “Open”, be sure that “Skip COL” is not checked and Export the whole thing. Your DFF is done!
PUTTING IN THE .TXD
In this part I’ll show you how to put the textures in the .txd.
Export the texture of the car you’re modding to a folder you like. Open it. Delete all textures, except one. Duplicate it (Ctrl+Insert) as much times so the amount of textures in the .txd is the same as the amount of textures you want to put in the .txd (textures used from vehicle.txd mustn’t be put in the .txd of the vehicle).
Doubleclick the first texture in the list. Rename it to one of your textures, hit a few times “compressed” so that it says “DXT1” and hit “OK”. Click the “Import” button and import the texture that matches the name you just gave it in TxdWorkshop. Do this with all textures.
If you have textures that got an alpha, doubleclick the texture in the list, check the “Alpha is used” box (name of the alphatexture in TxdWorkshop will automatically be name+a), hit a few times the “compressed” button until it say “DXT3” and Hit “OK”. If you did this right, the texture in the list should be red instead of black. Click the “alpha/mask” button at the bottom of the programme and import your alphatexture here. You can check if the texture and it’s alpha work by clicking the “alpha mix view” button.
If you’re done with all textures, just save the .txd somewhere you like.
PUTTING THE .TXD AND .DFF IN GTA3.IMG
Put your new .txd and .dff in Gta3.img with the ImgTool and replace the old one.
EDITTING THE DATA LINES
We must change something in the data-lines too.
First, we open “vehicles.ide”, which you can find in the data folder. Open it with notepad. Search (Ctrl+F) the line of your vehicle. First you’ll see a number. Vehicles.ide is an important file, but when it comes to changing things because your vehicle isn’t the same as the original one, vehicles.ide isn’t an important file. A few things that can be changed in vehicles.ide:
The second and third to last digits represent the size of the front and rearwheels. The last digit represents where the car can be tuned (-1 for “cannot be tuned”, 0 for Transfender, 1 for Wheel Arch Angels (tuners) and 2 for Loco Low.Co (lowriders).
Second, we open handling.cfg, with CFG Studio 2 (see top of post for downloadlink). In handling.cfg is defined how the car drives, how many exhaust is has, if it has six wheels or four, how fast it can drive, how heavy it is etc. You can search the line of your vehicle with “Ctrl+F”. At the top you can see which column represents what. Just play around with the numbers until you think it drives good ingame (it needs some tweaking and testing to get the handling well sometimes).
One of the last columns are the “Handling Flags” and “Model Flags”. If you doubleclick the box of your vehicle in one of those columns, a row of options will appear. Here you can set different abilities. For example if it has double, no or just one exhaust, are the rearwheels wider than the front wheels, has it got doors, is it for only one person and if it has 6 wheels instead of four.
Third there is carcols.dat. Open it with Notepad. First you have a row of numbers and names. These are the colours. The last colour is number 127: pink. After this color you can add your own colors if you want. The original carcols all have a # with some text behind it. In the data files, a # means that everything behind the # should not be read. If you add more carcolors, you just write the RGB colours, separated by space. For an indication you could put # 128 mymod red” behind it, as an indication.
Search (Ctrl+F) for the line of your vehicle. In this line, there’s first the vehicle’s name. Then there are pairs of colours: the primairy and secondairy color, separated by a comma. Every pair is again separated by a comma and a space (just check the lines to know what I mean). You can just delete all the colours behind the name of your vehicle and make your own carcols line with the colours you like.
Remember: [vehiclename], [primairycolorpair1],[secondairycolorpair1], [primairycolorpair2],[secondairycolorpair2] etc.
Save the file when you’re done.
Last but not least there is carmods.dat. In this file is defined which carmods the car is able to handle. Since I haven’t explained the carmods yet in this tutorial, it’s better to delete the line and put a “-1” as last digit in the vehicles.ide line, so it isn’t tunable. To make it tunable, you should place dummy’s for the parts you want it to be tunable for in the .dff and write the names of these parts again in carmods.dat so the carmods.dat line and the tuningpartdummy’s in the .dff match. I will explain the tuningparts later.
You are done! Happy modding!
If you got any comments on this tutorial, criticism, hints, tips or anything else: feel free to post them! More tutorials about vehicles will be posted later. For example, how to add tuningparts, how the planes, helicopters, bikes and vehicles that have special abilities (like the Packer, Dozer or Hovercraft) work and more.