-
Notifications
You must be signed in to change notification settings - Fork 6
How to add more stages and cars by Ten Graves
Hey guys, recently I found out how to add more stages and cars, so I thought I'd share it. It was actually a lot easier than I thought it would be, and a shorter process than I expected. So let's get started:
-
The first thing you should do is add new .txt files for the stages in the tracks folder (so you don't have to do it later), depending on how many stages you're planning to add. Add more .rad files for the new cars (you don't actually HAVE to add more cars with more stages - you can theoretically have 100 stages still with 16 cars, but you'd probably want to anyway), and finally, add more .rad files for the music for the new stages.
-
If you want to add more cars (and you probably do), you have to increase the amount of .rad files the game reads. To do this, find this in GameSparker:
int i = 0;
int j = 0;
do
if(zipentry.getName().startsWith(as[j]))
i = j;
while(++j < 55);
j = (int)zipentry.getSize();
byte abyte0[] = new byte[j];
int k = 0;
int l;
Change the "55" to however many extra cars you're planning to add. E.g. if you're adding 3 more cars, change this to 58. Now, in the text above, where it says the name of each piece, add in the names of you .rad files (your cars) to it, right in front of Monstaa. Also, find this:
Record record = new Record(medium);
ContO aconto[] = new ContO[55];
loadbase(aconto, medium, trackers, xtgraphics);
Once again, change the 55 to however many cars you're adding.
Also, in GameSparker, you have to edit the following things:
Find this:
}catch (NoClassDefFoundError localException)
{
return 17;
}catch (Exception localException)
{
return 17;
}
Change the 17 to however many more stages you're adding. Fairly self-explanatory. You also have to change the 17's to the following bits of code:
if(checkpoints.stage == xtgraphics.unlocked && xtgraphics.winner && xtgraphics.unlocked != 17)
if(checkpoints.stage == 17 && xtgraphics.winner)
catchlink(1);
if(checkpoints.stage == 17 && k1 == 10)
xtgraphics.fase = -5;
-
Now, in Madness, you only have to add the stats for the new cars (if you're adding any). In case you don't know where they are, they're at the bottom. Very simple.
-
The final class we need to edit is xtGraphics. There are a ton of things we need to edit here. Let's start at the top - you should see "proba", "outdam", and "dishandle". Just for the sake of your knowledge, "outdam" and "dishandle" are only used for the endurance and handling stat bars, and "proba" is basically the chance of a car appearing in a race ("0" means it will be prioritised first). Add the stats for the new cars in those brackets. See what else you have to do in the spoiler:
Scroll down a bit, and you should see "enginesignature". This is just the sound of the engine the game will play when you drive the car. Like before, add the engines for the new cars. Also, a little further down, you should see the names of the game cars. Add the names of your own new cars.
Scroll down some more until you find "sndsize" and "hipnoload". "Sndsize" is the size of the music file you see when the music is loading for each stage. Note that it doesn't actually read how big the music file is, it just displays any number you put in if you like. Add the "sndsize" for the new stages. Do the same for hipnoload (which I think is something to do with loading stage music, though I'm not sure).
Now, search for "void loadmusic". Just below it, you should see this:
if(i == unlocked && (i == 1 || i == 2 || i == 3 || i == 4 || i == 7 || i == 8 || i == 9 || i == 10 || i == 12 || i == 13 || i == 16)
{
flag = true;
}
You can edit this if you want - it's only if you want the tips before each stage to be displayed in your new stages. Add stages you want tips to be added to in the future if you want.
More importantly, below, you will see something like this:
if(i == 1)
{
stracks[0].loadMod(130, 8000, 125, sunny, macn);
}
if(i == 2)
{
stracks[1].loadMod(260, 7200, 125, sunny, macn);
}
if(i == 3)
{
stracks[2].loadMod(270, 8000, 125, sunny, macn);
}
if(i == 4)
{
stracks[3].loadMod(190, 8000, 125, sunny, macn);
}
etc....
These are the soundtracks for your new stages. Follow the pattern above and add these for your stages. For reference, the first value in the brackets after "loadMod" is the volume, so edit that if you want to.
Now, search for "void finish". Find this at the top:
if(checkpoints.stage != 17)
{
rd.drawImage(congrd, 200, 30, null);
drawcs(80, "Stage " + checkpoints.stage + " Completed!", 170, 170, 170, 3);
Just change the 17 to the amount of stages you will have. Simple. Below, you will see something like this:
if(checkpoints.stage == 2)
{
byte0 = 8;
i = 265;
pin = 0;
sc[0] = 8;
}
if(checkpoints.stage == 4)
{
byte0 = 9;
i = 240;
pin = 0;
sc[0] = 9;
}
At the bottom of that, type something like this:
if(checkpoints.stage == 18)
{
byte0 = 16;
i = 200;
pin = 0;
}
The things you need to worry about are the stage number, and "byte0" (which is the car number - 15 is Dr. Monstaa). The code means if you complete stage 18, unlock the 17th car (i.e. the first new car). Edit and add these things as appropriate.
Near the bottom of this void, find this:
if(checkpoints.stage == unlocked && winner && unlocked != 17)
{
checkpoints.stage++;
unlocked++;
}
Change the 17 to...you know what.
The next void you should see is sortcars. This is basically what cars appear in what stage. Change any 17s to however many stages you're adding. This means that they would appear randomly on any stage, depending on their "proba" value (assuming they are unlocked, although I haven't tested this), or at the front if it's their own "boss" stages.
Now find "void stageselect". Find all of the "checkpoints.stage != 17" and replace them with...once again, I don't have to say it.
Let's go to "public xtGraphics" now, search it. Find this:
stracks = new RadicalMod[17];
loadedt = new boolean[17];
Change the 17's.
At the bottom, change the 17 in "while(++i < 17)".
Bored yet? We're almost done. Find "void stopallnow", and change the 17 at the top.
Now, find this:
if(control.right)
{
control.right = false;
if(sc[0] != 15 && flipo == 0)
{
if(flatrstart > 1)
{
flatrstart = 0;
}
nextc = true;
flipo = 20;
}
}
Change the 15 to however many cars you're adding. Remember the cars start at 0, not 1 (so 0 is Tornado Shark, 1 is Formula 7, etc.)
Now, find this:
if(checkpoints.stage != 17)
{
rd.drawImage(next[pnext], 560, 110, null);
}
Change the 17.
Finally, find "void run" and change the 17, also at the top. That finishes it.
After all that, we're not quite finished yet. Go back to Gamesparker, and find this:
if(s1.startsWith("maxr"))
{
int j2 = getint("maxr", s1, 0);
int j3 = getint("maxr", s1, 1);
i = j3;
int j4 = getint("maxr", s1, 2);
for(int j5 = 0; j5 < j2; j5++)
{
aconto[nob] = new ContO(aconto1[45], j3, medium.ground - aconto1[45].grat, j5 * 4800 + j4, 0);
nob++;
}
trackers.y[trackers.nt] = -5000;
trackers.rady[trackers.nt] = 7100;
trackers.x[trackers.nt] = j3 + 500;
trackers.radx[trackers.nt] = 600;
trackers.z[trackers.nt] = ((j2 * 4800) / 2 + j4) - 2400;
trackers.radz[trackers.nt] = (j2 * 4800) / 2;
trackers.xy[trackers.nt] = 90;
trackers.zy[trackers.nt] = 0;
trackers.dam[trackers.nt] = 1;
trackers.nt++;
}
if(s1.startsWith("maxl"))
{
int k2 = getint("maxl", s1, 0);
int k3 = getint("maxl", s1, 1);
j = k3;
int k4 = getint("maxl", s1, 2);
for(int k5 = 0; k5 < k2; k5++)
{
aconto[nob] = new ContO(aconto1[45], k3, medium.ground - aconto1[45].grat, k5 * 4800 + k4, 0);
nob++;
}
trackers.y[trackers.nt] = -5000;
trackers.rady[trackers.nt] = 7100;
trackers.x[trackers.nt] = k3 - 500;
trackers.radx[trackers.nt] = 600;
trackers.z[trackers.nt] = ((k2 * 4800) / 2 + k4) - 2400;
trackers.radz[trackers.nt] = (k2 * 4800) / 2;
trackers.xy[trackers.nt] = -90;
trackers.zy[trackers.nt] = 0;
trackers.dam[trackers.nt] = 1;
trackers.nt++;
}
if(s1.startsWith("maxt"))
{
int l2 = getint("maxt", s1, 0);
int l3 = getint("maxt", s1, 1);
k = l3;
int l4 = getint("maxt", s1, 2);
for(int l5 = 0; l5 < l2; l5++)
{
aconto[nob] = new ContO(aconto1[45], l5 * 4800 + l4, medium.ground - aconto1[45].grat, l3, 90);
nob++;
}
trackers.y[trackers.nt] = -5000;
trackers.rady[trackers.nt] = 7100;
trackers.z[trackers.nt] = l3 + 500;
trackers.radz[trackers.nt] = 600;
trackers.x[trackers.nt] = ((l2 * 4800) / 2 + l4) - 2400;
trackers.radx[trackers.nt] = (l2 * 4800) / 2;
trackers.zy[trackers.nt] = 90;
trackers.xy[trackers.nt] = 0;
trackers.dam[trackers.nt] = 1;
trackers.nt++;
}
if(s1.startsWith("maxb"))
{
int i3 = getint("maxb", s1, 0);
int i4 = getint("maxb", s1, 1);
l = i4;
int i5 = getint("maxb", s1, 2);
for(int i6 = 0; i6 < i3; i6++)
{
aconto[nob] = new ContO(aconto1[45], i6 * 4800 + i5, medium.ground - aconto1[45].grat, i4, 90);
nob++;
}
trackers.y[trackers.nt] = -5000;
trackers.rady[trackers.nt] = 7100;
trackers.z[trackers.nt] = i4 - 500;
trackers.radz[trackers.nt] = 600;
trackers.x[trackers.nt] = ((i3 * 4800) / 2 + i5) - 2400;
trackers.radx[trackers.nt] = (i3 * 4800) / 2;
trackers.zy[trackers.nt] = -90;
trackers.xy[trackers.nt] = 0;
trackers.dam[trackers.nt] = 1;
trackers.nt++;
}
Change the 45's to however many cars you're adding (so if you're adding 1 more car, change this to 46). Do the same for every "max" you find there (i.e. do this for "maxt", "maxb", and "maxl"). (Credits to ACVoong for finding this). Also, scroll up a bit until you see something like this:
int k1 = getint("set", s1, 0);
On the end of the line, just after the brackets, put a plus sign followed by the amount of cars you are adding. Do the same under the following if statements:
if(s1.startsWith("chk"))
if(s1.startsWith("fix"))
Let me know if you find any issues - this took ages to type up, I won't be surprised if there's a mistake somewhere.
Optional things:
-
If you read everything, you'll probably notice that I said something about the tips for the new stages. If you DO want tips for your new stages, go back to the place and add something like "i == 18" to the if statement, depending on what stages you want there to be tips. Now go to "void hipnoload" and near the top you should see a similar sort of if statement. Do the same you did above and add them here. A little below you should see loads of text with the "rd.drawString" function, which you can do as well for the new tips for the stages.
-
If you followed the tutorial exactly, the new cars should appear in a stage randomly, and boss cars for the new cars will work fine. However, if you want to control what cars appear in what stages (including the new ones), type something like this:
if(i == 18)
{
sc[2] = 16;
if(sc[0] == 16)
{
sc[2] = 15;
}
}
This code basically means the 2nd starting car of a race will be the first new car on stage 18 (if that's the furthest you've unlocked), but if you are the first new car, the 2nd starting car will be Dr. Monstaa. Pretty simple - feel free to experiment!
- You can add AI tweaks to your new stages. If you want them to race, find this:
float f2 = (float)((checkpoints.pos[madness.im] + 1) * (5 - checkpoints.posi4])) / f1;
Add a new code, something like this:
if(checkpoints.stage == *insertstagehere*)
{
float f2 = 0.0F;
}
This code means that in that stage, every car will race. If you want them to waste, you can change the "0.0F" to a much higher number, like "50.0F" (which means they will race at first, but almost immediately begin wasting). Or, you could make them only target you, in that case, type this and replace the "float f2" value in the code above:
attack = 100000;
You can also extend the hacks further by typing codes where everyone will waste, but certain cars will waste (use the "madness.cn" value for that).
If this tutorial doesn't work for you, try watching the video tutorial: https://www.youtube.com/watch?v=-yho-JgAU2g