Jump to content

Recommended Posts

2 minutes ago, pierremgi said:

Hmm, not normal. The script above is tested in SP/ MP hosted. At least, you should fall unconscious. The healing is more complex, and needs extra-conditions like a bro unit within 200m. Do you have any other script for healing units (like ACE or other mod)?

What I suggest you is to recopy/paste all the code in init.sqf. Don't bother with an sqf or place it a mission root. The "calling" line can be in init.sqf either. You don't need a trigger for that.

No other script for healing. I'm gonna try re-copy-paste the code directly to the init.sqf as you suggested. I'll report back asap.

Thank you.

Share this post


Link to post
Share on other sites

HAHAHA..something funny it's going on here...

I run the code directly from init.sqf...now I get the incapacitated status, but nobody come to heal/revive me. However, if the medic/buddy is close by..I get revived from 10/15 meters away... without any animation or the AI coming close..

WTFK????..LOL

Share this post


Link to post
Share on other sites
3 hours ago, zagor64bz said:

HAHAHA..something funny it's going on here...

I run the code directly from init.sqf...now I get the incapacitated status, but nobody come to heal/revive me. However, if the medic/buddy is close by..I get revived from 10/15 meters away... without any animation or the AI coming close..

WTFK????..LOL

To be healed or not depends on parameters and that can take some time. If no unit is available during the respawn time, you revive (SP) or die (MP).

It's a temporary choice. Why?

Because most of the time, SP missions don't allow team switch (conceived with one switchable/playable unit). Then, if you die, mission is over.

On the other hand, in MP, most of the mission are written with respawn system. So, there is no problem to let let a player die.

You can play solo in multiplayer.

I'll have a check at SP healing.

  • Thanks 1

Share this post


Link to post
Share on other sites

Read through this but not fully understanding. Is this to allow AI on your team to revive you or does allow the enemy AI to basically use the revive system ? 

Share this post


Link to post
Share on other sites
13 hours ago, rz22g said:

Read through this but not fully understanding. Is this to allow AI on your team to revive you or does allow the enemy AI to basically use the revive system ? 

 

Allowing AIs (group or side, or bunch of) FRIENDLY units to revive you. SP/MP. You can also revive your AI fellows if you want.

Sometimes it's faster than waiting for an AI unit.

Share this post


Link to post
Share on other sites
12 hours ago, avibird 1 said:

@pierremgi   Just curious why don't you ever post  your scripts on  armaholic  or Steamwork shop.

 

I used to post on Armaholic (I even initiated the "script library" menu) but I disagree with the "boss" policy.

Believe me, it's far more easy to post something here. Just follow my red tag.

I post missions (most of them for friends only) and mods on steam workshop.

I plan a new mod with some scripts (the more useful) and abandon some secondary ones like enhanced map or custom GPS, too complex HUD...

 

As far as this script (REVIVE/HEAL) is concerned, I will issue a new version in few days, more reliable.

I'm struggling with some "new?" behavior: You loose the leadership when you're unconscious (normal) but, sometimes, you can't recover it! The engine loops for the AI leader who give infinite orders without any possibility to override this. Boring!

 

  • Thanks 2

Share this post


Link to post
Share on other sites
8 hours ago, pierremgi said:

You loose the leadership when you're unconscious (normal) but, sometimes, you can't recover it! The engine loops for the AI leader who give infinite orders without any possibility to override this.

I noticed that yesterday during a run of my campaign. I thought it was something on my end ( not setting thing up correctly).

I better wait for update before touching anything then.

Thank you Pierre. 

Share this post


Link to post
Share on other sites
2 hours ago, zagor64bz said:

I noticed that yesterday during a run of my campaign. I thought it was something on my end ( not setting thing up correctly).

I better wait for update before touching anything then.

Thank you Pierre. 

 

Thanks for your feedback. You save my time also.

  • Like 1

Share this post


Link to post
Share on other sites
title = "---------------------- AI Revive ----------------------";
		values[] = {-99999};
		default = -99999;
		texts[] = {""};
		};
		
			class REACT
			{
			title = "Max number of seconds to choose best healer";
			values[] = {5, 15, 30, 60, 120};
			texts[] = {"5", "15", "30", "60", "120"};
			default = 120;
			};
			
			class HEAL_DELAY
			{
			title = "Max number of seconds for heal action, remaining time from bleeding out";
			values[] = {60, 120, 150, 200, 300, 400};
			texts[] = {"60","120","150", "200", "300", "400"};
			default = 120;
			};
			
			class AI_CAN_REVIVE
			{
			title = "Can AI Revive";
			values[] = {1,0};
			texts[] = {"True","False"};
			default = 1;
			};
			
			class AI_KIT
			{
			title = "What kind of kit is needed to revive";
			values[] = {0,1,2};
			texts[] = {"no kit needed, no limit for revive","need a first aid kit (FAK) , 1 FAK is removed per reviving action","need a medic kit (mediKit) , 1 FAK is removed per reviving action, can heal even if no more FAK"};
			default = 1;
			};
		
			class NEED_MEDIC
			{
			title = "Medic trait needed to revive";
			values[] = {1,0};
			texts[] = {"Enabled","Disabled"};
			default = 0;
			};
			
			class Bros
			{
			title = "Side of who can be revived";
			values[] = {1,0};
			texts[] = {"playableUnits + switchableUnits","west"};
			default = 1;
			};

Does this look correct for lobby params? I am not getting any errors.

Share this post


Link to post
Share on other sites
8 hours ago, Jnr4817 said:

title = "---------------------- AI Revive ----------------------";
		values[] = {-99999};
		default = -99999;
		texts[] = {""};
		};
		
			class REACT
			{
			title = "Max number of seconds to choose best healer";
			values[] = {5, 15, 30, 60, 120};
			texts[] = {"5", "15", "30", "60", "120"};
			default = 120;
			};
			
			class HEAL_DELAY
			{
			title = "Max number of seconds for heal action, remaining time from bleeding out";
			values[] = {60, 120, 150, 200, 300, 400};
			texts[] = {"60","120","150", "200", "300", "400"};
			default = 120;
			};
			
			class AI_CAN_REVIVE
			{
			title = "Can AI Revive";
			values[] = {1,0};
			texts[] = {"True","False"};
			default = 1;
			};
			
			class AI_KIT
			{
			title = "What kind of kit is needed to revive";
			values[] = {0,1,2};
			texts[] = {"no kit needed, no limit for revive","need a first aid kit (FAK) , 1 FAK is removed per reviving action","need a medic kit (mediKit) , 1 FAK is removed per reviving action, can heal even if no more FAK"};
			default = 1;
			};
		
			class NEED_MEDIC
			{
			title = "Medic trait needed to revive";
			values[] = {1,0};
			texts[] = {"Enabled","Disabled"};
			default = 0;
			};
			
			class Bros
			{
			title = "Side of who can be revived";
			values[] = {1,0};
			texts[] = {"playableUnits + switchableUnits","west"};
			default = 1;
			};

Does this look correct for lobby params? I am not getting any errors.

 

I'm no expert but this has always worked for me,


        class EmptySpace
        {
        title="----Title break whatever you want------------------";
        values[]={0,0};
        texts[]={ "",""};
        default = 0;
        };


        class REACT

        {

        title = "Max number of seconds to choose best healer";

        values[] = {5, 15, 30, 60, 120};

        texts[] = {"5", "15", "30", "60", "120"};

        default = 120; };

        code = "";
        };

  • Like 1

Share this post


Link to post
Share on other sites

Reworked. Some big explosions let too many non-healed units.

 

  • Thanks 1

Share this post


Link to post
Share on other sites

I really like this script.

 

It's clever how you've made the medic temporarily a civilian so he ignores combat and just runs straight to the incapacitated soldier, avoiding all the typical AI combat behaviour. 

 

However, it can lead to some funny situations in close quarters combat where a medic charges straight into the middle of the enemy, who just ignore him while he revives someone right under their noses.

  • Like 1

Share this post


Link to post
Share on other sites

Little mod on medic (stop after regroup). Seems to be better for further order.

Share this post


Link to post
Share on other sites

Thanks for this, have you considered turning this into an addon so it runs on any mission played and not only self-created ones?

Share this post


Link to post
Share on other sites
5 minutes ago, vastiny said:

Thanks for this, have you considered turning this into an addon so it runs on any mission played and not only self-created ones?

Yes, but "wasting my time" with some other topics.

Share this post


Link to post
Share on other sites

@pierremgi you know that overall all the help and mods / scripts you do are appreciated and welcomed. There will always unfortunately be the ungrateful #$&@$&$* that dont deserve anything. Hope you dont let it stop the good work you do here

  • Like 3

Share this post


Link to post
Share on other sites

@pierremgi I may have found a bug when using this script today: I was driving a vehicle when I was shot and I was ejected from the vehicle and lay unconscious on the ground.

 

My team-mates ejected too but none of them came to my aid, so I eventually bled out and had to respawn even though they had dealt with all the nearby threats.

 

The funny thing was, just as I died, the temporary squad leader said to the medic: "Heal that Squad Leader!"

 

Share this post


Link to post
Share on other sites
13 hours ago, dreadpirate said:

@pierremgi I may have found a bug when using this script today: I was driving a vehicle when I was shot and I was ejected from the vehicle and lay unconscious on the ground.

 

My team-mates ejected too but none of them came to my aid, so I eventually bled out and had to respawn even though they had dealt with all the nearby threats.

 

The funny thing was, just as I died, the temporary squad leader said to the medic: "Heal that Squad Leader!"

 

 

No bug so far. If there is no bro to help you within 200 m, or all unconscious, no mean to help you. You have to respawn... sometimes.

Bi "unconsciousness" (state :f:) is absolutely weird. An AI leader takes command of the group and yell some ridiculous orders to alive or unconscious units as well!

Usually "target this man" or "X, driver, get in that vehicle" even if there is no fuel, a broken engine or no more tires". Not saying a gunner is most of the time, a best place than a driver in combat mode!

As you can see, even if unconscious, you're still able to command the support modules. Bi thought about menus but the modules actions.

 

For sure, BI totally missed the handover between leaders (player > AI). The normal way should be the AI in charge should complete some player's command and not try to jump into any rotten vehicle!

Have fun anyway.

Share this post


Link to post
Share on other sites

@pierremgi All my squadmates were conscious and well within 200m and they stood near my body and watched me die. 

 

BI obviously intended for the revive system to be for players only, so you've done really well to make it work with AI as well as you have.....

Share this post


Link to post
Share on other sites
2 minutes ago, dreadpirate said:

@pierremgi All my squadmates were conscious and well within 200m and they stood near my body and watched me die. 

 

BI obviously intended for the revive system to be for players only, so you've done really well to make it work with AI as well as you have.....

 

I'll see this point. Probably something to improve. I didn't reproduce that but I'm rather sure there are some missing cases in my script, especially with multiple hits, explosion, during healing, for medics or wounded.

 

You're right: "The revive system can be for players only". You can say "whole players groups only", with no AI leader possibility at all!

Share this post


Link to post
Share on other sites

Hi,

Here is a new version for this script. Totally reworked for MP liability after respawn.

This script is more "server oriented". The main problem was the dispatching of the units along with the players (locality of units), and all commands able to be triggered locally or on server).

