When using eventhandler handleheal in an MP enviroment you cannot get a return from a player healing a player
only on a player healing himself.
Description
Details
- Legacy ID
- 1804590771
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 7
- Category
- Scripting
have 2 players on a server trying to heal each other with an alterd handleheal EH with diag_log reports.
then get them to heal them selves using the same reports.
you will notice the reports only get sent when healing yourself.
player removeAllEventHandlers "HandleHeal";
//player addEventHandler ["HandleHeal", dr_handle_healing];
dr_handle_healing =
{
diag_log "inside dr_handle_healing"; private ["_unit", "_healer", "_medic", "_damage"]; _unit = _this select 0; _healer = _this select 1; _medic = _this select 2; _damage = 0.4; if (_medic) then { // Medic has beter healing _damage = 0.2; }; if (damage _unit > _damage) then { _unit setDamage _damage; diag_log format ["unit %1 is healed by %2 to damage %3", _unit, _healer, _damage]; systemchat format ["unit %1 is healed by %2 to damage %3", _unit, _healer, _damage]; }; // AISFinishHeal [_unit, _healer, _medic]; //true;
};
player addEventHandler ["HandleHeal", dr_handle_healing];
Event Timeline
I can confirm this. The eventhandler is not being fired when a player heals another player in a multiplayer mission, only when the player heals himself.
Also the third argument healercanheal is always false. When a medic heals himself it should be true.
Try assigning EH to the injured on the healer PC. Run this code before you heal another player:
{
_x addEventHandler ["HandleHeal", {
player sideChat str [name (_this select 0), _this];
}];
} forEach allUnits;
It should fire when you start healing him.
Hello killZone Kid.
First thank you.
I am unsure what you mean exactly or how it differs from what we do, so I will explain how we call the EH.
In the initPlayerLocal.sqf we do :-
call compileFinal preprocessFileLineNumbers "core\FAR_revive\FAR_revive_init.sqf";
In the FAR_revive_init.sqf we do :-
call compile preprocessFile "core\FAR_revive\FAR_revive_funcs.sqf";
player removeAllEventHandlers "HandleHeal";
player addEventHandler ["HandleHeal", dr_handle_healing];
In the FAR_revive_funcs.sqf, we have the function dr_handle_healing ={}; as posted in the first additional information post.
I don't see how what we do differs from running a foreach allunits.
But we will try your example :)
I just thought I should explain our process first.
The code with allunits is just to test if it works for you, as it does for me. For some reason the event handler has to be assigned on the healer pc to the injured for it to fire when you heal the injured. It will fire on your pc obviouly. If you expect it to fire for injured on his pc when someone is healing him, this doesnt work.
Hello,
thank you for submitting the ticket. Could you please upload a repro mission for two players? It would help us a lot.
Thank you very much!
I have the same issue in my mission. The eventHandler doesn't appear to fire when one player (as a medic or not) attempts to heal another player when using the FAK, but it does fire when healing self.
HangleHeal should be attached to the injured and will only be triggered where healer is LOCAL. So adding it in init field of the unit is ok