Page MenuHomeFeedback Tracker

Killed-event handler can run twice for the same entity
Acknowledged, NormalPublic

Description

If setDamage 1 command is used inside a HandleDamage event handler, the Killed event may be raised twice.

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 7 x64
Operating System Version
A3 v1.96.146114 x64
Category
Scripting
Steps To Reproduce
  1. Add this to the editor init box of some AI:
this addEventHandler ["HandleDamage", {
    if (param [7] isEqualTo "hitface") then {
        param [0] setDamage 1;
    } else {0};
}];

this addEventHandler ["Killed", {
    systemChat str ["Killed", _this];
}];
  1. Preview the mission and shoot them in the head.

It will print in chat:

["Killed",[B Alpha 1-2:1,B Alpha 1-2:1,<NULL-object>,true]]
["Killed",[B Alpha 1-2:1,B Alpha 1-1:1 (OGefr. commy2),B Alpha 1-1:1 (OGefr. commy2),true]]

Event Timeline

dedmen added a subscriber: dedmen.Feb 28 2020, 8:49 PM
dedmen claimed this task.Tue, Mar 24, 3:31 PM
dedmen changed the task status from New to Acknowledged.