Scripts: How to stop cars crashing in Valo City - Caballo

Post Reply
User avatar
Posts: 85
Joined: 10 Dec 2019 12:27

10 Feb 2020 23:36


You like that car and it does not work? Repair it youself!

Since the start of the mods for this game (ah, the good old days of Xi) almost every player stop clicking "Go to the streets" button because of a single issue: the game crashes.

In this tutorial i'm going to explain how to make a car safe to play on valocity, Roc races, etc, so you all can enjoy the original sense of the game. It is not a short tutorial, because the harm is huge, but when you got the idea, it takes less than 10 minutes to fix any car, so have patience, read it all, and you'll be able to hit the streets again in your favourite car, racing versus the cars you want.


- First of all, you are going to need a program to edit the java files.
I use "Edit Plus 3" but any version of it will do the job. 5.3 Evaluation Version is available Here.
Alternatively you can use Notepad ++.

- Then, you're going to need a grep.
A grep is a tool that allows you to change a piece of text in multiple files at the same time. Since we're going to rename a lot of routes, you better get one of these: it makes the work easier, less time consuming, and free of errors, and almost all of them keep a backup just in case you write "Mazdar" instead of "Mazda". I use PowerGREP 4, but there are more like it. Windows Grep is a good free alternative.

- Next, we need the java pack of the game.
Some authors don't release the javas they used with the mod (reasons unknown), but all those .class files you see in the "scripts" folder can be changed with any .java you rename with the same name, as long as you set it in the proper place.
The javas* were released long time ago by Activision, and you can find them Here


- Any Hex editor. Just incase.

- And finally, since we're going to edit the RPK of the car, we need the wonderful Resource Converter by Roltzy. you can find it Here or Here! (Includes resconvert.exe and resdecode.exe).


Ok, now you have your shiny new tools, downloaded a rocket, and it crashes the game. Let's go for it.


First of all, we need to know what car the modder used to create his mod. And with this, i mean that, more than probably, the modder took the javas of a car that was ingame, and used them as a base for his mod. We need to know what car it is. ¿How? easy.

If the author released the .java files of his mod, they are stored in Cars\racers\nameofthecar\scripts\src. Always.

If the .javas are there, just open the file named with Edit plus. it will show you the models the car is using, and if it's crashing the game, more than probably it will look like this; Image

The creator of this car clearly used the Duhen javas to make his mod, but didn't rename the models, nor made it standalone, and your game crashes because it thinks "¡HEY MAN, THERE ARE MORE THAN ONE DUHEN HERE!¡WRONG!".

Before cleaning the mess in this file, we better look for the models the modder created. Sometimes there are more than one version of a car in a mod, so we need to know how many of them are there. To do that, we'll look for the models of the car .javas. in this case, Sunstrip 1.5, 1.8, 2.0 and 2.2, and see what the modder used; Image

In this case, the author (and i'm not gonna say who was, he'll instantly know) was kind enough to write "Don't use" in the cars he's not using, but in most cases you will have to look for the name of the car to know which ones are used.

