[Release] Realistic Vehicle Failure

vehicle
realistic

#56

Still can’t find that sweet spot I tried the numbers both ways… Head on into a wall at 80mph should totally destroy a prius. What do you recommend?


#57

Are you planning any new features ?


#58

If you increase the damagefactors, the car will sustain more damage. To totally destroy a Dilettante at 80 mph these values will do the trick. Haven’t had time to test other cars, so some may damage too easily and other may still be too tough.

	damageFactorEngine = 16.0
	damageFactorBody = 16.0
	damageFactorPetrolTank = 150.0

Some cars are more sensitive to engine damage, others to body damage, and still other to fuel tank damage.
It seems like fuel tank (called Petrol Tank to be consistent with the game code) is the most consistent across vehicles. More testing needed.

Two planned, when time permits:

  1. Better default values in config. Perhaps the option to choose from a few presets, since no setting will be perfect for every user.
  2. Limp mode: If enabled the car will never destroy completely, but will be able to drive slowly to the nearest mechanic.

#59

Odd my current settings are:
damageFactorEngine = 80.0, – Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10
damageFactorBody = 85.0, – Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10
damageFactorPetrolTank = 60.0,

I was hitting headon with Semis, walls, guard rails. it ran out of fuel before becoming destroyed. I don’t get it.

PS I don’t have any other vehicle damage scripts running not even a hud. I took that out to see if it was the issue. Still no good after a clear and restart.


#60

That sounds like the script isn’t even active.

I can think of a couple of scenarios where this might happen:

1: The script has crashed
2: One or more of your settings are causing it to ignore the damage settings.

First off, if you have enabled the Sunday Driver feature, drive forward, then brake, and keep on braking and see if the car is standing still after stopping. If it goes into reverse by itself, the script is not running for some reason.

The second point is related to my laziness… I haven’t implemented checks for incorrect settings (yet). If you set some of the config settings to an integer where a floating point value is expected, FiveM will “ignore” some native calls.
For example a value of 10 may not work, while 10.0 will work. The settings you showed here looks fine, but other settings may be bad. It’s an easy mistake to make.
(I am confused as to why this happens since lua should handle ints and floats the same, but it may be related to the way calls are made to the native functions. If anyone knows how to handle this, please let me know)

If you comment out some of the settings (Thinking you don’t want or need them), the script will probably crash.

Also remember that you should not reload the script while in a car, since that may cause weird behavior. If you do, just spawn or steal a new car before testing.

If all else fails, send all your settings to me in a PM, and I will try them out here.

Update: Settings were fine, a reinstall of FiveM fixed the problems.


#61

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!


#62

Sometimes vehicles, stop/get damaged for no reason?


#63

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


#64

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.


#65

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.


#66

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.


#67

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.


#68

I don’t have any trainers.


#69

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


#70

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.


#71

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


#73

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


#74

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.


#75

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


#76

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.