diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 3a16ac9d43..a06792a75d 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -97,14 +97,16 @@ if (!hasInterface) exitWith {}; call COMPILE_FILE(scripts\assignedItemFix); call COMPILE_FILE(scripts\initScrollWheel); -0 spawn { - while {true} do { - waitUntil {!isNull (findDisplay 46)}; sleep 0.1; - findDisplay 46 displayAddEventHandler ["MouseZChanged", QUOTE( _this call GVAR(onScrollWheel) )]; - [false] call FUNC(disableUserInput); - waitUntil {isNull (findDisplay 46)}; - }; +DFUNC(mouseZHandler) = { + waitUntil {!isNull (findDisplay 46)}; sleep 0.1; + findDisplay 46 displayAddEventHandler ["MouseZChanged", QUOTE( _this call GVAR(onScrollWheel) )]; + [false] call FUNC(disableUserInput); }; + +addMissionEventHandler ["Loaded", FUNC(mouseZHandler)]; +[] spawn FUNC(mouseZHandler); + + enableCamShake true; // Set the name for the current player