The Wayback Machine - https://web.archive.org/web/20100603010656/http://kitamuracomputers.com:80/stilwater.info/index.php?title=Creating_New_Vehicles

Creating New Vehicles

From SaintsModding

Jump to: navigation, search

We're going to be creating a new vehicle! Currently we can only clone existing vehicles, but they get put into a new slot and don't overwrite an existing vehicle, which means that if we ever get the tools to create new meshes, we can make entirely new vehicles. Find a good place to save your game. Penthouse Loft is a great spot, there is a Foreign Power, Cycles, and Rim Jobs a short distance to the west of the Penthouse, giving quick access to a dealer to buy from and a place to customize.

Contents

Getting Started

First thing that needs to be done is to set up your files. You can learn how to do that here. You will need to extract common.vpp_pc, patch.vpp_pc, meshes.vpp_pc, pegs.vpp_pc, and textures.vpp_pc.

Next, decide what vehicle you want to clone. For this example, I will be using the Five-O police car. Let's start collecting the files we'll need.

Open your extracted common folder and copy the following files into your working folder: car_4dr_police01.xtbl, car_4dr_police01_veh.xtbl, car_dealerships.xtbl, vehicle_cameras.xtbl, vehicles.xtbl

After that open up the meshes folder and copy these files to your working directory: car_4dr_police01.car_pc, car_4dr_police01.cvtf, car_4dr_police01.g_car_pc

If you follow the instructions for converting peg files, your pegs and textures will be in the same folder. We won't be converting any pegs, but having these two file groups of files in the same folder is handy. Whether you have them in one folder or two, go in and copy these files to your working directory: car_4dr_police01.g_peg_pc, car_4dr_police01.peg_pc

NOTE: If you are going to mod a helicopter, you will need the files for the rotors too. *_rotor.peg_pc, *_rotor.g_peg_pc, *_rotor.effect_pc, *_rotor.g_effect_pc

Rename Your Files

Now we need to rename our files, the style I use is fc for foamcup, and the new name for the vehicle, all lowercase with no spaces or punctuation. The name I decided on for the car is O-Yeah, so my new file name will be fc_oyeah. So rename all your police01 files so they look like this:

car_4dr_police01.xtbl --> fc_oyeah.xtbl This is the base vehicle file, it defines variants.
car_4dr_police01_veh.xtbl --> fc_oyeah_veh.xtbl This is the vehicle stats file, you can customize a surprising amount of stats for the vehicle such as speed, torque, gear ratios, engine redline, etc.
car_4dr_police01.car_pc --> fc_oyeah.car_pc This file contains mesh info.
car_4dr_police01.cvtf --> fc_oyeah.cvtf This is the customization file, all the options you see in the Rim Jobs menu and the variant spawn options are defined here.
car_4dr_police01.g_car_pc --> fc_oyeah.g_car_pc This is the actual mesh for the car.
car_4dr_police01.peg_pc --> fc_oyeah.peg_pc This file contains texture info.
car_4dr_police01.g_peg_pc --> fc_oyeah.g_peg_pc This file contains the actual textures.

Edit the Files

All references to the old filename need to be changed in the files, and new entries must be created in the car_dealships.xtbl, vehicle_cameras.xtbl, and vehicles.xtbl files. Notepad can be used to open and edit the .xtbl files. Winmerge can also be used to edit the files and is useful to study the differences between two files and merge them together.

Open fc_oyeah.xtbl and look at the fourth line, the <name> tag, it will say car_4dr_police01. Change it to read fc_oyeah. Save the file, it's ready to go. Towards the bottom you will see references to car_4dr_police01_cust.xtbl but you don't have to worry about those, changing them appears to do nothing and we are not using the _cust file.

Open fc_oyeah_veh.xtbl and again change the <name> tag to read fc_oyeah. We also need to change a few more tags in here, so look at line 11, the <Display_Name> tag, it will say Five-O, change it to O-Yeah. This is what sets the name that appears at the store. On the next line you will see <Special_Vehicle_Type>, it will say Police, change this to none to disable the dispatch radio and siren. The siren will still work, but it won't make NPCs move out of the way. You can tweak the vehicle stats if you want to. When you are finished, save the file.

Now comes the slightly more difficult part. Open car_dealerships.xtbl. If you are using the vanilla file the vehicle entries will look like this.

<Element>
				<Vehicle>car_2dr_muscle04</Vehicle>
				<Variant>Standard</Variant>
				<Cost>20000</Cost>
				<ColorData>
					<Colors>
						<Color>
							<ColorSlot>Body Color</ColorSlot>
							<Type>Color</Type>
							<Name>Gloss Paint</Name>
							<Index>Gloss Graig Red</Index>
							</Color>
						<Color>
							<ColorSlot>Rim Color</ColorSlot>
							<Type>Color</Type>
							<Name>Metal</Name>
							<Index>Metal Chrome</Index>
							</Color>
						<Color>
							<ColorSlot>Window Tint</ColorSlot>
							<Type>Color</Type>
							<Name>Glass</Name>
							<Index>Glass Tint 60%</Index>
							</Color>
						</Colors>
					</ColorData>
				<Type>Sports</Type>
				</Element>

If you are using the Gentlemen of the Row file, the entries will look like this:

