Open Slaughterias opened 2 years ago
I'm not 100% sure right now, but i think some of things you want can be changed only via VehicleScript
, meaning it will affect all vehicles of given type. Plus there's a chance it will work only on newly spawned vehicles, so yeah...
Only one i'm pretty confident can be changed easily is wheel friction (via VehiclePart
)
I'd recommend to skim BaseVehicle and VehiclePart first to see what sits in game engine by simply checking functions names. Or go step further and decompile java code yourself :P
That said, java code around vehicles is tricky. There is some interesting stuff out there which could potentially spawn interesting mods, but it's "hidden" behind functions/classes not exposed to lua, or kept inside VehicleScript
which has a high chance to make mod unplayable in multiplayer, depends what you are doing with that.
I see! Yes I've been looking through it and tried to use vehicle:setenginePower = (), which successfully changes the value within the mechanics window. But as soon as you start the car and drive, it will change the value back to whatever is in the template. Makes me wonder if i'm missing something obvious I'd have to do in order to to actually update the vehicle itself.
I have noticed however that if you've got a engine quality of, say 15%, it will divide the engine power relative to that value. (Not gonna bother to do the math right now). This makes me wonder if it's possible to change the quality and use that instead, and maybe mitigate the "Chance to start". This really doesn't feel like an ideal solution though.
A third option i'm thinking of is the debug "Set script" which changes the entire vehicle, but that will also reroll the condition of the vehicle as well as color hue and attached parts, which is not an option since i've got about 15 different visual attachments on my mod at this point. But maybe there's a way to have the vehicle load another engine template, whilst keeping everything else the same.
Thank you for the reply, I'll update you if I find a way.
Another thing I just thought about was the Speed Demon trait which increases maxspeed and enginepower among other things, so maybe have the update tied to the character driving as opposed to the vehicle itself?
Update: I've decompiled BaseVehicle and VehicleParts in order to figure out my options. The i've found out that the core is constantly updating handling from the original template, so if you try to change any values it will instantly flip them back over to the original. I'm not sure how possible it is to work around this but I'm sure as hell gonna try, mainly through these methods:
Have the different templates depending on tuning and have it copy all of the attachments and conditions over to the new template, then replace the old vehicle completely. I'm not sure how to do with inventory though, as I'm currently not aware of any way to copy inventory contents like that.
Have the different tunes register as traits while you are in the drivers seat, using the same method as Speed Demon. A possible issue with this is how it will mess with other traits, since I've had experiences with some traits getting removed while others are being added/removed through debug.
Another thing I've looked into is colored headlights, the same issue applies here, vehicles use "CreateSpotLight" which is seperate from other lightsources, and does not have a float for colors. But I'm wondering if I can at least create the illusion of colored headlights through normal lightsources, or at least some form of underglow.
Sorry if I'm bombarding you with information you have no interest in, I'm just leaving it here because I'd be more than happy to let you include that code in this library if I manage to work something out.
Hi! I'm working on a mod using this library, I understand the functions and can make use of them. However, I'm just starting to learn lua and I'm wondering if you know if it's possible for me to change some strings in order to create functions to set other vehicle values, specifically: -EngineForce -EngineRPM / gearRatio -wheelFriction -steeringIncrement -steeringClamp
I intend to attach these function to either parts, radial menu or both.
Any input would be greatly appreciated! Thanks for making this library available.
-Edit: I thought i posted this in questions, my bad.