[Release] Realistic Vehicle Failure

…And of course the download link is down at the moment. I’ll try again later and get back to you when I have looked into it.

ok no problem take your time thanks for the timely response.

I can’t get that ELS script to work. Admittedly I know very little about installing stuff on FiveM, and I don’t have time do do a lot of research to find out what additional stuff I need to install to get it to work.

But I had a look at the source code, and found something peculiar.
Line 391 of els-fivem/client/client.lua has this line:

SetVehicleBodyHealth(veh, vehicleHealthBefore)

The vehicleHealthBefore variable isn’t defined anywhere, which means that it sets the vehicleBodyHealth to zero.

It makes absolutely no sense to have that line in there. Without my script, the vehicle will still work, but with my script, it will also kill the engine, due to the multiplication of damage across engine/body/fueltank.

Try commenting out that line by adding – (two minus signs) before the line, like this:

-- SetVehicleBodyHealth(veh, vehicleHealthBefore)

…and restart the els-fivem script. I bet that will solve the problem. Please report back whether it has an effect or not.

1 Like

ok I tried what you said and it kinda worked but then again didn’t. the car no longer is damaged when I turn the lights on however. the vehicle no longer takes damage. I tried to damage the vehicle without the lights on and it gets damaged like normal but as soon as I turn the lights on the damage is repaired and the vehicle becomes indestructible.

1 Like

Really appreciate your help. Let’s continue via PM.

When I have a solution, I’ll announce it here.

2 Likes

New Version Released

Version 1.1.1 adds random tire burst and a new compatibility mode that solves some problems with other scripts.

Compatibility mode is disabled by default, but you can easily enable it in the config file.
Whenever another script sets the health of the vehicle to zero, my script will now ignore the change.
This is known to solve incompatibility with ELS and BVA. Maybe it solves other problems too.

The downside of enabling compatibility mode is that explosions can no longer be prevented.
If you turn off the engine using BVA, a single bullet to the fuel tank can explode the car.

Please note that ELS has a god mode problem (That seems to be rooted in a FiveM bug), where the car repairs itself whenever you have ELS lights on.
There is no workaround for that, since my script can’t see if a repair comes from a trainer, fix script or the ELS bug.

Compatibility Mode for ELS works best if you comment out line 391 in els-fivem/client/client.lua. (els-fivem v1.0.5 only! Don’t do it for other version!) - That line looks like a leftover from an attempt to solve the god mode problem.

Random Tire Burst
When you are driving at above 22mph there is now a risk that a tire will puncture or burst.
In the config file you can disable the feature or you can set the desired interval between tire failures.

Default value of 120 minutes means that on average a tire will burst every two hours.
This is done using statistical probability, so it’s not an exact science. You may puncture twice within half an hour, or you may not have a single puncture for 8 hours.

A huge thanks to Xatamaur for helping me reproduce the ELS problem on my own server.

Get the new version using the link in the first post.

Enjoy!

6 Likes

Good job with the update, especially for ELS.

Is anyone else experiencing an issue with turning the engine off? It just always kicks right back on for me.

What script are you using for engine on/off?
[edit] And is this happening with the newest version of my script, v1.1.1 ?
[edit2] If yes, is this with or without compatibilityMode enabled?