<Element>
				<Vehicle>suv_4dr_06</Vehicle>
				<Variant>Standard</Variant>
				<Cost>30000</Cost>
				<Type>Misc</Type>
				</Element>

Since you are here, reading this article, you are most likely using Gentlemen of the Row, so that is the format we will use.

Add a new <Element> entry for the O-Yeah. It should look like this:

<Element>
				<Vehicle>fc_oyeah</Vehicle>
				<Variant>Standard</Variant>
				<Cost>18000</Cost>
				<Type>Misc</Type>
				</Element>

Place it at the top of the Foreign Power vehicle list so it appears first when you go to the store, the beginning of the dealership section will look like this:

	<Dealership>
		<Name>Foreign_Power</Name>
		<VehicleList>
			<Element>
				<Vehicle>fc_oyeah</Vehicle>
				<Variant>Standard</Variant>
				<Cost>18000</Cost>
				<Type>Misc</Type>
				</Element>
			<Element>
				<Vehicle>truck_2dr_monster01</Vehicle>
				<Variant>Maero</Variant>
				<Cost>100000</Cost>
				<Type>Misc</Type>
				</Element>

Okay! This file is done, save it. This will make the vehicle appear on the list at the store, but without the mesh files, the game will crash when you highlight the entry in the menu.

Time to modify the camera file. Without this, the camera will go into the car when you get inside and you won't be able to see anything at all while in the car. Open up the vehicle_cameras.xtbl file and find the entry for the Five-O.

<Vehicle>
		<Name>car_4dr_police01</Name>
		<_Editor>
			<Category>Car - standard</Category>
			</_Editor>
		<use_alt_freckle_cam>No</use_alt_freckle_cam>
		<Primary_Camera_Angle>
			<Lookat_Offset>
				<X>0.0</X>
				<Y>0.9</Y>
				<Z>0.0</Z>
				</Lookat_Offset>
			<Follow_Distance>7.75</Follow_Distance>
			<Follow_Height>0.6</Follow_Height>
			</Primary_Camera_Angle>
		<Secondary_Camera_Angle>
			<Lookat_Offset>
				<X>0.0</X>
				<Y>1.1</Y>
				<Z>0.0</Z>
				</Lookat_Offset>
			</Secondary_Camera_Angle>
		<Fine_Aim_Camera_Angle>
			<Lookat_Offset>
				<X>0.0</X>
				<Y>0.0</Y>
				<Z>0.0</Z>
				</Lookat_Offset>
			</Fine_Aim_Camera_Angle>
		<Camera_Roll>
			<Roll_Type>vehicle_roll</Roll_Type>
			<Intensity_Multiplier>0.2</Intensity_Multiplier>
			</Camera_Roll>
		<Max_FOV>75</Max_FOV>
		<Camera_Swings>
			</Camera_Swings>
		<Camera_Sticky>
			</Camera_Sticky>
		<Helicopter_Specific>
			</Helicopter_Specific>
		<Seat_Specific_Datas></Seat_Specific_Datas>
		</Vehicle>

Copy and paste this into the bottom of the camera list and change the <name> tag to fc_oyeah. The last vehicle in the list is the cutscene version of the Atlasbreaker, so search for truck_2dr_monster01_cs and put our new camera entry under that one. Putting it at the bottom of the list is not necessary for this file, but there is a method to my madness that will be made clear momentarily. Save this file.

Time to edit the vehicles.xtbl! Once again, the cutscene Atlasbreaker is at the bottom of the list, so find it, and under that entry, create a new one for the O-Yeah.

BUG WARNING: You must put the new vehicle entry at the bottom of the list or it will cause your gang vehicles to get messed up. It is pretty funny watching your homies cruise around on ATVs, but we want to keep this clean.

<Vehicle>
		<Name>fc_oyeah</Name>
		<_Editor>
			<Category>Entries</Category>
			</_Editor>
		</Vehicle>

Save the file, we're almost done!

Build it!

The only thing left to do now is build the patch.vpp_pc file and test it out. Copy your files into the modified folder and build the patch file, then copy it into the Saints Row 2 directory (back up your original) and play the game. Head over to Foreign Power and pick up the new car.

Troubleshooting

If the game is crashing, consult this handy list!

Game gets to 40% loading and just stops or crashes. Most likely there is a tag open somewhere, could be a missing bracket or completely missing tag, look around for things like </vehicle and make sure all your opening tags have a closing tag: <name>text here</name> Another thing to check is that you have created an entry in car_dealerships.xtbl. The game crashes if you have a vehicle without a dealer entry, which makes no sense since there are plenty of vehicles in vanilla that can't be purchased at a dealer.

Game crashes when I highlight the vehicle entry in the store menu. You forgot the mesh files. Copy them and make sure to change the file names.

Game crashes when I access the dealer lightcone. Make sure there is an entry for the vehicle in vehicles.xtbl

My car has glowing textures! You forgot the texture files. Copy them and make sure to change the file names.

I get in the car and everything goes black! Make sure there is an entry in vehicle_cameras.xtbl.

Conclusion

There you go, a brand new vehicle to play with. It is possible to modify the colors that the vehicle spawns with at the store and strip the police decals off it, but that requires hex editing the .cvtf file, which I won't go into right now. If you have any questions or need a bit of help (I won't do all the work for you. :P) you can contact me at The Row or on Steam (username foamcup for both).

Personal tools