Advertisement
Guest User

Untitled

a guest
Sep 6th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 13.71 KB | None | 0 0
  1. {
  2.     private _fnc_scriptNameParent = if (isNil '_fnc_scriptName') then {'RR_fnc_gather'} else {_fnc_scriptName};
  3.     private _fnc_scriptName = 'RR_fnc_gather';
  4.     scriptName _fnc_scriptName;
  5.  
  6. #line 1 "RR_Functions\Interaction\actions\fn_gather.sqf [RR_fnc_gather]"
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. 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;};if(player getVariable["RR_knockedOut",false]) exitWith{};if(life_carryWeight isEqualTo life_maxWeight) exitWith{["You cant carry anymore!",true,"fast"]call RR_fnc_notificationSystem;};life_action_inUse=true;private _zoneSize=(getNumber(missionConfigFile>>"CfgGather">>"zoneSize"));private _collectMessage="";private _found=false;private _fieldFound="";private _toolRequired="";private _maxGather=0;private _minGather=0;private _itemsToGive=[];private _initialWeight=-1;{private _field=(configName _x);if((playerSide isEqualTo independent)&&!(_field isEqualTo"peaches_1"||_field isEqualTo"apple_1")) exitWith{};private _fieldMarker=format["field_%1",(configName _x)];private _markerPosition=getMarkerPos _fieldMarker;private _distance=(getPos player) distance _markerPosition;if(_distance<=_zoneSize) exitWith{_found=true;private _bands=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"Fields">>_field>>"bands");_collectMessage=getText(missionConfigFile>>"CfgGather">>"Zones">>"Fields">>_field>>"findMessage");_toolRequired=getText(missionConfigFile>>"CfgGather">>"Zones">>"Fields">>_field>>"toolRequired");private _count=1;while{_count<(_bands+1)}do{private _bandName=format["band%1",_count];private _bandNamePercentage=format["band%1Percentage",_count];private _bandNameMax=format["band%1MaxGather",_count];private _bandNameMin=format["band%1MinGather",_count];private _bandNameFindMessage=format["band%1FindMessage",_count];private _items=getArray(missionConfigFile>>"CfgGather">>"Zones">>"Fields">>_field>>_bandName);if(_count isEqualTo 1) then{_initialWeight=getNumber(missionConfigFile>>"VirtualItems">>(_items select 0)>>"weight");};private _percentage=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"Fields">>_field>>_bandNamePercentage);private _bandFindMessage=getText(missionConfigFile>>"CfgGather">>"Zones">>"Fields">>_field>>_bandNameFindMessage);private _bandMax=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"Fields">>_field>>_bandNameMax);private _bandMin=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"Fields">>_field>>_bandNameMin);if(_percentage isEqualTo 100) then{private _var=switch(playerSide) do{case west:{};case civilian:{"RR_talent_civ_Gather"};case independent:{"RR_talent_med_gather"};case east:{"RR_talent_syn_Gather"};};private _talentLevel=missionNamespace getVariable[_var,0];if(_talentLevel>0) then{_bandMax=_bandMax+1;};if(_talentLevel>1) then{_bandMax=_bandMax+1;};if(_talentLevel>2) then{_bandMax=_bandMax+1;};private _randomItem=selectRandom _items;private _randomAmount=round((random(_bandMax-_bandMin))+_bandMin);_itemsToGive pushBack[_randomItem,_randomAmount,_bandFindMessage];}else{private _random=random 100;if(_random<=_percentage) then{private _var=switch(playerSide) do{case west:{};case civilian:{"RR_talent_civ_Gather"};case independent:{"RR_talent_med_gather"};case east:{"RR_talent_syn_Gather"};};private _talentLevel=missionNamespace getVariable[_var,0];if(_talentLevel>0) then{_bandMax=_bandMax+1;};if(_talentLevel>1) then{_bandMax=_bandMax+1;};if(_talentLevel>2) then{_bandMax=_bandMax+1;};private _randomItem=selectRandom _items;private _randomAmount=floor((random(_bandMax-_bandMin))+_bandMin);_itemsToGive pushBack[_randomItem,_randomAmount,_bandFindMessage];};};_count=_count+1;};};}forEach("true"span class="re5"> configClasses(missionConfigFile>>"CfgGather">>"Zones">>"Fields"));if((life_maxWeight-life_carryWeight)<_initialWeight) exitWith{["You cant carry anymore!",true,"fast"]call RR_fnc_notificationSystem;};if(!_found) then{{private _mine=(configName _x);private _mineMarker=format["mine_%1",(configName _x)];private _markerPosition=getMarkerPos _mineMarker;private _distance=(getPos player) distance _markerPosition;if(_distance<=_zoneSize) exitWith{_found=true;private _bands=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"Mines">>_mine>>"bands");_collectMessage=getText(missionConfigFile>>"CfgGather">>"Zones">>"Mines">>_mine>>"findMessage");_toolRequired=getText(missionConfigFile>>"CfgGather">>"Zones">>"Mines">>_mine>>"toolRequired");private _count=1;while{_count<(_bands+1)}do{private _bandName=format["band%1",_count];private _bandNamePercentage=format["band%1Percentage",_count];private _bandNameMax=format["band%1MaxGather",_count];private _bandNameMin=format["band%1MinGather",_count];private _bandNameFindMessage=format["band%1FindMessage",_count];private _items=getArray(missionConfigFile>>"CfgGather">>"Zones">>"Mines">>_mine>>_bandName);private _percentage=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"Mines">>_mine>>_bandNamePercentage);private _bandFindMessage=getText(missionConfigFile>>"CfgGather">>"Zones">>"Mines">>_mine>>_bandNameFindMessage);private _bandMax=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"Mines">>_mine>>_bandNameMax);private _bandMin=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"Mines">>_mine>>_bandNameMin);if(_percentage isEqualTo 100) then{private _var=switch(playerSide) do{case west:{};case civilian:{"RR_talent_civ_Gather"};case independent:{"RR_talent_med_gather"};case east:{"RR_talent_syn_Gather"};};private _talentLevel=missionNamespace getVariable[_var,0];if(_mine!="12") then{if(_talentLevel>0) then{_bandMax=_bandMax+1;};if(_talentLevel>1) then{_bandMax=_bandMax+1;};if(_talentLevel>2) then{_bandMax=_bandMax+1;};};private _randomItem=selectRandom _items;private _randomAmount=floor((random(_bandMax-_bandMin))+_bandMin);_itemsToGive pushBack[_randomItem,_randomAmount,_bandFindMessage];}else{private _random=random 100;if(_random<=_percentage) then{private _var=switch(playerSide) do{case west:{};case civilian:{"RR_talent_civ_Gather"};case independent:{"RR_talent_med_gather"};case east:{"RR_talent_syn_Gather"};};private _talentLevel=missionNamespace getVariable[_var,0];if(_mine!="12") then{if(_talentLevel>0) then{_bandMax=_bandMax+1;};if(_talentLevel>1) then{_bandMax=_bandMax+1;};if(_talentLevel>2) then{_bandMax=_bandMax+1;};};private _randomItem=selectRandom _items;private _randomAmount=round((random(_bandMax-_bandMin))+_bandMin);_itemsToGive pushBack[_randomItem,_randomAmount,_bandFindMessage];};};_count=_count+1;};};}forEach("true"span class="re5"> configClasses(missionConfigFile>>"CfgGather">>"Zones">>"Mines"));};if(!_found) then{{private _foundScope=false;private _markers=getArray(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving">>configname _x>>"markerNames");{private _marker=getMarkerPos _x;private _distance=(getPos player) distance _marker;
  44. if(_distance<=_zoneSize) exitWith{_foundScope=true;};}forEach _markers;if(_foundScope) exitWith{_found=true;private _bands=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving">>configName _x>>"bands");_collectMessage=getText(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving">>configName _x>>"findMessage");_toolRequired=getText(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving">>configName _x>>"toolRequired");private _count=1;while{_count<(_bands+1)}do{private _bandName=format["band%1",_count];private _bandNamePercentage=format["band%1Percentage",_count];private _bandNameMax=format["band%1MaxGather",_count];private _bandNameMin=format["band%1MinGather",_count];private _bandNameFindMessage=format["band%1FindMessage",_count];private _items=getArray(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving">>configName _x>>_bandName);private _percentage=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving">>configName _x>>_bandNamePercentage);private _bandFindMessage=getText(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving">>configName _x>>_bandNameFindMessage);private _bandMax=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving">>configName _x>>_bandNameMax);private _bandMin=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving">>configName _x>>_bandNameMin);if(_percentage isEqualTo 100) then{private _var=switch(playerSide) do{case west:{};case civilian:{"RR_talent_civ_Gather"};case independent:{"RR_talent_med_gather"};case east:{"RR_talent_syn_Gather"};};private _talentLevel=missionNamespace getVariable[_var,0];if(_talentLevel>0) then{_bandMax=_bandMax+1;};if(_talentLevel>1) then{_bandMax=_bandMax+1;};if(_talentLevel>2) then{_bandMax=_bandMax+1;};private _randomItem=selectRandom _items;private _randomAmount=floor((random(_bandMax-_bandMin))+_bandMin);_itemsToGive pushBack[_randomItem,_randomAmount,_bandFindMessage];}else{private _random=random 100;if(_random<=_percentage) then{private _var=switch(playerSide) do{case west:{};case civilian:{"RR_talent_civ_Gather"};case independent:{"RR_talent_med_gather"};case east:{"RR_talent_syn_Gather"};};private _talentLevel=missionNamespace getVariable[_var,0];if(_talentLevel>0) then{_bandMax=_bandMax+1;};if(_talentLevel>1) then{_bandMax=_bandMax+1;};if(_talentLevel>2) then{_bandMax=_bandMax+1;};private _randomItem=selectRandom _items;private _randomAmount=round((random(_bandMax-_bandMin))+_bandMin);_itemsToGive pushBack[_randomItem,_randomAmount,_bandFindMessage];};};_count=_count+1;};}}forEach("true"span class="re5"> configClasses(missionConfigFile>>"CfgGather">>"Zones">>"nonMoving"));};if(!_found) then{{private _foundScope=false;private _markers=getArray(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial">>configname _x>>"markerNames");{private _marker=getMarkerPos _x;private _distance=(getPos player) distance _marker;Private _subDistance=300;private _proteusPos=proteus_1;private _morpheusPos=morpheus_1;if((_distance<=_subDistance)&&{((player distance _proteusPos)<20)||((player distance _morpheusPos)<20)}) exitWith{_foundScope=true;};}forEach _markers;if(_foundScope) exitWith{_found=true;private _bands=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial">>configName _x>>"bands");_collectMessage=getText(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial">>configName _x>>"findMessage");_toolRequired=getText(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial">>configName _x>>"toolRequired");private _count=1;while{_count<(_bands+1)}do{private _bandName=format["band%1",_count];private _bandNamePercentage=format["band%1Percentage",_count];private _bandNameMax=format["band%1MaxGather",_count];private _bandNameMin=format["band%1MinGather",_count];private _bandNameFindMessage=format["band%1FindMessage",_count];private _items=getArray(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial">>configName _x>>_bandName);private _percentage=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial">>configName _x>>_bandNamePercentage);private _bandFindMessage=getText(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial">>configName _x>>_bandNameFindMessage);private _bandMax=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial">>configName _x>>_bandNameMax);private _bandMin=getNumber(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial">>configName _x>>_bandNameMin);if(_percentage isEqualTo 100) then{private _var=switch(playerSide) do{case west:{};case civilian:{"RR_talent_civ_Gather"};case independent:{"RR_talent_med_gather"};case east:{"RR_talent_syn_Gather"};};private _talentLevel=missionNamespace getVariable[_var,0];if(_talentLevel>0) then{_bandMax=_bandMax+1;};if(_talentLevel>1) then{_bandMax=_bandMax+1;};if(_talentLevel>2) then{_bandMax=_bandMax+1;};private _randomItem=selectRandom _items;private _randomAmount=floor((random(_bandMax-_bandMin))+_bandMin);_itemsToGive pushBack[_randomItem,_randomAmount,_bandFindMessage];}else{private _random=random 100;if(_random<=_percentage) then{private _var=switch(playerSide) do{case west:{};case civilian:{"RR_talent_civ_Gather"};case independent:{"RR_talent_med_gather"};case east:{"RR_talent_syn_Gather"};};private _talentLevel=missionNamespace getVariable[_var,0];if(_talentLevel>0) then{_bandMax=_bandMax+1;};if(_talentLevel>1) then{_bandMax=_bandMax+1;};if(_talentLevel>2) then{_bandMax=_bandMax+1;};private _randomItem=selectRandom _items;private _randomAmount=round((random(_bandMax-_bandMin))+_bandMin);_itemsToGive pushBack[_randomItem,_randomAmount,_bandFindMessage];};};_count=_count+1;};}}forEach("true"span class="re5"> configClasses(missionConfigFile>>"CfgGather">>"Zones">>"nonMovingSpecial"));};if(!_found) exitWith{life_action_inUse=false;};private _exit=false;if(_toolRequired!="") then{private _valItem=missionNamespace getVariable"life_inv_"+_toolRequired;if(_valItem<1) exitWith{private _itemName=getText(missionConfigFile>>"VirtualItems">>_toolRequired>>"displayName");[format["You need: %1 to gather here!",(localize _itemName)],true,"fast"]call RR_fnc_notificationSystem;life_action_inUse=false;_exit=true;};switch(_toolRequired) do{case"pickaxe":{player say3D"mining"};default{player say3D"harvest"};};};if(_exit) exitWith{life_action_inUse=false;};private _successArray=[];{_x params["_itemVar","_itemAmount","_itemFindString"];private _diff=[_itemVar,_itemAmount,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;};if([true,_itemVar,_diff]call RR_fnc_handleInv) then{_successArray pushBack[_itemFindString,_itemAmount];};}forEach _itemsToGive;for"_i"from 0 to 4 do{player playMoveNow"AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";waitUntil{animationState player!="AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";};uisleep 0.5;};{_x params["_itemFindString","_itemAmount"];_collectMessage=format["%1 %2 %3(s), ",_collectMessage,_itemAmount,_itemFindString];}forEach _successArray;titleText[_collectMessage,"PLAIN"];[7]call RR_fnc_updatePartial;uiSleep 1;life_action_inUse=false;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement