diff --git a/addons/eventhandlers/functions/fnc_explosionEH.sqf b/addons/eventhandlers/functions/fnc_explosionEH.sqf index a4a959a4..5661793d 100644 --- a/addons/eventhandlers/functions/fnc_explosionEH.sqf +++ b/addons/eventhandlers/functions/fnc_explosionEH.sqf @@ -41,11 +41,11 @@ if (RND(0.5)) then { // standing to Right prone if (_dir > 330 && { RND(0.2) }) exitWith { - _unit switchMove "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft"; + [QEGVAR(main,doSwitchMove), [_unit, "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft"]] call CBA_fnc_globalEvent; [ { if (_this call EFUNC(main,isAlive)) then { - _this switchMove "AadjPpneMstpSrasWrflDleft_AmovPercMstpSrasWrflDnon" + [QEGVAR(main,doSwitchMove), [_this, "AadjPpneMstpSrasWrflDleft_AmovPercMstpSrasWrflDnon"]] call CBA_fnc_globalEvent; }; }, _unit, (GVAR(ExplosionReactionTime) - 4) + random 3 ] call CBA_fnc_waitAndExecute; @@ -53,11 +53,11 @@ if (_dir > 330 && { RND(0.2) }) exitWith { // standing to Left prone if (_dir < 30 && { RND(0.2) }) exitWith { - _unit switchMove "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright"; + [QEGVAR(main,doSwitchMove), [_unit, "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright"]] call CBA_fnc_globalEvent; [ { if (_this call EFUNC(main,isAlive)) then { - _this switchMove "AadjPpneMstpSrasWrflDright_AmovPercMstpSrasWrflDnon" + [QEGVAR(main,doSwitchMove), [_this, "AadjPpneMstpSrasWrflDright_AmovPercMstpSrasWrflDnon"]] call CBA_fnc_globalEvent; }; }, _unit, (GVAR(ExplosionReactionTime) - 4) + random 3 ] call CBA_fnc_waitAndExecute; @@ -71,7 +71,7 @@ _unit setDestination [_pos, "FORMATION PLANNED", false]; _unit doWatch _pos; // all others ~ go straight down -_unit switchMove "AmovPercMsprSlowWrflDf_AmovPpneMstpSrasWrflDnon"; +[QEGVAR(main,doSwitchMove), [_unit, "AmovPercMsprSlowWrflDf_AmovPpneMstpSrasWrflDnon"]] call CBA_fnc_globalEvent; _unit setUnitPos "DOWN"; // get back diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf index 4da87308..7143c182 100644 --- a/addons/main/XEH_postInit.sqf +++ b/addons/main/XEH_postInit.sqf @@ -99,3 +99,8 @@ GVAR(debug_TextFactor) = linearConversion [0.55, 0.7, getResolution select 5, 1, [_this select 1, QEGVAR(danger,OnFleeing), _this] call BIS_fnc_callScriptedEventHandler; [QEGVAR(danger,OnFleeing), _this] call CBA_fnc_localEvent; }] call CBA_fnc_addEventHandler; + +[QGVAR(doSwitchMove), { + params [["_unit", objNull], ["_move", ""]]; + _unit switchMove [_move, 0, 0.5, false]; +}] call CBA_fnc_addEventHandler; diff --git a/addons/main/functions/fnc_doAnimation.sqf b/addons/main/functions/fnc_doAnimation.sqf index 956ffc7e..1b740459 100644 --- a/addons/main/functions/fnc_doAnimation.sqf +++ b/addons/main/functions/fnc_doAnimation.sqf @@ -67,7 +67,7 @@ if (_priority >= 2) then { params ["_unit", "_animation"]; if (animationState _unit != _animation) then { // Execute on all machines. SwitchMove has local effects. - [_unit, _animation] remoteExec ["switchMove", 0]; + [QGVAR(doSwitchMove), [_unit, _animation]] call CBA_fnc_globalEvent; }; }, [_unit, _animation], 0.1] call CBA_fnc_waitAndExecute; }; diff --git a/addons/wp/functions/fnc_doAssaultUnitReset.sqf b/addons/wp/functions/fnc_doAssaultUnitReset.sqf index 88f0269d..3aa613f8 100644 --- a/addons/wp/functions/fnc_doAssaultUnitReset.sqf +++ b/addons/wp/functions/fnc_doAssaultUnitReset.sqf @@ -37,7 +37,8 @@ if (!_retreat && {animationState _unit in ["apanpknlmsprsnonwnondf", "apanpercms // retreat if (_retreat) then { - _unit switchMove (["AmovPercMsprSlowWrflDf_AmovPpneMstpSrasWrflDnon", "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"] select ((primaryWeapon _unit) isEqualTo "")); + private _animation = ["AmovPercMsprSlowWrflDf_AmovPpneMstpSrasWrflDnon", "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"] select ((primaryWeapon _unit) isEqualTo ""); + [QEGVAR(main,doSwitchMove), [_unit, _animation]] call CBA_fnc_globalEvent; _unit enableAI "AUTOTARGET"; _unit doWatch ObjNull; }; diff --git a/addons/wp/functions/fnc_taskAssault.sqf b/addons/wp/functions/fnc_taskAssault.sqf index 5625046d..7dfdd0b3 100644 --- a/addons/wp/functions/fnc_taskAssault.sqf +++ b/addons/wp/functions/fnc_taskAssault.sqf @@ -76,12 +76,13 @@ _group setFormation "LINE"; // check retreat if (_retreat) then { _x disableAI "AUTOTARGET"; - [_x, "ApanPercMrunSnonWnonDf"] remoteExec ["switchMove", 0]; - [_x, selectRandom [ + [QEGVAR(main,doSwitchMove), [_x, "ApanPercMrunSnonWnonDf"]] call CBA_fnc_globalEvent; + private _animation = selectRandom [ "ApanPknlMsprSnonWnonDf", "ApanPknlMsprSnonWnonDf", "ApanPercMsprSnonWnonDf" - ]] remoteExec["switchMove", 0]; + ]; + [QEGVAR(main,doSwitchMove), [_x, _animation]] call CBA_fnc_globalEvent; }; // adds frame handler