diff --git a/SQF/dayz_code/actions/player_craftItem.sqf b/SQF/dayz_code/actions/player_craftItem.sqf index 6b5316878..4bbb7153c 100644 --- a/SQF/dayz_code/actions/player_craftItem.sqf +++ b/SQF/dayz_code/actions/player_craftItem.sqf @@ -37,7 +37,8 @@ _abort = false; _distance = 3; _reason = ""; _waterLevel = 0; - +_outputWeapons = []; +_selectedRecipeOutput = []; _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; _canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder); @@ -208,12 +209,10 @@ if (_canDo) then { } forEach _inputWeapons; if (_num_removed_weapons == (count _inputWeapons)) then { if(_randomOutput == 1) then { - _outputWeapons = []; if (!isNil "_outputWeapons" && count _outputWeapons > 0) then { _selectedWeapon = _outputWeapons call BIS_fnc_selectRandom; _outputWeapons = [_selectedWeapon]; }; - _selectedRecipeOutput = []; if (!isNil "_selectedRecipeOutput" && count _selectedRecipeOutput > 0) then { _selectedMag = _selectedRecipeOutput call BIS_fnc_selectRandom; _selectedRecipeOutput = [_selectedMag]; diff --git a/SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf b/SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf index 8184cacc2..c261a6cc7 100644 --- a/SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf +++ b/SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf @@ -15,9 +15,10 @@ private "_ret"; if(count _this > 0) then { - _ret = count _this; //number of elements in the array + //_ret = count _this; //number of elements in the array //_ret = [0, _ret] call BIS_fnc_randomInt; //choose random index - _ret = floor(random _ret); + _ret = floor(random(count _this)); _ret = _this select _ret; //get the element, return it }; -_ret + +_ret; \ No newline at end of file