Page MenuHomeFeedback Tracker

"HandleDamage" Event Handler with return value of "0" fails to negate damage on air vehicles while in-flight
Closed, ResolvedPublic

Description

Using the below on a helicopter (haven't tested with other aircraft types) while the helicopter is in flight does not negate the non-scripted damage that should be negated when the Event Handler's code returns "0". It does however negate the damage if the helicopter is stationary on the ground.

_unit addEventHandler ["HandleDamage", {0}];

More details can be found here:
https://forums.bohemia.net/forums/topic/205515-handledamage-event-handler-explained/?page=2&tab=comments#comment-3333776
https://forums.bohemia.net/forums/topic/205515-handledamage-event-handler-explained/?page=2&tab=comments#comment-3346171

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
Windows 10 Pro x64 v1809
Category
Scripting
Steps To Reproduce

Execute the following code on a helicopter:

_vehicle addEventHandler ["HandleDamage", {0}];

Crash the helicopter into the ground or shoot a rocket at it while it's in flight.

Additional Information

For reference, this is the script I was trying to write when I found that this issue was present:

this addEventHandler ["handleDamage", {
	_unit = _this select 0;
	_damage = _this select 2;
	_source = _this select 3;
	if (_source == _unit && (damage _unit + _damage) > 0.99) then {
		_unit setDamage 0.99;
	} else {
		_unit setDamage (damage _unit) + _damage;
	};
	0;
}];

Event Timeline

Drift_91 created this task.May 25 2019, 7:06 AM
This comment was removed by Dwarden.
This comment was removed by Dwarden.
This comment was removed by Dwarden.
Wulf added a subscriber: Wulf.Feb 24 2020, 11:11 AM

Helicopters in flight are invulnerable. Could someone please confirm this is fixed as well?

@Wulf I'm still able to reproduce the bug with the following mission in hosted MP on dev branch.

This comment was removed by Dwarden.

@Wulf This is still reproducible in the 1.98 update that released yesterday.

I've made the reproduction mission more complex. For some reason it seems damage _helicopter; returns 0 even after it starts loosing power and until the helicopter's been completely destroyed. So I'm assuming it's only allowing the damage through to individual hitpoints.

Wulf added a comment.Apr 15 2020, 10:51 AM

Talked to Design. And my suspicions were confirmed.

Regarding the Damage via collision with an object or ground. There are certain exceptions for Helicopters and Planes in regards to Handle Damage and alas we can't change that I am afraid.

Wulf added a comment.Apr 15 2020, 10:56 AM

Also the Heli and the AI are separate objects meaning you need to use Handle Damage on them separately. If you jsut use the HD on just the heli you can still kill the crew piloting it, meaning it will drop to the ground and crash. Solution is then to make both the heli and the AI piloting it invulnerable then the heli will not crash to the ground.

Wulf closed this task as Resolved.EditedApr 15 2020, 10:57 AM
Wulf claimed this task.

Closing as this most likely won't be changed.