diff --git a/SQF/dayz_code/system/ca/functions/fn_initCounter.sqf b/SQF/dayz_code/system/ca/functions/fn_initCounter.sqf new file mode 100644 index 000000000..8a24663d1 --- /dev/null +++ b/SQF/dayz_code/system/ca/functions/fn_initCounter.sqf @@ -0,0 +1,45 @@ +private ["_mode", "_activationCount", "_maxCount", "_timesActivated", "_keyString"]; +_mode = _this; +_activationCount = 4; +_maxCount = 25; +_timesActivated = 1; +_keyString = "BIS_IAmBeingNaughty"; + +for "_i" from 1 to (_maxCount - 1) do +{ + if (isKeyActive (_keyString + (str _i))) then + { + _timesActivated = _timesActivated + 1 + }; +}; + +if (_mode) then +{ + if (_timesActivated <= _maxCount) then + { + activateKey (_keyString + (str _timesActivated)); + }; + + if (_timesActivated >= _activationCount) then + { + private ["_handle"]; + _handle = [_timesActivated] execVM "ca\modules\functions\systems\fn_enableSystem.sqf"; + + if ((random 5) < 1) then + { + _handle = [_timesActivated] execVM "ca\modules\functions\systems\fn_enableAnotherSystem.sqf"; + }; + }; +} +else +{ + if ((configName (configFile >> "CfgPatches" >> "CA_E")) != "") then + { + for "_i" from 1 to (_timesActivated - 1) do + { + call (compile "deactivateKey (_keyString + (str _i))"); + }; + }; +}; + +true \ No newline at end of file diff --git a/SQF/dayz_code/system/ca/functions/init.sqf b/SQF/dayz_code/system/ca/functions/init.sqf index 263cacef4..f88ecba80 100644 --- a/SQF/dayz_code/system/ca/functions/init.sqf +++ b/SQF/dayz_code/system/ca/functions/init.sqf @@ -92,7 +92,12 @@ for "_t" from 0 to 2 do { private ["_test", "_test2"]; _test = (_this select 0) setPos (position (_this select 0)); if (isnil "_test") then {_test = false}; _test2 = (_this select 0) playMove ""; if (isnil "_test2") then {_test2 = false}; -(_test || _test2) call (compile (preprocessFileLineNumbers "ca\modules\functions\misc\fn_initCounter.sqf")); +_testvar = getText (configFile >> "CfgMissions" >> "Missions" >> "SP_BearRising" >> "directory"); +if (_testvar != "") then { + (_test || _test2) call (compile (preprocessFileLineNumbers "\z\addons\dayz_code\system\ca\functions\fn_initCounter.sqf")); +} else { // Player has A2 Free + if (_test || _test2) then {0 call (compile (preprocessFileLineNumbers "ca\modules\functions\misc\fn_initCounter.sqf"))}; +}; //-------------------------------------------------------------------------------------------------------- //--- INIT COMPLETE --------------------------------------------------------------------------------------