I do have some questions too about this EventHandler. I'm a programmer and know how to write code ;)
Accoring to wiki:
So i did write a test EventHandler... to figure out how the EventHandler really works. But if i return nothing or return 0, the unit gets dmg form somewhere else.
Here is the Code of my EventHandler:
private ["_unit", "_selectionName", "_damage", "_source", "_projectile"];
_unit = _this select 0;
_selectionName = _this select 1;
_damage = _this select 2;
_source = _this select 3;
_projectile = _this select 4;
diag_log format ["T=%1 : %2", time, _this];
diag_log format ["T=%1 : %2", time, (damage _unit)];
_return = 0;
_return;
And here is the log-file:
"T=0.778 : [b Alpha 1-1:1 (Nydi),"head",0.226505,<NULL-object>,"B_65x39_Caseless_green"]"
"T=0.778 : 0"
"T=0.778 : [b Alpha 1-1:1 (Nydi),"",0.0891562,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=0.778 : 0"
"T=0.796 : [b Alpha 1-1:1 (Nydi),"",0.0891562,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=0.796 : 0"
"T=0.796 : [b Alpha 1-1:1 (Nydi),"head",0.226505,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=0.796 : 0.0891562"
"T=1.07 : [b Alpha 1-1:1 (Nydi),"head",0.24937,<NULL-object>,"B_65x39_Caseless_green"]"
"T=1.07 : 0.0891562"
"T=1.07 : [b Alpha 1-1:1 (Nydi),"",0.0170202,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=1.07 : 0.0891562"
"T=1.088 : [b Alpha 1-1:1 (Nydi),"",0.106176,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=1.088 : 0.0891562"
"T=1.088 : [b Alpha 1-1:1 (Nydi),"head",0.24937,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=1.088 : 0.106176"
"T=1.218 : [b Alpha 1-1:1 (Nydi),"head",0.286202,<NULL-object>,"B_65x39_Caseless_green"]"
"T=1.218 : 0.106176"
"T=1.218 : [b Alpha 1-1:1 (Nydi),"",0.136091,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=1.218 : 0.106176"
"T=1.238 : [b Alpha 1-1:1 (Nydi),"",0.242268,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=1.238 : 0.106176"
"T=1.238 : [b Alpha 1-1:1 (Nydi),"head",0.286202,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=1.238 : 0.242268"
"T=1.238 : [b Alpha 1-1:1 (Nydi),"body",0.0159503,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=1.238 : 0.242268"
"T=1.238 : [b Alpha 1-1:1 (Nydi),"hands",0.021167,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=1.238 : 0.242268"
"T=1.393 : [b Alpha 1-1:1 (Nydi),"head",0.286202,<NULL-object>,"B_65x39_Caseless_green"]"
"T=1.393 : 0.242268"
"T=1.393 : [b Alpha 1-1:1 (Nydi),"",0.018026,O Alpha 1-1:1,"B_65x39_Caseless_green"]"
"T=1.393 : 0.242268"
As you can see... the unit gets hurt from somewhere and the value increases from damage _unit.
Can someone explain me from where the unit gets hurt?
[Edit]
I tried the Workaround to set the damage with _unit setDamage 0; it seems to work, the unit seems to be invulnerable if i add this line.
But not allways, if i shoot directly in the head it ends in a death.
I'll try to set up a Advanced Injury System, where is more then the revive scripts we have till now.
[/Edit]
[Edit]
I did found this bug tracker: http://feedback.arma3.com/view.php?id=6644
All the problems, and unexpected behaviour maybe related to this issue? What you think?
Founded Workarounds:
waitUntil {!isNil {player getVariable "BIS_fnc_feedback_hitArrayHandler"}}; player addEventHandler [ "handleDamage", { // Your own handling here... } ]; [/Code] [Code] waitUntil {!isNil {player getVariable "BIS_fnc_feedback_hitArrayHandler"}}; player removeAllEventHandlers "handleDamage"; player addEventHandler [ "handleDamage", { BIS_hitArray = _this; BIS_wasHit = true; // For BIS stuff to work // Your own handling here... } ]; [/Code] And i tried both, they work... till i still get some crapy parameters with <Null-Object> or that the same event is fired twice in different frames. [/Edit] Thanks in advanced.