[Release] Realistic Vehicle Failure

New version released

Version 1.0 adds Limp Mode.

Limp mode is disabled by default.
If enabled, the vehicle will not die completely. Instead it will slow down a lot, enabling you to drive to the nearest mechanic. That is, unless the mechanic is uphill, then the engine may not have enough torque to make it there.

You can still /repair once or twice to fix the engine just enough to be drivable at a reasonable speed.

The config file also has an optional alternative set of settings provided by ImDylan93, giving a different balance between cars, and some more resilience to damage.

Since no bugs have been found (yet) in the previous beta, and the limp mode was the final feature I had planned, and a very simple feature to implement, I decided to end the beta series and jump straight to version 1.0.

Enjoy!

Sometimes vehicles, stop/get damaged for no reason?

Remove the vehicle=lastVehicle and the other variables that get copied.

That would just prevent the damage multiplication. Kind of defeats the purpose of this script.

Itā€™s a feature, not a bug.
In real life, when you damage a vehicle, thereā€™s a risk of fluids leaking. The vehicle may still be drivable, but at some point the engine will die from a lack of oil or coolant.
In other words: Time of accident is not necessarily equal to time of engine death.

You can adjust the way this works by changing degradingFailureThreshold and cascadingFailureThreshold in the config file.
You canā€™t disable that feature entirely, since some other stuff depends on their values, but if If you set them to 120.0 and 110.0 respectively theyā€™re pretty much without effect.

Feature request for future update. Ability to set vehicle class to a repair point. For instance, setting repair points at PDā€™s that only emergency class vehicles can use or boat repair points, etc.

Iā€™m still on an older version because, well, itā€™s not broken LOL and have many custom repair points, including PDā€™s and Fire Houses. I would love it if my civs were not able to use those.

This is causing an issue with my current esx setup, once a mechanic repairs a car, he gets back to his own car and his own breaks.

No reason, just breaks.

At first I thought it was due to addon vehicles but then police cars did too and I think it is due to data being saved on player and the player transfers the damage to the next car he hops in.

Although looking at the code it doesnā€™t look like it should do that.

Any ideas on why is it happening, itā€™s driving me crazyā€¦ tried everything.

I donā€™t change anything about the ped, so it must be something with the vehicle.

I havenā€™t got the time to install and configure ESX and plugins to debug this right now, but I have a hunch about the cause.

Try this:

  1. Disable my script.
  2. In the F4 trainer on page 2 of vehicle options you enable display of vehicle health.
  3. A new healthy car has a health of 1000 in each category.
  4. Exit the car, repair another vehicle and reenter the car, and see if health changes.
  5. (Do the same test with my script enabled)

If the health changes, thereā€™s the problem. My script watches for changes in vehicle health in each category, multiplies them, takes the largest number and subtracts it from engine health.
Thatā€™s why BVA 2.01 doesnā€™t play nice with my script since it sets the fuel tank health to 0, and my guess is that ESX or a plug-in does something similar.

I donā€™t have any trainers.

Is there a way to have a separate damage config for emergency vehicles? They need a buff badly. Great work BTW!!

Thanks.
The answer is yes, sort of.
You can change the classDamageMultiplier value for emergency vehicles. Itā€™s line 71 in the config file.
If the value is 1.0 emergency vehicles get the normal amount of damage as configured above.
A value of 0.5 means half the damage and 2.0 means twice the damage etc.

Thatā€™s as good as it gets at the moment. Theoretically it would be possible to do completely separate configs for each class, but that would also make thing extremely complicated to configure.
Itā€™s more than complicated enough as it is.

Okay great! Thank you! Great reply time :slight_smile:

Any way you could at a command that does fix the vehicle fully just for admins or something? Because its kind of annoying if you an admin and you have to go to the mechanic, Thanks

I have tried a couple of /fix scripts and a couple of trainers, and they all worked just fine to fully fix a vehicle without going to a mechanic. That is actually the reason I chose ā€˜/repairā€™ instead of ā€˜/fixā€™ for my script.

When time permits I might do something to integrate the functionality into the script.

1 Like

What about making it so it when you do /repair it takes about 15 sec to repair.

You say its normal but it shouldnā€™t be normal, why does the car randomly break, you get out and get back in and it will smoke. You say its because the damage drop thing but the damage should only go down if you crash not if you just drive around, like your car doesnā€™t overheat after 10 minutes of driving.

I donā€™t believe Iā€™ve said that cars breaking randomly is normal.
I guess thereā€™s usually one of two problems at play.

  1. Incompatibility with other scripts.
    If another script modifies the damage values, weird stuff happens. I know for a fact that BVA (better vehicle actions) does that. And it makes no sense that they would do that.
    I donā€™t have a solution for that problem. At least not yet.

  2. Not understanding what the script does.
    You can crash, then keep driving for some amount of time while the oil drains, and then the car dies.
    That would seem like a randomly breaking engine if you donā€™t know that itā€™s supposed to be like that.

Problem 1 is the most likely, but Iā€™ve seen people claim the script is buggy when it turned out they just didnā€™t know how it worked.

The DOJ guys seem to be using a slightly modified version of the script now, and from what Iā€™ve seen on their YouTube videos it works just fine for them.
Only once since they started using it, have I seen something that could possibly be a glitch; Jeff coming back to his police car after /dvā€™ing another car, and itā€™s dead for no apparent reason.
Could be theyā€™re just using an older version of the script.
Could be a bug that I havenā€™t found yet.
Donā€™t know.

Thank you for your suggestion and your interest in the project.
I thought about it and decided against trying to satisfy any specific role-playing requirements people might have. Thereā€™s just so many different needs and requirements that I couldnā€™t possibly satisfy everyone.

Iā€™ve concentrated on solving the basic problem of making vehicles fail in a more realistic manner.
The script is open source, enabling you to put in your own tweaks and functionality.
If you do, please share with the community.

Yeah thats what Im saying, you will get out your car and get back in after like 2 minutes and NOT being a damaged vehicle it will randomly smoke and break. I see it in his videos too.

It may have happened again. Iā€™m just halfway through a new Polecat Live video where it looks like it happened to him too.
Iā€™m not claiming that the script is bug-free, but unfortunately I am unable to replicate the problem here. Canā€™t fix a problem I canā€™t replicate.

I have been able to provoke a similar problem by installing BVA 2.01.
BVA modifies the health of the vehicle when shutting on or off the engine which breaks my script. Iā€™ve listed that as an incompatible mod.

This all leads me to believe that there may be an issue with another script that modifies the damage values.
It would be of great help if you could perform the diagnostics I outlined in this post and report back.

Sure will give me tomorrow to do it. I have to setup a new server anyways tomorrow and your script was ordered to be taken out because of the breaking randomly. Ill try and fix it and see the issue.