Page MenuHomeFeedback Tracker

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

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.