diff --git a/addons/medical/ACE_Medical_StateMachine.hpp b/addons/medical/ACE_Medical_StateMachine.hpp index 6d551aad0fd..4151ef83118 100644 --- a/addons/medical/ACE_Medical_StateMachine.hpp +++ b/addons/medical/ACE_Medical_StateMachine.hpp @@ -61,7 +61,14 @@ class ACE_Medical_StateMachine { class SecondChance { events[] = {QGVAR(FatalInjuryInstantTransition)}; targetState = "CardiacArrest"; - condition = QUOTE(GVAR(fatalInjuryCondition) > 0); + condition = QUOTE(DFUNC(conditionFromFatalToCardiac)); + onTransition = QUOTE(DFUNC(transitionSecondChance)); + }; + class SecondChanceAI { + events[] = {QGVAR(FatalInjuryInstantTransition)}; + targetState = "CardiacArrest"; + //conditionFromFatalToCardiac + condition = QUOTE(DFUNC(conditionFromFatalToCardiac)); onTransition = QUOTE(DFUNC(transitionSecondChance)); }; class Death { diff --git a/addons/medical/functions/fnc_conditionFromFatalToCardiac.sqf b/addons/medical/functions/fnc_conditionFromFatalToCardiac.sqf new file mode 100644 index 00000000000..2c19cc926fc --- /dev/null +++ b/addons/medical/functions/fnc_conditionFromFatalToCardiac.sqf @@ -0,0 +1,17 @@ +/* + * Author: Arcanum + * Condition for trasfer from FatalInjury to Second chance. + * + * Arguments: + * 0: The Unit + * 1: 1 for AI 0 for player + * + * Return Value: + * Condition fo state machine + * + * Public: No + */ +#include "script_component.hpp" +params ["_unit","_wantAI"]; + +(GVAR(fatalInjuryConditionAI) > 0) && (QUOTE(_this call FUNC(isAi)) == _wantAI) diff --git a/addons/medical/functions/fnc_isAI.sqf b/addons/medical/functions/fnc_isAI.sqf new file mode 100644 index 00000000000..e30563c8fca --- /dev/null +++ b/addons/medical/functions/fnc_isAI.sqf @@ -0,0 +1,27 @@ +/* + * Author: Arcanum + * Check if a unit is AI + * + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Is AI + * + * Example: + * [player] call ace_medical_fnc_isAI + * + * Public: Yes + */ + +#include "script_component.hpp" + +params ["_unit"]; +private _return = 0; + +if (isPlayer _unit) then { + _return=0; +else { + _return=1; +}; +_return