Jump to content
avibird 1

Need help to add medical tent heal function to other buildings

Recommended Posts

Medical tents work but military cargo house or HQ (medical) buildings do not. Even though under object hold action there are codes under the icon idle icon progress which is the same code in the medical tent. 

 

Why does the military cargo buildings medical  do not work is there a simple code I can put in to allow them to heal units. 

Share this post


Link to post
Share on other sites

In init of asset

_null = [this, 10, 0.10, 2] execVM "heal.sqf";

Heal.sqf

private["_obj","_radius","_healPerSleep","_damage","_sleepTime"];
_obj = _this select 0;
_radius = _this select 1;
_healPerSleep = _this select 2;
_sleepTime = _this select 3;
if (isServer) then
{
	while {true} do
	{
		{
			if (alive _x) then
			{
				_damage = damage _x;
				_damage = _damage - _healPerSleep;
				if (_damage < 0) then
				{
					_damage = 0;
				};
				_x setDamage _damage;
			};
		}
		forEach ((getPos _obj) nearEntities [["Man"], _radius]);
		sleep _sleepTime;
	};
};

I recall using this a long time ago. Not tested recently.

  • 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

×