Search the Community
Showing results for tags 'single death'.
Found 1 result
-
mgi scripts NO MORE SINGLE DEATH (SP/MP) - AUTO-REVIVE
pierremgi posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
NO MORE SINGLE DEATH (SP/MP) - PLAYER CAN AUTO-REVIVE Hi all, Did you play some "ESCAPE MALDEN" in MP while single player and get the frustration of "lost mission on death"? Sure, you're alone and nobody will revive you. Respawn kills you and the game is over! Same for some SP session of complex mission. If you don't have the switch units possibility, game is over at first death. The script overrides this fate. Just choose (or not) the two parameters set at the first line. parameters: REVIVE DELAY / CLEAR AREA Revive delay: Simply change the first value in first line. This value is also a delay for captive status. i hard-coded a minimum: (min set to 20 sec. for cinematic if MP revive allowed, 10 sec. min if not). Clear area: the enemy infantry will be killed within this radius. That's useful for reviving inside a hornet's nest. Can be set to 0. Recommended value: 20 m. Usage: Copy/ paste the code in one of these places: running script for player(s) / trigger set to true / init.sqf / initPlayerLocal.sqf / console Example, for ESCAPE MALDEN, enable debug console in parameters and copy /paste the code, exec local. NOTES: - in MP, this script will work as long as there is an unique player. If some JIP, the script will be stopped. - Not compatible with other damage event handlers. If you want, you can try to make it work along with some other damage EHs, just removing the 6th line: player removeAllEventHandlers "handleDamage"; [5,50] call { params [["_delay",20,[0]],["_clear",0,[0]]]; if (count (call bis_fnc_listPlayers) != 1) exitwith {}; MGI_ReviveDelay = [_delay max 10,_delay max 20] select (player call BIS_fnc_reviveEnabled); MGI_clearArea = _clear; player removeAllEventHandlers "handleDamage"; MGI_fn_revive = compileFinal " params ['_unit']; waituntil {lifeState _unit == 'incapacitated' or !alive _unit or (!(_unit call BIS_fnc_reviveEnabled) && damage _unit >=0.86)}; if (!(_unit call BIS_fnc_reviveEnabled)) then { _unit setUnconscious true }; if (lifeState _unit == 'incapacitated') then { _unit setCaptive true; _unit allowdamage false; _unit setVariable ['inc',false]; {_x setDamage 1} forEach (( _unit nearEntities ['CAManBase', MGI_clearArea]) select {side _x getFriend playerSide < 0.6 && side _x != civilian}) - [_unit]; uisleep 3; _unit allowDamage true; if (_unit call BIS_fnc_reviveEnabled) then { ['#rev',1,_unit] call BIS_fnc_reviveOnState; _unit setCaptive true; _unit allowdamage false; } else { _unit setDamage 0; _unit setUnconscious false; }; }; uiSleep MGI_reviveDelay; _unit allowdamage true; _unit setCaptive false; "; player addEventHandler ["handleDamage", { params ["_unit","","_dam"]; if (count allplayers !=1) exitWith { player removeEventHandler ["handleDamage",_thiseventHandler] }; _veh = objectParent _unit; if (!isnull _veh && isNil {_veh getVariable ["incVeh",nil]} && (damage _veh > 0.7 or (!canfire _veh && !canMove _veh) or _dam > 0.3)) then { _veh setVariable ["incVeh",true]; _unit allowdamage false; _unit setCaptive true; [_unit,_veh] spawn { params ["_unit","_veh"]; _unit action ["GetOut", _veh]; _tim = diag_tickTime; waitUntil {isnull objectParent _unit or diag_tickTime > _tim + 3}; uiSleep 2; _veh setVariable ["incVeh",nil]; _unit allowdamage true; _unit setCaptive false; }; }; if (!(_unit getVariable ["inc",false]) && isNull objectParent _unit) then { _unit setVariable ["inc",true]; _unit spawn MGI_fn_revive; }; _dam min 0.86 }]; }; Enjoy!