Jump to content
Sign in to follow this  
AlexVestin

Realistic helicopter crashes. (Need some guidance)

Recommended Posts

I have looked around but could not find anything after searching for an entire day. I've tried the related scripts I've found, and I've tried testing stuff with eventHandlers.

There are some cheap ways helicopter crashes have been faked by scripting, but none I've found have been desirable (or rather realistic).

Here's the desired outcome.

1. Helicopter takes damage like normal.
2. Helicopter goes down.
3. Helicopter does not explode on impact.
4. Crew takes damage like normal.

I want to test something that sounds like it'd work rather simple, but I do not know exactly how to execute it. It'd kinda work in the order listed below.

1. Helicopter takes damage like normal.
If damage goes above 0.9, set it to 0.9


2. Helicopter goes down.
Once the damage has gone above 0.9, destroy the engine, main rotor and tail rotor to force it down.
(A helicopter with only damage set to 0.9 is still flyable.)

3. Helicopter does not explode on impact.
The helicopter would before impact with anything set "this allowDamage false".
(Disabling further damage prevents the explosion, but also the rotors from being destroyed when touching objects/ground etc. (Step 2 above must be done before disabling damage.)

4. Crew takes damage like normal
Will work just like it does normally. If the helicopter has crew inside of it, they'll still take normal damage on crashing into things.

To simplify it even some more:

If helicopter damage above 0.9, set it to 0.9, destroy engine, rotor and disallow further damage.

I've been trying some stuff and something seems off.

Added this to the init of a helicopter:

this addEventHandler ["Dammaged", {if ((_this select 2) > 0.1) then {hint "bananas";};}];

I thought this would execute if the helicopter has damage above 0.1

I fired a few round at the helicopter, and surely, the hint with "bananas" showed after doing so.

It took 6-7 MX rifle rounds and nothing in the interior of the helicopter showed any kind of damage to the modules. Still as expected.

Now. I changed the number.

this addEventHandler ["Dammaged", {if ((_this select 2) > 0.9) then {hint "bananas";};}];

I thought this would execute if the helicopter is at 0.9 damage, wich is a lot and should have the helicopter barely flying.

The only difference now is that it took about 14-15 rounds for the hint to come up, but the helicopter still showed no sign of damage at all.

Then I tried going even higher and doing this:

this addEventHandler ["Dammaged", {if ((_this select 2) > 1.0) then {hint "bananas";};}];

Now it all of a sudden took 4-5 magazines fired at the helicopter, with no real damage done, and no hint even came up. I only added +0.1 to the value and the changes were drastic now.

/I have no idea what I am doing.

Edited by AlexVestin

Share this post


Link to post
Share on other sites

tl;dr; Not possible to heli disable explosion on collision, it is hardcoded and not controllable with HandleDamage.

From my experience its not possible to stop helicopters from exploding from impact without disabling damage completely with allowDamage false (which also disables event handlers like HandleDamage leaving you blind about incoming damage). Basically HandleDamage event handler IS NOT fired when helicopter receives heavy collision damage as well as some other damages (like when main rotor touches solid surfaces, it breaks rotor and instantly turns off the engine making helicopter fall like a rock), this is indeed a problem and a bug and I was too lazy to report it on feedback tracker (unless reported already).

To understand my point, place a helicopter in editor and add to init line:

eh = this addEventHandler ["HandleDamage", {0}];

In theory this should disable ANY damage in ALL cases. Try it with helicopter and test two unhandled damage cases that I described above: heavy collision and touching buildings\trees\ground with main rotor, you will still explode\get damage even though HandleDamage supposed to handle it.

Adding same code to say plane will make it invincible even if you hit ground nose down at 500 kmh.

Share this post


Link to post
Share on other sites

This is something which should work. You probably need to add some more selections (some are for vehicles so you can remove those).

_vehicle addEventHandler ["HandleDamage", {_this call OnVehicleHit}];

OnVehicleHit = {
_vehicle = _this select 0;
_selectionName = _this select 1;
_damage = _this select 2;
_source = _this select 3;
_returnVal = 0;

_maxDamage = 1;

switch (_selectionName) do 
{
	case "HitLFWheel": { _maxDamage = 1};
	case "HitLF2Wheel": { _maxDamage = 1};
	case "HitRFWheel": { _maxDamage = 1};
	case "HitRF2Wheel": { _maxDamage = 1};

	case "HitRBWheel": { _maxDamage = 1};
	case "HitLBWheel": { _maxDamage = 1};

	case "HitReserveWheel": { _maxDamage = 1};

	case "HitFuel": { _maxDamage = 0.9};
	case "HitEngine": { _maxDamage = 1};
	case "HitEngine2": { _maxDamage = 1};
	case "HitEngine3": { _maxDamage = 1};
	case "HitBody": { _maxDamage = 0.9};
	case "HitHull": { _maxDamage = 0.9};

	case "HitTransmission": { _maxDamage = 1}; 
	case "HitHydraulics": { _maxDamage = 1}; 
	case "HitTransmission": { _maxDamage = 1}; 

	case "HitLight ": { _maxDamage = 1}; 
	case "Light_R ": { _maxDamage = 1}; 
	case "Light_R2 ": { _maxDamage = 1}; 
	case "Light_L ": { _maxDamage = 1}; 
	case "Light_L2 ": { _maxDamage = 1}; 

	case "HitGlass1": { _maxDamage = 1};
	case "HitGlass2": { _maxDamage = 1};
	case "HitGlass3": { _maxDamage = 1};
	case "HitGlass4": { _maxDamage = 1};
	case "HitGlass5": { _maxDamage = 1};
	case "HitGlass6": { _maxDamage = 1};
	case "HitRGlass": { _maxDamage = 1};
	case "HitLGlass": { _maxDamage = 1};
};

if(_selectionName == "") then
{
	//Check wether you want to apply damage to null selection. probably not.
}
else
{
	//_currentHitDamage = _vehicle getHitPointDamage _selectionName; 
	if(_damage <= _maxDamage) then
	{
		_vehicle setHit [_selectionName, _damage];
	};
};
};
_returnVal;

Edited by mindstorm

Share this post


Link to post
Share on other sites

Thanks! I will try that and some more today and see if I get anywhere.

Will probably only do these parts:

	case "HitFuel": { _maxDamage = 0.9};
	case "HitEngine": { _maxDamage = 1};

Did something like this earlier and the helicopter would explode endlessly after taking damage:

this addEventHandler ["HandleDamage", {false}];

Check this thread for info on hitpoints. You might only need to damage a few hitpoints to achieve visual the result you want.

Get-hitPoints-for-helicopters

See also this thread. The work might be done for you already...

BangaBob's Survivable Helicopter Crash Script

I did find that script actually, but no matter how well made it is, it's still a very faked crash. There has to be a better alternative with no teleporting etc.

Should be doable, as long as there's a working way to set a max cap for the damage able to be made, no matter what kind of round it is that hits the helicopter or the speed it crashes with.

Edited by AlexVestin

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×