Yeah I've also made it so it changes parts for "all slots" rather than based on the current config's slots, because it was causing me trouble for a few vehicles. I'm also thinking of changing the "tuning"/JBeam variables for a future update and also colors would be cool too. --- Post updated --- And it looks like the mod didn't get approved yet so most likely tomorrow it will come out.
Finally had the time to check the update. Amazing results, works way better than old one! Here's what I got: Moonhawk with twincharged Vivace engine and bus transmission and sound, powered by E85 fuel hauling a 2 ton trailer, it's ultra slow due to giant turbo lag (15hp until 2000RPM and then suddenly 500hp lol) Military D-Series that is normally super slow but becomes super fast with nitrous Mattress transport Diesel Maluch Twincharged SBR4 with flail Weirdest Pigeon ever Crawler of death that drives WAY better than you might expect Zombie apocalypse taxi turbo lag Bluebuck 2000hp derby Grand Marshal that does AWD burnouts on idle lol Wendover that looks like a legit config I would make for one of my mods T-Series designed by TastiCola inc. to destroy Bepis trucks Mad Max cola delivery Barstow Race Miramar with 600hp twincharged Bolide engine swap And basically a combination of the above, race 200BX with caravan full of rocks, roof bars stuff, wheelie bar, twincharged 300hp Maluch engine swap, T-Series transmission, police light bar, turbo lag, and burnouts that explode the tires lmao So basically, working great! Would be cool if it could pick the same final drive for front and rear diff somehow, and if it randomized the colors and variables too, but still it doesn't need this to be one of the best mods ever!
Would it be possible to add a button to scramble visuals only and not touch anything in the engine, transmission, differentials, etc.? For when you want to have a crazy looking car that is actually fast, or you want to scramble your default but not make it slower, or if you want to race some AI that have the same specs as you but look different.
I could try to add an option to only randomize non-drivetrain parts (including removing parts) + only randomize drivetrain parts for the next update.
I found an error in the code. Code: ... local rand_num = v.min + (v.max - v.min) * math.random() rand_num = math.floor(rand_num / v.step) * v.step; val_only_vars[k] = rand_num ... If the variable in tuning is from 0 to 1 with a step of 1, then with this code 1 will never fall out. Since when rounding to the bottom, even the number 0.999999 will become 0 To fix this, you can do this: Code: local multiplier = 10 ^ (#((tostring(v.step)):gsub("(%p)", "")) - 1) local rand_num = math.random(v.min * multiplier, v.max * multiplier) / multiplier rand_num = math.abs(math.ceil(rand_num / v.step - 0.5) * v.step) val_only_vars[k] = rand_num Well, or just replace Code: rand_num = math.floor(rand_num / v.step) * v.step; on Code: rand_num = math.abs(math.ceil(rand_num / v.step - 0.5) * v.step)
Sometimes the mod makes a coreSlot empty when scrambling a body, this shouldn't happen. You should add a check for it. Also, make it not change the frame, because that is buggy and half of the time throws errors on body on frame vehicles like D-Series, and also the Barstow which has a subframe that has the engine. The frame changing also means that on the D-Series and Hopper the suspension is changed when it selects the crawler frames, so it changes the wheels and diffs. You should make it also unable to remove the chassis on vehicles like the Bolide. And also add radiator support to the powertrain parts list because it removes it half of the time and you have no radiator then. But aside from these issues this is the best update, racing randomised AI is so fun now!
Thanks for the code suggestion and I'll use your 2nd solution. I'll have to look into figuring out what slots are core slots since I only made it not remove the body slot because I knew removing that slot would break many vehicles. And the rest sounds mostly doable and thanks for testing the mod out since I spend so much time just debugging my own code that I just get lazy to perform a bunch of test cases
Now most bugs are fixed but 2 still exist: It almost always removes radiator support when scrambling body parts, and with body on frame vehicles and the Bolide it can sometimes remove the body (doesn't happen on unibody cars). Also, exhaust should count as powertrain part since it can make a big difference in power in low powered cars like the Pigeon
Hmm that's strange that it can modify the radiator support slot since I put the radiator/radiator support as part of the drivetrain list so it shouldn't be swapping it. But yeah I did notice it can remove the body off those body on frame vehicles but I didn't know if people wanted it like that or not so I just left it like that, but I can make it not remove it. And I also added the exhaust to powertrain list but sounds like its not working
If the code searches by the internal part names, then you should write "radsupport" for radiator, and also add different types of exhaust parts like "header", "stack", "manifold", "pipe", "turbo", "muffler", etc. Search through vanilla vehicles to see what they are called in each one. Also on some cars transmission is called "transaxle" or "gearbox" so add these too
I found error If there are no variables in the vehicle, an error appears in the console. To fix this, you can use Code: if vars then else return end before Code: for k, v in pairs(vars) do ... end