I was able to find which script was conflicting with this and got it fixed. My next question how can I disable the damage on motorcycles. Just riding the police bike around will damage it. Lower numbers in the config means it takes more damage to break or less?

	deformationMultiplier = -1,					-- How much should the vehicle visually deform from a collision. Range 0.0 to 10.0 Where 0.0 is no deformation and 10.0 is 10x deformation. -1 = Don't touch. Visual damage does not sync well to other players.
	deformationExponent = 0.4,					-- How much should the handling file deformation setting be compressed toward 1.0. (Make cars more similar). A value of 1=no change. Lower values will compress more, values above 1 it will expand. Dont set to zero or negative.
	collisionDamageExponent = 0.6,				-- How much should the handling file deformation setting be compressed toward 1.0. (Make cars more similar). A value of 1=no change. Lower values will compress more, values above 1 it will expand. Dont set to zero or negative.
	engineDamageExponent = 0.6,					-- How much should the handling file deformation setting be compressed toward 1.0. (Make cars more similar). A value of 1=no change. Lower values will compress more, values above 1 it will expand. Dont set to zero or negative.
	torqueMultiplierEnabled = true,				-- Decrease engine torge as engine gets more and more damaged
	weaponsDamageMultiplier = 0.01,				-- How much damage should the vehicle get from weapons fire. Range 0.0 to 10.0, where 0.0 is no damage and 10.0 is 10x damage. -1 = don't touch
	damageFactorEngine = 1.0,					-- Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10
	damageFactorBody = 1.0,						-- Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10
	damageFactorPetrolTank = 20.0,				-- Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 64
	cascadingFailureSpeedFactor = 4.0,			-- Sane values are 1 to 100. When vehicle health drops below a certain point, cascading failure sets in, and the health drops rapidly until the vehicle dies. Higher values means faster failure. A good starting point is 8
	degradingHealthSpeedFactor = 3,			-- Speed of slowly degrading health, but not failure. Value of 10 means that it will take about 0.25 second per health point, so degradation from 800 to 305 will take about 2 minutes of clean driving. Higher values means faster degradation
	degradingFailureThreshold = 800.0,			-- Below this value, slow health degradation will set in
	cascadingFailureThreshold = 260.0,			-- Below this value, health cascading failure will set in
	engineSafeGuard = 100.0,					-- Final failure value. Set it too high, and the vehicle won't smoke when disabled. Set too low, and the car will catch fire from a single bullet to the engine. At health 100 a typical car can take 3-4 bullets to the engine before catching fire.
	displayBlips = true,						-- Show blips for mechanics locations
	preventVehicleFlip = false,					-- If true, you can't turn over an upside down vehicle
	sundayDriver = false,						-- If true, the accelerator response is scaled to enable easy slow driving. Will not prevent full throttle. Does not work with binary accelerators like a keyboard. Set to false to disable. The included stop-without-reversing and brake-light-hold feature does also work for keyboards.
	sundayDriverAcceleratorCurve = 7.5,			-- The response curve to apply to the accelerator. Range 0.0 to 10.0. Higher values enables easier slow driving, meaning more pressure on the throttle is required to accelerate forward. Does nothing for keyboard drivers
	sundayDriverBrakeCurve = 5.0,				-- The response curve to apply to the Brake. Range 0.0 to 10.0. Higher values enables easier braking, meaning more pressure on the throttle is required to brake hard. Does nothing for keyboard drivers

	-- Class Damagefactor Multiplier
	-- The damageFactor for engine, body and Petroltank will be multiplied by this value, depending on vehicle class
	-- Use it to increase or decrease damage for each class

	classDamageMultiplier = {
		[0] = 	1.0,		--	0: Compacts
				0.5,		--	1: Sedans
				0.5,		--	2: SUVs
				0.5,		--	3: Coupes
				0.5,		--	4: Muscle
				0.5,		--	5: Sports Classics
				0.5,		--	6: Sports
				0.5,		--	7: Super
				0.0,		--	8: Motorcycles
				0.1,		--	9: Off-road
				0.25,		--	10: Industrial
				0.5,		--	11: Utility
				0.5,		--	12: Vans
				0.0,		--	13: Cycles
				0.5,		--	14: Boats
				0.5,		--	15: Helicopters
				0.5,		--	16: Planes
				0.5,		--	17: Service
				0.5,		--	18: Emergency
				0.5,		--	19: Military
				0.5,		--	20: Commercial
				0.5			--	21: Trains
	}
}```

Everything is detailed, i guess you’re kidding, right ?

1 Like

It still appears to have conflict issues with ELS. With comp-ability mode equaling the value of 1, my vehicles still die / turn off / begin smoking.

the reason Im confirming is…making a change doesn’t seem to reflect in game.

MrDaGree’s ELS 1.04 works just fine with this script, and BVA seems to be handling it nicely as well. I’m not running compatibility mode either.

My fault - I had ELS start after the damage script, putting the damage script before having ELS start resolved the issue.

Please elaborate, it might help someone in the same situation. Thanks.

While it might seem like a stupid question on the surface, I get why you can be in doubt when changes to the values doesn’t reflect your in-game experience. Besides, I didn’t explain what a value of 0.0 means. It’s not obvious at all.

Lower numbers for classDamageMultiplier means less damage.
0.0 means “Near the normal GTA damage amount” (Exponent values still has an effect)
1.0 means “Standard damage as calculated by this script”
2.0 means “Twice as much as 1.0” :wink:

I just tested a bike with 0.25 (Default in my script) and 0.0 and the difference is significant.

If it doesn’t work for you, some other script could perhaps interfere?

It seems like the main Achilles heel in my script is other scripts doing weird stuff. :innocent:

A good debugging tool is the F4 trainer, Vehicle Options, page 2, Vehicle Health Display. Visualizes what is going on behind the scenes.

Thank you both. Valuable information.

Any chance you add a way to deeply modify driving instead of modifying handlings (NPC’s going crazy with modified handling)? I’m thinking of brakes mostly, i think i’ve already seen a factor for curves and accelerations.

I think i also have a piece of code from myself that could interest you. I will PM you when i have time.

We do slightly use a modified version of this script. We do not use BVA so it has to be an incompatibility in our side which we will modify, if we do find a bug I will notify you :ok_hand:

1 Like

governors aren’t standard on road-legal cars. the only vehicles it comes standard on are rental trucks such as uhaul or budget. as well as some car rental places will do this to their high-end vehicles.

1 Like

Most cars will also have a limiter set in the ECU and have it not be a physical device