Jump to content
johnnyboy

Fully heal using medkit [solved]

Recommended Posts

I find it annoying that when healing using first aid kit, the player is only 75% healed, which means you have to listen to the player moaning and groaning forever until he can be healed by a medic (by a medkit).

 

A mission maker can solve this for you by using the eventhandler below.  With this eventHandler, player is always healed 100% when healing.   I'm using this in my new mission Last Tango in Tanoa 2: Razing Cane.  Hopefully someone else will find this useful.

 

I can't take credit for this, as I think I found the example somewhere (a post or wiki?), but I don't remember where.  So my apologies to the original author.

player addEventHandler ["HandleHeal", {
	_this spawn {
		params ["_injured","_healer"];
		_damage = damage _injured;
		if (_injured == _healer) then {
			waitUntil {damage _injured != _damage};
			if (damage _injured < _damage) then {
				_injured setDamage 0;
			};
		};
	};
}];

 

  • Like 4

Share this post


Link to post
Share on other sites

Does this work if someone else is healing you?

 

I also read this

Quote

If unit walks away from the healer during healing action, the heal will not finish but there is no way to detect this within "HandleHeal" framework.

So if removing this line if (_injured == _healer) then and adding something like this to the waitUntil, waitUntil {damage _injured != _damage || _healer distance2d _injured > 5};

 

Will it work?

Share this post


Link to post
Share on other sites
1 hour ago, Robustcolor said:

Does this work if someone else is healing you?

 

I also read this

So if removing this line if (_injured == _healer) then and adding something like this to the waitUntil, waitUntil {damage _injured != _damage || _healer distance2d _injured > 5};

 

Will it work?

In your example when a unit finishes healing you, the 100% heal will trigger when damage changes OR distance between you and your healer is more than 5 meters, I assume you want the full heal only when damage is reduced and healer is close. If so,

 

this addEventHandler ["HandleHeal", { 
    _this spawn { 
    params ["_injured", "_healer"]; 
    private _damage = damage _injured;
    waitUntil { ((damage _injured != _damage) && (_healer distance2d _injured < 5))}; 
    if (damage _injured < _damage) then { 
        _injured setDamage 0; 
        }; 
    }; 
}];

will do the job.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×