From f0e762285678e4c8ab7588b13ea4e616ce605d1f Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Fri, 14 Feb 2014 00:31:50 +0100 Subject: [PATCH] Fixed Error in expression Error in expression <_ret = _this select _ret; }; _ret > Error position: <_ret > Error Undefined variable in expression: _ret File z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf, line 23 Error in expression Error position: <_selectedWeapon]; _selectedMag = _select> Error Undefined variable in expression: _selectedweapon File z\addons\dayz_code\actions\player_craftItem.sqf, line 193 Error in expression Error position: <_x; } forEach _outputWeapons; { _itemOu> Error Undefined variable in expression: _x File z\addons\dayz_code\actions\player_craftItem.sqf, line 200 --- SQF/dayz_code/actions/player_craftItem.sqf | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/SQF/dayz_code/actions/player_craftItem.sqf b/SQF/dayz_code/actions/player_craftItem.sqf index b14c417fd..709953491 100644 --- a/SQF/dayz_code/actions/player_craftItem.sqf +++ b/SQF/dayz_code/actions/player_craftItem.sqf @@ -189,10 +189,16 @@ if (_canDo) then { } forEach _inputWeapons; if (_num_removed_weapons == (count _inputWeapons)) then { if(_randomOutput == 1) then { - _selectedWeapon = _outputWeapons call BIS_fnc_selectRandom; - _outputWeapons = [_selectedWeapon]; - _selectedMag = _selectedRecipeOutput call BIS_fnc_selectRandom; - _selectedRecipeOutput = [_selectedMag]; + _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]; + }; // exit loop _craft_doLoop = false; };