Search the Community
Showing results for tags 'forcerespawn'.
Found 1 result
-
[SOLVED] Prevent Player From Force Respawn When Incapacitated
beno_83au posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, I'm trying to prevent players from force respawning when waiting for a revive (using the vanilla revive). To do this I'm trying to stop them from using the enter key or middle mouse button. I can stop the enter button, but the middle mouse button is eluding me. This is the code I'm using: _idKey = (findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 28) then {true}"]; _idMouse = (findDisplay 46) displayAddEventHandler ["MouseButtonDown","if ((_this select 1) == 2) then {true}"]; Now, in testing I got a return (_this select 1) of 28 and 2 for "KeyDown" and "MouseButtonDown" respectively, but when I apply that to the EH as I have done above, only the enter key is stopped. How do I stop a player using their middle mouse button (without disabling user input)? Edit: Worked it out, relevant post/s are below but here is the solution (big credit to Larrow for a step in the right direction): #include "\a3\functions_f_mp_mark\revive\defines.inc" nul = [player] spawn { params ["_unit"]; while {true} do { private ["_actionID"]; waitUntil {lifeState _unit == "INCAPACITATED"}; _actionID = _unit getVariable [VAR_ACTION_ID_RESPAWN,-1]; [_unit,_actionID] call bis_fnc_holdActionRemove; {SET_FORCING_RESPAWN(_unit,false)}; }; }; Add this to the initPlayerLocal.sqf and the option to force respawn will not be present for an incapacitated player. Or, better yet, use this updated code from Larrow: player addEventHandler["Dammaged",{ params ["_unit", "", "_damage","","_hitPoint","_source"]; if ( alive _unit && { _damage >= 1 && { _unit getVariable ["#rev_enabled", false] && { _hitPoint == "Incapacitated" && { _unit getVariable ["#rev_state", 0] isEqualTo 2 } } } } ) then { if ( vehicle _unit isEqualTo _unit ) then { _nul = [ _unit ] spawn { params[ "_unit" ]; waitUntil{ !( _unit getVariable [ "#rev_actionID_respawn", -1 ] isEqualTo -1 ) }; _actionID = _unit getVariable [ "#rev_actionID_respawn", -1 ]; [ _unit, _actionID ] call BIS_fnc_holdActionRemove; ["",false,_unit] call BIS_fnc_reviveOnForcingRespawn; _unit setVariable ["#revF", false, true]; waitUntil{ !( lifeState _unit == "Incapacitated" ) }; _unit setVariable [ "#rev_actionID_respawn", -1 ]; }; }; }; }];- 17 replies