diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index 0ce09280a7..9d1a69f4fd 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -41,3 +41,11 @@ class Extended_InitPost_EventHandlers { }; }; }; +//make sure captiveNum is reset on respawn +class Extended_Respawn_EventHandlers { + class CAManBase { + class ADDON { + respawn = QUOTE(_this call FUNC(handleRespawn)); + }; + }; +}; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index c09f81e51b..bc6a61bc4f 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -21,6 +21,7 @@ PREP(handleGetOut); PREP(handleKilled); PREP(handleOnUnconscious); PREP(handlePlayerChanged); +PREP(handleRespawn); PREP(handleUnitInitPost); PREP(handleZeusDisplayChanged); PREP(moduleSurrender); diff --git a/addons/captives/functions/fnc_handleRespawn.sqf b/addons/captives/functions/fnc_handleRespawn.sqf new file mode 100644 index 0000000000..fe2bc0a968 --- /dev/null +++ b/addons/captives/functions/fnc_handleRespawn.sqf @@ -0,0 +1,25 @@ +/* + * Author: commy2 PabstMirror + * Fix, because captiveNum doesn't reset properly on respawn + * + * Arguments: + * 0: Unit + * 1: Corpse + * + * Return Value: + * Nothing + * + * Example: + * [alive, body] call ACE_captives_fnc_handleRespawn; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_dead); + +if (!local _unit) exitWith {}; + +[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); +[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); +