I found out the car being used for this mod is the Duhen Sunstrip 1.5 DVC, so i GET RID of the rest of the car javas and config files unused. This means I delete, I go back a level (I'm in "scripts" folder now) and delete Duhen_Sunstrip_1_8_DVC.class, and _main_Duhen_Sunstrip_1_8_DVC.cfg, and do the same with the other two models of the original car, leaving only the 1.5, which is the one the author used for the mod.

"OK, very instructional, but... What if the author didn't released the javas, smartie?"

Good question. That's why we need the Hex editor ¿Remember?.
Sice the .class files are encoded, and i don't know the code used, we will have to open the .class files with it. It will show something like this; Image

And if we scroll down a bit;

And we found out what car he used.

Next we'll see how to clean the main .javas and rename the car, so it appears in the car list in the order you wish.


Now that we know what car(s) the modder used, we are going to start cleaning the mess. We already deleted what we don't need, so we are going to tell the program those things aren't there anymore, and that it is not what it thought, but a whole different car.

In this case, since the car is a Honda CRX delSol, i'm going to rename the files with something more like it. Also, we'll rename the RPK and the folder so it shows this car in the list as we want it to. I have my cars ordered by brand, so the new name will be "Honda_CRX_DelSol.RPK" and "Honda_CRX_DelSol_data" for the folder. This will put it behind the Civic, but before the NSX (the list is ordered alphabetically based in the RPK names)


Also, we'll rename the "Duhen_Sunstrip_1_5_DVC" files to something more like it. in this case it will be as simple as "CRX_DelSol". Now, our main files should be changed from this: Image

To something like this:

(There are a lot more files on the folder, for the parts, but they've been ommited to make the idea clear, do not delete them)

As you can see, there's the "src" folder in this car. If it isn't in the car you want to repair, now it's the time to create it. ¿What should you put inside? the main .javas of the car the modder used as a base, and you have in the Javapack. In this case they will be:

It should look like this:

And rename those files as the corresponding .class files, so they know what to modify:


Now that we have the folder and the files renamed in working condition, and the source files created, we're going to create our standalone car. The first step is to open the file. in this case it is "": this is what the file looks like from scratch:

And this is what it may look like once we edit it;

As you can see, I've changed the fields so they fit my personal tastes, what means to be descriptive. You can assign the names you want, but you have to keep in mind what names you used in order to edit the rest of the files. For the MODELS line, it's important to know that you can use whatever number of fields you want, but you have to:

1- use ALPHANUMERIC names. Numeric only names don't work
2- Do not use special symbols

Next we are going to rearrange the CRX_DelSol_VT to make the car appear in the different circumstances of the game without crashing when you enter ValoCity, Roc or the dealers.



Ok, now we're going to take the car back to the city. The file what controls what goes in and out of the dealers, all the races and ValoCity is the, so let's open it with Edit plus; Image

Underlined in red you can see the file's "name" (it's not just a name) is still the one for the original car, and the route (cars.racers.Duhen) is still aiming for the Duhen RPK. THIS is the main reason why the mods crash.

As before, we get rid of everything related to any car that is not the one the modder used, leaving only the code related with the Duhen 1.5, and set everything as we want it to look. We are not changing the vmd.stockQM because we still need a platform the program can recognize to create the car around it.

And about the 0x00000006 number, we'll go into that later.


Ok, now we have the connection established between the game and our car, it knows it's not one of the cars he used to know, and where to look for the right platform, now we're gonna tell the car all this.

Let's open the main car's .java:;

Since we changed the name of the .javas and of the model in Step 2, we have to show the car what we have done, but, if you look down below, circled in red there are a lot of references aiming for the Duhen RPK. That means the original mod was looking for the parts in the duhen directory, and, since they are not compatible with this chassis, the car will simply appear without them every time. let's fix all this.

Next we will tweak the .RPK and the routes, and the car will be roaming through ValoCity.

Here, about the parts, you have to take notice about a thing:

Every part has a unique id number (those numbers that look like 0x00000001) If the modder kept the original part numbers, you don't have to change them, but if he added parts, or changed those numbers, you will have to go part by part looking for the right number. The number appears in two files: the part's .cfg file and the main RPK. In the part's .cfg file it is the first number that appears on top of the file like this;

Some mods I found had the original ID number in the cfg file, but the modder changed the part number in the RPK, so let's decode the RPK of the CRX DelSol to see what we must look for.

To decode a RPK you must do the following:

1 copy the RPK to the folder where you put Roltzy's Resource Converter
2 Open Roltzy's Resource converter
3 Double click on the RPK (in the Resource converter)
4 The tool will decode the RPK and put a copy in the same directory named "XXXXXX.RDB". you can open it with Notepad.
5 Et voila!

This is the CRX DelSol RPK. Let's see if the F_bumper ID number is the same:

If one of the numbers coincide, the odds are on the author of the mod kept all of them. Sometimes it doesn't work this way, and you have to look in the RPK for the right number for some parts.

Well, now we have the right parts, the only thing left to do is to tell the RPK and the cfg files the new routes and names. For the RPK, we've changed the name of the folder, so he must know it. In notepad, go to the top of the file, press CTRL+H to use the tool "Replace", and reform the old route into the new one: Image

Use "Replace them all". Then, find the old java files (Duhen_Sunstrip_1_5_DVC.class ¿Remember?), replace them with the new ones we gave to the car, and get rid of the unused cars. It should go from this: Image

To something like this:

The lines in red are the ones i edited. The line in green is the last thing we must change in the .RPK. Since we want to make the car standalone, we have to change the alias of the model in the RPK. There are only five or six entries in the file which involve this, but i reccomend doing it one by one, since a lot of other entries may start with the same sentence ("alias Duhen_Sunstrip_1_5_DVC" and "alias Duhen" in this case), but have more content in the same line, and we only want to change the proper ones. If you don't dare to do this, you can only change the one marked in green, and leave the rest as they are.

Ok, now we have a proper .RPK Save the changes, recode it with Roltzy's resource converter (you will have to delete the old RPK) and move it to the proper folder (cars\racers\). And let's chage the routes in the .CFG files. We'll have this nice CRX in ValoCity in no time.

Open the Grep. I will be using PowerGREP 4, but you can use any other. Aim for the Honda_CRX_DelSol_data folder and select it. Include all files inside the folder in the search (You can use *.*) And select "Search and replace"

We are looking for the old route, which was "DelSol_data" in this case, and we want to replace it with the new one we selected ("Honda_CRX_DelSol_data" in my case). With the changes we've made, the grep should look like this before the action:

In this case, the author didn't even used his own route, so 0 results appeared. And so, i thought the routes must be the original ones for the Duhen car, and tried it that way;

And there they are;

OK. Now we have the proper routes for the parts, the physics, etc. let's see if the car works.

The game cranks, which is a good sign. If you've done something wrong or made a mistake, the game has en Error.log which tells you what went wrong, and where. Try the catalog, and look for all the car's parts. it should show them all. Maybe some are in the wrong place, but they must be there.

Now let's try valoCity.

Ok, ok, the lights are wrongly scripted (and some parts too) and the driver is not seated in the proper place, but those things are not a result of the conversion. the original positions of those things are set in the Main Config and the RPK, so the modder simply didn't get them in the proper place. It's not your fault, but you can repair them. The fact is: Your car is working in ValoCity now.

And that's it. It wasn't that hard uh? If you find this useful, post something, and enjoy the game!
Last edited by DirtMuppet on 21 Mar 2020 14:50, edited 5 times in total.
If you think you can do a thing or think you can't do a thing, you're right.

User avatar
Posts: 85
Joined: 10 Dec 2019 12:27

20 Mar 2020 15:48

There we go, all Images fixed!
If you think you can do a thing or think you can't do a thing, you're right.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest