Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- private _fnc_scriptNameParent = if (isNil '_fnc_scriptName') then {'RR_fnc_mine'} else {_fnc_scriptName};
- private _fnc_scriptName = 'RR_fnc_mine';
- scriptName _fnc_scriptName;
- #line 1 "RR_Functions\Interaction\actions\fn_mine.sqf [RR_fnc_mine]"
- private["_maxGather","_resource","_amount","_requiredItem","_mined"];if(life_action_inUse) exitWith{};if((vehicle player)!=player) exitWith{};if(player getVariable["RR_restrained",false]) exitWith{["You are restrained",true,"fast"]call RR_fnc_notificationSystem;};_exit=false;if(player getVariable["RR_knockedOut",false]) exitWith{};life_action_inUse=true;_zone="";_requiredItem="";_zoneSize=(getNumber(missionConfigFile>>"CfgGather">>"zoneSize"));_resourceCfg=missionConfigFile>>"CfgGather">>"Minerals";_percent=(floor random 100)+1;for"_i"from 0 to count(_resourceCfg)-1 do{_curConfig=_resourceCfg select _i;_resources=getArray(_curConfig>>"mined");_maxGather=getNumber(_curConfig>>"amount");_resourceZones=getArray(_curConfig>>"zones");_requiredItem=getText(_curConfig>>"item");_mined="";if(_resources isEqualTo[]) exitWith{};for"_i"from 0 to count(_resources) do{if(count _resources isEqualTo 1) exitWith{if(!((_resources select 0) isEqualType[])) then{_mined=_resources select 0;}else{_mined=(_resources select 0) select 0;};};_resource=(_resources select _i) select 0;_prob=(_resources select _i) select 1;_probdiff=(_resources select _i) select 2;if((_percent>=_prob)&&(_percent<=_probdiff)) exitWith{_mined=_resource;};};{if((player distance(getMarkerPos _x))<_zoneSize) exitWith{_zone=_x;};}forEach _resourceZones;if(_zone!="") exitWith{};
- };if(_zone isEqualTo"") exitWith{life_action_inUse=false;};if(_requiredItem!="") then{_valItem=missionNamespace getVariable"life_inv_"+_requiredItem;if(_valItem<1) exitWith{switch(_requiredItem) do{case"pickaxe":{titleText[(localize"STR_NOTF_Pickaxe"),"PLAIN"];};};life_action_inUse=false;_exit=true;};};if(_exit) exitWith{life_action_inUse=false;};_amount=round(random(_maxGather))+1;_diff=[_mined,_amount,life_carryWeight,life_maxWeight]call RR_fnc_calWeightDiff;if(_diff isEqualTo 0) exitWith{["Your inventory space is full.",true,"fast"]call RR_fnc_notificationSystem;life_action_inUse=false;};player say3D"mining";for"_i"from 0 to 4 do{player playMoveNow"AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";waitUntil{animationState player!="AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";};uisleep 0.5;};if(([true,_mined,_diff]call RR_fnc_handleInv)) then{_itemName=getText(missionConfigFile>>"VirtualItems">>_mined>>"displayName");titleText[format[localize"STR_NOTF_Gather_Success",(localize _itemName),_diff],"PLAIN"];};_number=floor(random 30);_array=["amethystraw","ametrineraw","aquamarineraw","bloodstoneraw","bluesaphireraw","citrineraw","emeraldraw","opalraw","quartzraw","rubyraw"];_randomGem=selectRandom _array;if(_number isEqualTo 1) then{[true,_randomGem,1]call RR_fnc_handleInv;[parseText format["<t color='#0eb0ff'>You found a rare Gem!</t>"],true,"fast"]call RR_fnc_notificationSystem;};uiSleep 2.5;life_action_inUse=false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement