Bug #18027

handleDamage EH assigned to vehicles triggers multiple times for ""

Added by Deadfast almost 4 years ago. Updated over 3 years ago.

Status:Assigned Start date:03/03/2011
Priority:Normal Due date:06/01/2011
Assignee:Dwarden % Done:

0%

Category:Event Handlers
Target version:-
Affected ArmA II version:1.58.78473 First affected build:
Reproduced by another DH user:Yes First affected ArmA II version:
I am using some Mods:No Single / Multi Player?:
I am using:CO (A2+OA) BIForumURL:
Reproducible for you:Yes NGUrl:
Related to content of DLC: WIKIurl:

Description

Event handler handleDamage that is assigned to a vehicle can have the structural damage ("") fired several per damage received under some circumstances. The same can happen with event handlers assigned to the vehicle's crew.

Example situation #1 - empty car (handleDmg1.Desert_E):
  1. An empty HMMWV (HMMWV_DES_EP1) named car placed on the map, init line: this addEventHandler ["handleDamage", {diag_log text format["%1 damaged (%3): %2", _this select 0, _this select 2, str (_this select 1)]; _this select 2}];
  2. Player unit placed on the map, init line: this addEventHandler ["fired", {diag_log text "-------------------------------"}];
  3. Player fires at different parts of the HMMWV several times
  4. arma2oa.RPT reveals that in some cases one bullet triggered the EH twice:
    -------------------------------
    car damaged (""): 0.00102828
    car damaged (""): 0.00204206
    -------------------------------
    car damaged (""): 0.00233487
    -------------------------------
    car damaged (""): 0.00482677
    car damaged ("glass1"): 0
    car damaged ("glass2"): 0
    car damaged ("glass3"): 0
    car damaged ("glass4"): 0
    car damaged ("wheel_1_1_steering"): 0.0997587
    car damaged ("wheel_1_2_steering"): 0
    car damaged ("wheel_2_1_steering"): 0
    car damaged ("wheel_2_2_steering"): 0
    car damaged ("?"): 0
    car damaged ("?"): 0
    car damaged ("?"): 0
    car damaged ("?"): 0
    car damaged ("karoserie"): 0.0220419
    car damaged (""): 0.0049819
    
Example situation #2 - car with a driver (handleDmg2.Desert_E):
  1. An empty HMMWV (HMMWV_DES_EP1) named car placed on the map, init line: this addEventHandler ["handleDamage", {diag_log text format["%1 damaged (%3): %2", _this select 0, _this select 2, str (_this select 1)]; _this select 2}];
  2. An AI unit (US_Soldier_EP1) named car_driver placed on the map, init line: this moveInDriver car; this addEventHandler ["handleDamage", {diag_log text format["%1 damaged (%3): %2", _this select 0, _this select 2, str (_this select 1)]; _this select 2}];
  3. Player unit placed on the map, init line: this addEventHandler ["fired", {diag_log text "-------------------------------"}];
  4. Player fires at different parts of the HMMWV several times making sure not to hit the driver directly
  5. arma2oa.RPT reveals that in some cases one bullet triggered the EH twice for both the HMMWV and its driver:
    -------------------------------
    car damaged (""): 0.00820782
    car damaged (""): 0.00922528
    car_driver damaged (""): 0.00535512
    car_driver damaged (""): 0.00632566
    -------------------------------
    car damaged (""): 0.00926146
    car damaged (""): 0.00938344
    car_driver damaged (""): 0.00634652
    car_driver damaged (""): 0.00644044
    -------------------------------
    car damaged (""): 0.0134835
    car damaged ("glass1"): 0
    car damaged ("glass2"): 0
    car damaged ("glass3"): 0
    car damaged ("glass4"): 0
    car damaged ("wheel_1_1_steering"): 0.0100434
    car damaged ("wheel_1_2_steering"): 0
    car damaged ("wheel_2_1_steering"): 0
    car damaged ("wheel_2_2_steering"): 0
    car damaged ("?"): 0
    car damaged ("?"): 0
    car damaged ("?"): 0
    car damaged ("?"): 0
    car damaged ("karoserie"): 0.0333133
    car_driver damaged (""): 0.00911246
    
