{"name":"forceCadetDifficulty","title":"forceCadetDifficulty","type":"command","url":"https://community.bistudio.com/wiki/forceCadetDifficulty","revid":310147,"updated":"2022-05-05T12:46:27Z","groups":["Difficulty"],"status":"ok","games":{"arma3":"2.02"},"since":"arma3 2.02","arma3_since":"2.02","description":"Forces `showCadetHints` and `showCadetWP` global Cadet Arma 3 difficulty, returns previous settings.","syntaxes":[{"syntax":"forceCadetDifficulty [showCadetHints, showCadetWP]","params":[{"name":"showCadetHints","type":"Boolean","description":"`showCadetHints` difficulty","type_expr":"Boolean"},{"name":"showCadetWP","type":"Boolean","description":"`showCadetWP` difficulty","type_expr":"Boolean"}],"returns":{"type":"Array of Booleans","type_expr":"Array<Boolean>","description":"[prev_showCadetHints, prev_showCadetWP]"},"form":"unary","right":{"text":"[showCadetHints, showCadetWP]"}}],"examples":[{"code":["private _previousSettings = forceCadetDifficulty [true, false];"]},{"text":"```sqf\nprivate _fnc_forceCadetDifficulty =\n{\n    params [\"_OKButtonPressed\"];\n    if (_OKButtonPressed) then\n    {\n        forceCadetDifficulty (switch (toLowerANSI configName ((configFile >> \"CfgDifficultyPresets\") select difficulty)) do\n        {\n            case \"recruit\";\n            case \"regular\":\n            {\n                // showCadetHints = 1;\n                // showCadetWP = 1;\n                [true, true]\n            };\n            case \"veteran\":\n            {\n                // showCadetHints = 0;\n                // showCadetWP = 1;\n                [false, true]\n            };\n            default\n            {\n                // showCadetHints = 0;\n                // showCadetWP = 0;\n                [false, false]\n            };\n        });\n    };\n};\n[true] call _fnc_forceCadetDifficulty;\n[missionNamespace, \"OnGameOptionsExited\", _fnc_forceCadetDifficulty] call BIS_fnc_addScriptedEventHandler;\n```","code":["private _fnc_forceCadetDifficulty = \n{\n\tparams [\"_OKButtonPressed\"];\n\tif (_OKButtonPressed) then\n\t{\n\t\tforceCadetDifficulty (switch (toLowerANSI configName ((configFile >> \"CfgDifficultyPresets\") select difficulty)) do\n\t\t{\n\t\t\tcase \"recruit\";\n\t\t\tcase \"regular\":\n\t\t\t{\n\t\t\t\t// showCadetHints = 1;\n\t\t\t\t// showCadetWP = 1;\n\t\t\t\t[true, true]\n\t\t\t};\n\t\t\tcase \"veteran\":\n\t\t\t{\n\t\t\t\t// showCadetHints = 0;\n\t\t\t\t// showCadetWP = 1;\n\t\t\t\t[false, true]\n\t\t\t};\n\t\t\tdefault\n\t\t\t{\n\t\t\t\t// showCadetHints = 0;\n\t\t\t\t// showCadetWP = 0;\n\t\t\t\t[false, false]\n\t\t\t};\n\t\t});\n\t};\n};\n[true] call _fnc_forceCadetDifficulty;\n[missionNamespace, \"OnGameOptionsExited\", _fnc_forceCadetDifficulty] call BIS_fnc_addScriptedEventHandler;"]}],"see_also":["difficulty","cadetMode","hintCadet","Arma 3: Scripted Event Handlers"]}