Page MenuHomeFeedback Tracker

HadleHeal EH Doesnt work in multiplayer
Closed, ResolvedPublic

Description

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.

Details

Legacy ID
1804590771
Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 7
Category
Scripting
Steps To Reproduce

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.

Additional Information

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

BL1P edited Steps To Reproduce. (Show Details)Apr 21 2014, 6:57 PM
BL1P edited Additional Information. (Show Details)
BL1P set Category to Scripting.
BL1P set Reproducibility to Always.
BL1P set Severity to None.
BL1P set Resolution to Open.
BL1P set Legacy ID to 1804590771.May 7 2016, 6:28 PM

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.

BL1P added a subscriber: BL1P.May 7 2016, 6:28 PM
BL1P added a comment.Apr 24 2014, 10:22 AM

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.

BIS_fnc_KK added a subscriber: BIS_fnc_KK.EditedJul 30 2024, 10:48 PM

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

BIS_fnc_KK closed this task as Resolved.Jul 30 2024, 10:49 PM
BIS_fnc_KK updated the task description. (Show Details)
BIS_fnc_KK edited Steps To Reproduce. (Show Details)
BIS_fnc_KK edited Additional Information. (Show Details)
BIS_fnc_KK set Operating System to Windows 7.