Welcome, Please Register or Login

Tutorials \ Street Legal Modding Tutorials \ How to Make your own class files

Author / Submitted by: Akos

How to Make your own class files

Hey peeps, It's me again, and this time I got something maojr cool to teach you! ;) Thanx to Akos :-* (from Invictus)posting the java compilation and the baiern_hood source And Onedownone2go :-* taking the time to teach me how to work with these. making it possible for me to make this verry important and cool tutorial for you all. Well I won't keep you waiting any longer lets start:

First: The sourcecode used in this tutorial is for SLR:Rv2.2.1. It can be used on older versions of the game but then you do risk the game becoming unstable and it can crash from time to time.

The source code is the core of the class, it's the base all is build on in this game.

These are working java-sourcecodes for parts:

Akos Baiern_hood source:

Onedown's MC_intercooler source ("general parts"file):

Now how to edit these to make them fit your part:

Taking a general part file will be best to use as base for most adds, this because it has no references to anything ingame, It is a dummy file With not logic in it, no functions or adjustments in terms of classfiles. Only the defelct-statement in the cfg gives some values.

Basically Those javasourcecodes are a java"template" to make a "dummy"-part. wich means u can use it as part of a cars classfile-structure or a own classfile-structure. Since most of the time a general-parts file is best to use as base lets take onedownone2go his sourcecode for the rest of this tutorial. And use this to create our own classfile.
I'll explain in steps:

1:Java sourcecode:
make a new textfile on your desktop, open it and edit it so it's exactly the same as onedownone2go his code. Then goto file and choose "save as". set it to "all formats" and coding: ansi, and save it as the name your part will have in the code.

This "package"-statement tells what pack the classfile belongs to. It can only belong to existing packs..

U have to fulfill some "convetions" in classfile-naming.
The filename is case-sensitive.
As is the classname in the source.
So, for example, if u want 2 create a classfile. named "pioneer_sub_1.class" ur classfile must be named pioneer_sub_1.java.
The published classname in the source must be the same.
If u dont want to include ur part in a cars rpk, u have 2 delete the CarCategory-statement from the sourcecode.
The publicnames and the extention behind the first public name will be the parts aliasses in the rpkfile.

This will tell where in the catalog you can buy the part. This allway's has to be an for the catalog existing id.

This is the Identification for your part. Make sure this number is allway's unique in the files.

The price is given in "value".
But in hungarian currency.
the tHUF2USD is a converter-function to US-Dollar.
U can basicly decide on ur price in dollar and then devide by 5.2.

"Parenting" classfiles:
You can't just go change the "package"-statement to what you like.
This "package"-statement tells what pack the classfile belongs to It can only belong to existing packs..

U can go 2 ways...

1st way:
Easy and direct. just use the id's akos published on BE as superid.

The 2nd way:
This comes into account when u include ur new parts in a cars rpk and want them only to appear in the catalog if such a car is currently in the garage.
Then u "cascade" the superid.

"Cascading" superID:
The superid of the classfile/cfg-entry tells SLRR where to place the part in the catalog.
so it has to be a id code existing to the catalog.
U create a new entry in the rdb.
superid typeid
And then u use ur new ID as superid for the part.
Now it will only appear if the right car is currently in the garage.

When your done with this sourcecode and saved it as .java script your part addon just as you do normally by editing the rpk to have the references to the part and editing the cfg file. It has just one exeption now it has no classfile to edit, cause this is the java file at this moment. When you edited the rpk and cfg, make a subfolder called src in the scriptfolder and put the javasourcecodefile you just made in there. start the game, open the catalog.. and SLRR will compile classfiles from ur sources.

So you now made your own fully edited classfile.

Here is a pic with explaination to make it bit easier on you:

And here is the one I made for one of my woofers and while at it writing this tutorial:

If u have both kinda parts in one rdb - car-specific and general ones - u need a 3rd way..
Called "double-cascading" And u have to modify the cars rpk.

but i'll keep that for next lesson, you guy's first try to get this. Tags: No tags


2. jhonydoe1

2014-10-27 16:47

ah this is what I've been looking for :)


2013-02-09 16:38

But how if I want to make a transmission to fit more blocks and have different ratios without using .javas?

Only registered users can post new comments

Administration panel

Contact Info

Put your e-mail, skype, phone numbers or any other contact information here so that your visitors could easily get in touch with you.