This version should work far better than the previous one. If, as usual, players and AIs can respawn/revive (furthermore, the script doesn't override the mission respawn/revive for players ). You'd experience some problem to be healed after a respawn in my actual version (front page).

 

So, I don't want to immediately replace the released version by this new code. I share the new code here if some of you would be so kind as to test it before declaring it as "official".

Of course, any comment for MP dedicated server is welcome, but also for SP usage and improvements.

 

to be continued:

I'm aware that some AIs leaving a player's group to heal some others guys (declared as bros of course), then back to the group, can be questionable. If not a problem for groups of Ais, a player would like to keep the choice to order one subordinate to heal or not some other guys (wounded players or not).

Automatic healing or ordered healing? I guess there are as much answer as players.

Automatic is fine because you don't need to check for that, no forgotten action, no complicated/overflown action menu.

Ordered healing is OK for the player's group supervision...

So? An addAction autoHeal on / autoHeal off ? concerning the units of the group?

Thanks for some suggestion I'd like not to hard to script. (There are so many cases!).

 

New script, in init.sqf:
 

Spoiler

 


MGI_fn_EHDamage = {
  params ["_unit"];
  _unit addEventHandler ["handleDamage", {
    params ["_unit","","_dam"];
    if (side _unit != sideEnemy) then {
      private _veh = objectParent _unit;
      if (!isnull _veh  && isNil {_veh getVariable "incVeh"} && (damage _veh > 0.7 or (!canfire _veh && !canMove _veh) or _dam > 0.7)) then {
        _veh setVariable ["incVeh",true,true];
        _crew = +(crew _veh);
        call {
          if (_dam > 0.7 && {objectParent _unit isKindOf "air"} && {getPosATL _veh select 2 > 30}) exitWith {
            [_unit,_veh] spawn {
              params ["_unit","_veh"];
              waitUntil {isTouchingGround _veh};
              [_unit,_veh] call MGI_fn_BailOut;
            };
          };
          if (damage _veh > 0.7 or (!canMove _veh && !canFire _veh)) exitWith {
            {
              [_x,_veh] spawn MGI_fn_BailOut
            } forEach _crew;
          };
          if (_dam >0.7) then {
            [_unit,_veh] spawn MGI_fn_BailOut;
          };
        };
      };
      if (isNull objectParent _unit && {(count allPlayers == 1 && isPlayer _unit) or MGI_AiRevive}) then {
        if !(_unit getVariable ["uncsious",false]) then {
          _unit setVariable ["uncsious",true,true];
          [_unit, MGI_fn_unconscious] remoteExec ["spawn",2];
        };
      };
      if (!isPlayer _unit or !isMultiplayer) then {_dam min 0.86};
    };
  }];
};

addMissionEventHandler ["entityRespawned",{
  params ["_unit", "_corpse"];
  _unit setVariable ['uncsious',nil,true];
  _unit setVariable ["passedBros",true,true];
  _corpse setVariable ["passedBros",nil,true];
  _unit call MGI_fn_EHDamage;
}];


if (isServer) then {

  MGI_fn_medic = compileFinal "
    _wnded = _this;
    private '_medic';
    _wnded setVariable ['myMedic',nil];
    if (isNull _wnded) exitWith {_medic = objNull};
    private _medics = MGI_potentialMedic  select {
      _x distanceSqr _wnded < 40000
      && !isPlayer _x
      && _x != _wnded
      && alive _x
      && lifeState _x != 'incapacitated'
      && isNil {_x getVariable 'myPatient'}
    };
    call {
      if (isPlayer _wnded) exitWith {
        _medics
      };
      if ({behaviour _x != 'COMBAT'} count _medics > 0) exitWith {
        uiSleep (MGI_react/8);
        _medics = _medics select {behaviour _x != 'COMBAT'};
      };
      if ({(_x targets [true, 300]) isEqualTo []} count _medics > 0) exitWith {
        uiSleep (MGI_react/4);
        _medics = _medics select {(_x targets [true, 300]) isEqualTo []};
      };
      if ({{_x == 'MediKit'} count (items _x) > 0} count _medics > 0) exitWith {
        uiSleep MGI_react/2;
        _medics = _medics select {{_x == 'MediKit'} count (items _x) > 0};
      };
      uiSleep MGI_react;
      _medics;
    };
    _medics = +_medics select {
      _x distanceSqr _wnded < 40000
      && !isPlayer _x
      && _x != _wnded
      && alive _x
      && lifeState _x != 'incapacitated'
      && isNil {_x getVariable 'myPatient'}
    };
    if (count _medics == 0) exitWith {
      _medic = objNull;
      _medic
    };
    _medics = +_medics apply {[str(leader _x == _x),_x distance _wnded, _x]};
    _medics sort true;
    _medic = _medics select 0 select 2;
    _medic setVariable ['myPatient',_wnded];
    _medic setHitPointDamage ['hitLegs',0];
    _wnded setVariable ['myMedic',_medic];
    if (count units _medic > 1) then {
      _medic setVariable ['MGI_AIgrp',group _medic];
    };
    _medic setVariable ['flee',_medic skill 'courage'];
    _medic forceFlagTexture '\A3\Data_F\Flags\Flag_white_CO.paa';
    _medic
  ";

  MGI_fn_medicRelease = compileFinal "
    _medic = _this;
    _medic forceFlagTexture '';
    if (isNull _medic) exitWith {};
    if (!isNil {_medic getVariable 'myPatient'}) then {
    (_medic getVariable 'myPatient') setVariable ['myMedic',nil]};
    _medic setVariable ['myPatient',nil];
    _medic allowFleeing (1 - (_medic getVariable ['flee',0.5]));
    {_medic enableAI _x} count ['target','autotarget','autocombat','suppression'];
    _medic setBehaviour 'AWARE';
    [_medic] joinSilent (_medic getVariable 'MGI_AIgrp');
    if (_medic != leader _medic) then {
      if (local _medic) then {
        _medic doFollow leader _medic
      } else {
        [_medic,leader _medic] remoteExec ['doFollow',_medic]
      }
    };
    _medic spawn {
      _medic = _this;
      uiSleep 12;
      if (!isNull _medic && lifeState _medic != 'incapacitated' && isNil {_medic getVariable 'myPatient'}) then {
        _medic forceFlagTexture '';
        if (local _medic) then {
          _medic setCaptive false
        } else {
          [_medic,false] remoteExec ['setCaptive',_medic]
        };
      };
    };
  ";

  MGI_fn_sortie = compileFinal "
    params ['_wnded','_medic','_timer'];
    call {
      if (lifeState _wnded == 'incapacitated' && diag_tickTime < _timer + MGI_BleedOut) exitWith {
        _azimuth = _medic getDir _wnded;
        _medic setDir _azimuth;
        _medic removeitem 'FirstAidKit';
        call {
          if (stance _medic == 'PRONE') exitWith {
            _medic playMoveNow 'ainvppnemstpslaywrfldnon_medicother';
          };
          _medic playMoveNow 'ainvpknlmstpslaywrfldnon_medicother';
        };
        uiSleep 5;
        if (lifeState _medic != 'incapacitated' && alive _medic) then {
          if (_wnded call BIS_fnc_reviveEnabled) then {
            if (local _wnded) then {
              ['#rev',1,_wnded] call BIS_fnc_reviveOnState;
              uisleep 0.5;
              _wnded setCaptive true;
            } else {
              [['#rev',1,_wnded],BIS_fnc_reviveOnState] remoteExec ['call',_wnded];
              uisleep 0.5;
              [_wnded,true] remoteExec ['setCaptive', _wnded];
            };
          } else {
            _wnded setDamage 0;
            if (local _wnded) then {
              _wnded setUnconscious false
            } else {
              [_wnded,false] remoteExec ['setUnconscious',_wnded]
            };
          };
          {if (['Heal Bros',(_wnded actionParams _x) select 0] call bis_fnc_inString) then {[ _wnded,_x] call BIS_fnc_holdActionRemove}} count (actionIDs _wnded);
          _wnded setVariable ['uncsious',false];
        };
        uiSleep 2;
        _medic call MGI_fn_medicRelease;
        _wnded setVariable ['myMedic',nil];
        if (_wnded getVariable ['uncsious',false]) then {_wnded setVariable ['uncsious',false]};
        {_x setDamage 1} forEach (( _wnded nearEntities ['CAManBase',20]) select {side _x getFriend side _wnded < 0.6 && side _x != civilian});
        uiSleep 10;
        if (local _wnded) then {
          _wnded setCaptive false
        } else {
          [_wnded,false] remoteExec ['setCaptive', _wnded]
        };
      };
      if (lifeState _wnded == 'incapacitated' && diag_tickTime > _timer + MGI_BleedOut) exitWith {};
comment   ""_medic call MGI_fn_medicRelease"";
      if (_wnded getVariable ['uncsious',false]) then {
        _wnded setVariable ['uncsious',false];
      };
    };
  ";

  MGI_fn_checkMedic = compileFinal "
    params ['_wnded','_medic','_timer'];
    uiSleep 2;
    {_check = _x; if (!isnil {_check getVariable 'myPatient'} && {_x getVariable 'myMedic' == _check} count MGI_bros  == 0) then {_check setVariable ['myPatient',nil]; _check forceFlagTexture ''} } forEach MGI_bros;
    while {lifeState _wnded == 'incapacitated' && diag_tickTime < _timer + MGI_BleedOut} do {
      uiSleep 1;
      call {
        if (isnil {_wnded getVariable 'myMedic'}) exitWith {
          _wnded call MGI_fn_medic;
        };
        if (isNull _medic or isnull (_wnded getVariable 'myMedic')) exitWith {
          _wnded call MGI_fn_medic
        };

comment ""  or isNil {_medic getVariable 'myPatient'}"";
        if (lifeState _medic == 'incapacitated') exitWith {
          _medic call MGI_fn_medicRelease;
          _wnded call MGI_fn_medic;
        };
        if (_wnded distance2D _medic < 3 or (_wnded distance2D _medic >3 && unitReady _medic)) exitWith {
          [_wnded,_medic,_timer] spawn {
            params ['_wnded','_medic','_timer'];
            if (_wnded distanceSqr _medic > 9) then {
              waitUntil {sleep 0.5; unitReady _medic};
              _medic doMove getPosATL _wnded;
              uiSleep 3;
            };
            if (!isNull _wnded && !isNull _medic) then {
              [_wnded,_medic,_timer] call MGI_fn_sortie};
          };
        };
      };
    };
    _medic call MGI_fn_medicRelease;
    _wnded setVariable ['myMedic',nil];
    if (_wnded getVariable ['uncsious',false]) then {
      _wnded setVariable ['uncsious',false];
    };
  ";

  MGI_fn_911 = compileFinal "
    params ['_wnded','_medic','_timer'];
    [_wnded,_medic,_timer] spawn MGI_fn_checkMedic;
    if (!isnull _medic) then {
      [_medic] joinSilent grpNull;
      uisleep 0.3;
      _medic setCaptive true;
      {_medic disableAI _x} count ['target','autotarget','autocombat','suppression'];
      group _medic setBehaviour 'CARELESS';
      _medic allowFleeing 0;
      _offset = [[0,0],[15, _wnded getRelDir _medic]] select (!isNull objectParent _medic);
      if (!isnull objectParent _medic) then {
        _medic setVariable ['veh',objectParent _medic];
        if (isPlayer driver objectParent _medic && _medic != assignedGunner objectParent _medic) then {
          unassignVehicle _medic;
          doGetOut _medic};
      };
      vehicle _medic doMove (_wnded getpos _offset);
      uiSleep 0.5;
      if (isnull objectParent _medic) then {
        group _medic setSpeedMode 'FULL'
      } else {
        group _medic setSpeedMode 'LIMITED'
      };
      uiSleep 3;
      waitUntil {Sleep 0.5; (unitReady vehicle _medic && canMove vehicle _medic) or {diag_tickTime > _timer + MGI_BleedOut && lifeState _wnded == 'incapacitated'}};
      if ((diag_tickTime > _timer + MGI_BleedOut) && lifeState _wnded == 'incapacitated') exitWith {};
      doStop _medic;
      if (!isnull objectParent _medic) then {
        unassignVehicle _medic;
        doGetOut _medic;
      };
      _medic doMove getpos _wnded;
      _medic setSpeedMode 'FULL';
    };
    uiSleep 3;
    if (isNull _medic or lifeState _medic == 'incapacitated') then {
      if (!isNull _medic) then {_medic call MGI_fn_medicRelease};
      _wnded spawn MGI_fn_unconscious;
    };
  ";

  MGI_fn_death = compileFinal "
    params ['_wnded'];
    if (_wnded getVariable ['uncsious',false]) then {
      _wnded setVariable ['uncsious',false];
    };
    if (!isnil {_wnded getVariable 'myMedic'}) then {
      (_wnded getVariable 'myMedic') setVariable ['myPatient',nil];
      _wnded setVariable ['myMedic',nil];
    };
    if (local _wnded) then {
      _wnded playMoveNow ''
    } else {
      [_wnded,''] remoteExec ['playMoveNow',_wnded]
    };
comment ""   if (!(_wnded call BIS_fnc_reviveEnabled)) then {
[_wnded,false] remoteExec ['setUnconscious',_wnded];
}"";
    if (!isMultiplayer && isplayer _wnded) then {
      _wnded setDamage 0;
      uiSleep 12;
      _wnded setCaptive false;
    } else {
      _wnded setDamage 1;
    };
  ";

  MGI_fn_unconscious = compileFinal  "
    params ['_unit'];
    waituntil {sleep 0.5; (lifeState _unit == 'incapacitated'  or damage _unit == 1 or (!(_unit call BIS_fnc_reviveEnabled) && damage _unit >=0.86))};
    if (!isnil {_unit getVariable 'myPatient'}) then {
      if (local _unit) then {
        _unit playMoveNow 'AidlPknlMstpSrasWrflDnon_AI'
      } else {
        [_unit,'AidlPknlMstpSrasWrflDnon_AI'] remoteExec ['playMoveNow',_unit]
      };
    };
    if (!(_unit call BIS_fnc_reviveEnabled)) then {
      if (local _unit) then {
        _unit setUnconscious true
      } else {
        [_unit,true] remoteExec ['setUnconscious',_unit]
      };
    };
    if (lifeState _unit == 'incapacitated') then {
      if (local _unit) then {
        _unit setCaptive true
      } else {
        [_unit,true] remoteExec ['setCaptive',_unit]
      };
      if (!isNil {_unit getVariable 'myPatient'}) then {
        _unit call MGI_fn_medicRelease
      };
      if (!isPlayer _unit) then {
        [_unit,'Heal Bros','\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa','\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa',
      '_this distance _target < 3 && lifeState _target == ""incapacitated"" ','_caller distance _target < 3 ',
        {
          call {
          if (stance _caller == 'PRONE') exitWith {
            _caller playMove 'ainvppnemstpslaywrfldnon_medicother';
          };
          _caller playMove 'ainvpknlmstpslaywrfldnon_medicother';
          };
        },
        {
          if ((diag_tickTime > (_this select 3 select 0) + MGI_react + MGI_BleedOut) && lifeState _target == 'incapacitated') then {
          (_target getVariable ['myMedic',objNull]) call MGI_fn_medicRelease;
          _target call MGI_fn_death;
          }
        },
        {
          if (_target call BIS_fnc_reviveEnabled) then {
            if (local _target) then {
              ['#rev',1,_target] call BIS_fnc_reviveOnState;
              _target setCaptive true
            } else {
              [['#rev',1,_target],BIS_fnc_reviveOnState] remoteExec ['call',_target];
              [_target,true] remoteExec ['setCaptive',_target]
            };
          } else {
            _target setDamage 0;
            if (local _target) then {
              _target setUnconscious false
            } else {
              [_target,false] remoteExec ['setUnconscious',_target]
            };
          };
          if (_target getVariable ['uncsious',false]) then {_target setVariable ['uncsious',false]};
          (_target getVariable ['myMedic',objNull]) spawn MGI_fn_medicRelease;
comment  ""  _target setVariable ['myMedic',nil]"";
          _target spawn {
            _target = _this;
            uiSleep 12;
            if (local _target) then {
              _target setCaptive false
            } else {
              if (local _target) then {
                _target setCaptive false
              } else {
                [_target,false] remoteExec ['setCaptive',_target]
              };
            };
          };
        },
        {
          [_caller,''] remoteExec ['switchMove']
        },
        [diag_tickTime],5,12,true,false] remoteExec ['BIS_fnc_holdActionAdd',0,_unit];
      };
    };
    _timer = diag_tickTime;
    while {lifeState _unit == 'incapacitated' && diag_tickTime <= _timer + MGI_react + MGI_BleedOut} do {
      if (local _unit) then {
        _unit setCaptive true
      } else {
        [_unit,true] remoteExec ['setCaptive',_unit]
      };
      if (isnil {_unit getVariable 'myMedic'}) then {
        _medic = _unit call MGI_fn_medic;
        if (!isNull _medic) then {
          [_unit,_medic,_timer] call MGI_fn_911
        };
      };
      uiSleep 2;
    };
    if (lifeState _unit == 'incapacitated' && diag_tickTime > _timer + MGI_react + MGI_BleedOut) then {
      (_unit getVariable ['myMedic',objNull]) call MGI_fn_medicRelease;
      _unit call MGI_fn_death;
    };
    (_unit getVariable ['myMedic',objNull]) call MGI_fn_medicRelease;
    if (_unit getVariable ['uncsious',false]) then {
      _unit setVariable ['uncsious',false]
    };
comment ""_unit setVariable ['myMedic',nil]"";
  ";

  MGI_fn_BailOut = compileFinal "
    params ['_unit','_veh'];
    moveOut _unit;
    if (local _unit) then {
      _unit setCaptive true
    } else {
      [_unit,true] remoteExec ['setCaptive',_unit]
    };
    if (!(backpack _unit isKindOf 'B_parachute') && (getPosATL _veh select 2) > 30) then {
      uiSleep random 0.5;
      _p = createVehicle ['Steerable_Parachute_F', (getPosATL _unit) vectorAdd [0,0,1],[],0,'none'];
      uiSleep 0.1;
      if (local _unit) then {
        _unit moveInDriver _p;
        _unit setBehaviour 'combat'
      } else {
        [_unit,_p] remoteExec ['moveInDriver',_unit];
        [_unit,'combat'] remoteExec ['setBehaviour',_unit]
      };
      uiSleep 1;
      if (isnull driver _p) then {
        deleteVehicle _p;
        if (!isplayer _unit) then { _unit setDamage 1};
      };
    } else {
      uiSleep 3;
      if (isnull objectParent _unit && !isTouchingGround _unit) then {_unit setDamage 1};
    };
    uiSleep 3;
    if (!isNil {_veh getVariable 'incVeh'}) then {_veh setVariable ['incVeh',nil]};
    if (_unit getVariable ['uncsious',false]) then {_unit setVariable ['uncsious',false]};
    uisleep 4;
    if (local _unit) then {
      _unit setCaptive false
    } else {
      [_unit,false] remoteExec ['setCaptive',_unit]
    };
  ";

  MGI_fn_Revive = {
    MGI_react = "react" call BIS_fnc_getParamValue;
    MGI_BleedOut = "bleedOut" call BIS_fnc_getParamValue;
    MGI_AiRevive = "NoReviveforAi" call BIS_fnc_getParamValue;
    MGI_AIKit = "AIKit" call BIS_fnc_getParamValue;
    MGI_AIMedicTrait = "AIMedicTrait" call BIS_fnc_getParamValue;
    MGI_bros = "bros" call BIS_fnc_getParamValue;
    if (MGI_react == 0) then {MGI_react = 120};
    if (MGI_BleedOut == 0) then {MGI_BleedOut = 120};
    if (MGI_AiRevive == 0) then {MGI_AiRevive = true};
    if (MGI_AIMedicTrait == 0) then {MGI_AIMedicTrait = false};
    if (MGI_bros == 0) then {MGI_bros = switchableUnits+playableUnits};

    params [["_react",MGI_react,[0]],["_bleedOut",MGI_BleedOut,[0]],["_AiRevive",MGI_AiRevive,[true]],["_kit",MGI_AIKit,[0]],["_AIMedicTrait",MGI_AIMedicTrait,[true]],["_MGI_bros",MGI_bros,[[],WEST,objNull]]];
    MGI_react = _react;
    MGI_BleedOut = _bleedOut;
    MGI_AiRevive = _AiRevive;
    MGI_AIKit = _kit;
    MGI_AIMedicTrait = _AIMedicTrait;

    _MGI_bros spawn {
      params ["_MGI_bros","_bros"];
      if (_MGI_bros isEqualType objNull) then {
        _bros = [_MGI_bros];
        MGI_bros = _bros;
        MGI_potentialMedic = MGI_bros
      } else {
        while {true} do {
          call {
            if (_MGI_bros isEqualType WEST) exitWith {
              {_x setVariable ["passedBros",true,true]} forEach (allUnits select {side _x == _MGI_bros && isnil {_x getVariable "passedBros"} && _x != (missionNamespace getVariable [format ["BIS_SUPP_HQ_%1",_MGI_bros],objNull]) && _x isKindOf "CAManBase"});
            };
            if (allPlayers isEqualTo (switchableUnits + playableUnits)) exitWith {
              {_x setVariable ["passedBros",true,true]} forEach  (allPlayers select {isnil {_x getVariable "passedBros"}});
            };
            if (_MGI_bros isEqualTypeAll objNull) then {
              {_x setVariable ["passedBros",true,true]} forEach (_MGI_bros select {isnil {_x getVariable "passedBros"}});
            };
          };
          _bros = allUnits select {(_x getVariable "passedBros")};
          {
            if (isnil {_x getVariable "passEH"}) then {
              _x setVariable ["passEH",true];
              _x call MGI_fn_EHDamage}
          } forEach _bros;
          MGI_bros = +_bros;
          MGI_potentialMedic = MGI_bros select {
          [true,{_x == "FirstAidKit"} count (items _x) >0,{_x == "MediKit"} count (items _x) >0] select MGI_AIKit
            && [true,_x getUnitTrait "Medic"] select MGI_AIMedicTrait
          };
          uiSleep 5;
        };
      };
    };
  };

  [20,120,true,0,false,west] call MGI_fn_Revive;
};

 

 

 


 

Thanks for your attention.

 

EDITED: draft. Disregard this script. Newer script front paged.

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

Having healing automatic is awesome.

But an option to order a specific unit to auto heal would be helpful, in some cases.

 

INS Revive, does this. The unit selected can be given a command to autoheal his bro's, if he is not autohealing already, kind of like a reinforcement command.

 

Thanks for all your hard work.

  • Like 2

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

×