This is a great problem for damage-handling scripts. Even the game's own First Aid: Simulation is affected. This can easily be demonstrated using the following steps (handleDmgFAS.Desert_E):
  1. An empty HMMWV (HMMWV_DES_EP1) named car placed on the map
  2. An AI unit (US_Soldier_EP1) named car_driver placed on the map, init line: this moveInDriver car;
  3. First Aid: Simulation placed on the map, synchronized with car_driver
  4. Player unit placed on the map
  5. Player fires several (~3 SCAR-L's) magazines into the HMMWV's engine block
  6. car_driver dies, vehicle still operable

handleDmg_reproMissions.zip - 3 missions reproducing the issues mentioned above (2.7 kB) Deadfast, 03/03/2011 17:35


Related issues

related to ARMA2 Community Issue Tracker - Bug #13644: Aircrafts ignore handleDamage EH and allowDamage command... Assigned 09/11/2010
related to ARMA2 Community Issue Tracker - Bug #10118: handleDamage does not prevent 'suppressive affect' that a... Assigned 04/15/2010 03/01/2011
related to ARMA2 Community Issue Tracker - Bug #16413: Dammaged/HandleDamage EHs stop working on buildings after... Assigned 01/03/2011 04/03/2011
related to ARMA2 Community Issue Tracker - Bug #22226: HandleDamage triggers twice on self damage Rejected 07/11/2011
related to ARMA2 Community Issue Tracker - Feature #20946: Import get/setHitPointDamage commands from TKOH Assigned 06/27/2011
related to ARMA2 Community Issue Tracker - Bug #22250: HandleDamage ignores return value from exitWith Assigned 07/12/2011 10/12/2011

History

Updated by Deadfast almost 4 years ago

Sorry, accidentally selected the wrong game version, should be 1.57.76815

Updated by kju almost 4 years ago

  • Due date set to 06/01/2011
  • Status changed from New to Assigned
  • Assignee set to Dwarden
  • Reproduced by another DH user changed from No to Yes

It is also in 1.58 RC - so all fine.

You may wanna explain why it is a great problem handling scripts.
Yes it adds some more damage - anything else that worries you?

PS: It seems to happen only when no selection are involved when hitting the object.

Updated by Deadfast almost 4 years ago

Thanks for confirming it.

Since it is the overall damage received that is duplicated this does not only add some more, it can add up twice as much. If you use this damage during your handling having it multiplied 2 times can get you some unpleasant results.

As for your second point, no, it does not only happen when no selections are triggered. The first log dump shows that most, if not all selections of the Hummer were affected and yet it fired twice (IIRC I was shooting at the rear left door).

Updated by Sickboy almost 4 years ago

Receiving the same or increasing damage should be no problem.
Without a handleDamage EH, or if you return damage (>0) in the handleDamage EH, then some of the parts will accumulate damage.
So multiple triggerings of the damage EH, resulting in e.g 0.6, 0.6, 0.7 damage for "" part, in fact means:
0.6, 0, 0.1

In the handleDamage EH on Man-based units, "", Head and Body accumulate. While Hands and Legs always returns the diff-damage instead.
If you return 0 at "", Head or Body, then obviously the next damage registered is diff-damage too.

Updated by Deadfast almost 4 years ago

I'm not sure I follow?

Updated by Sickboy almost 4 years ago

The damage always increases, so when you record the previous damage of the parts which accumulate damage, you get the actual damage inflicted from that hit.
Perhaps the second triggering of the event is when the projectile exits the vehicle.

car damaged (""): 0.00*10*2828
car damaged (""): 0.00*20*4206. Actual damage is 0.00204206 - 0.00102828 = 0.00101378
-------------------------------
car damaged (""): 0.00*48*2677
car damaged (""): 0.00*49*819. Actual damage is 0.0049819 - 0.00482677 = 0.00015513
-------------------------------
car damaged (""): 0.00*82*0782
car damaged (""): 0.00*92*2528
-------------------------------
car damaged (""): 0.00*92*6146
car damaged (""): 0.00*93*8344

But perhaps i misunderstood what you meant :)

Updated by Deadfast almost 4 years ago

No, you understood correctly. I was just never aware of this fact and frankly why it differs part from part makes no sense to me. Is there kind of system to this?

This can now be closed. Sorry.

Updated by kju almost 4 years ago

Well it is not certain that it is the case - It may or may not be.

Updated by Deadfast over 3 years ago

OK, I finally figured this one out. Turns out there is a serious issue indeed, it has to do with the event handler assigned to the crew though.

May I post it as a new ticket? That would save you the hassle of editing pretty much the entire thing.

Updated by kju over 3 years ago

yep new ticket sounds good

Also available in: Atom PDF