Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_gather.sqf
  4. Author: Arma 3 Life [www.arma3-life.com/]
  5.  
  6. Description:
  7. Main functionality for gathering.
  8. */
  9. closeDialog 0;
  10. private["_gather","_itemWeight","_diff","_itemName","_val","_resourceZones","_zone","_seeds"];
  11. _resourceZones = ["wheat_1","wheat_2","sunflower_1","sunflower_2","corn_1","bean_1","cotton_1","olive_1","opium_1","cannabis_1","pumpkin_1"];
  12. _zone = "";
  13.  
  14.  
  15. {
  16. if(player distance (getMarkerPos _x) < 30) exitWith {_zone = _x;};
  17. } foreach _resourceZones;
  18.  
  19. if(_zone == "") exitWith {
  20. hint localize "STR_NOTF_notNearResource";
  21. life_action_inUse = false;
  22. };
  23.  
  24. //Get the resource that will be gathered from the zone name...
  25. switch(true) do {
  26. case (_zone in ["wheat_1"]): {_gather = "wheat"; _seeds = "wheat seed"; _val = 3;};
  27. case (_zone in ["wheat_2"]): {_gather = "wheat"; _seeds = "wheat seed"; _val = 3;};
  28. case (_zone in ["sunflower_1"]): {_gather = "sunflower"; _seeds = "sunflower seed"; _val = 3;};
  29. case (_zone in ["sunflower_2"]): {_gather = "sunflower"; _seeds = "sunflower seed"; _val = 3;};
  30. case (_zone in ["corn_1"]): {_gather = "corn Plant"; _seeds = "corn seed"; _val = 3;};
  31. case (_zone in ["bean_1"]): {_gather = "bean Plant"; _seeds = "bean seed"; _val = 3;};
  32. case (_zone in ["cotton_1"]): {_gather = "cotton Plant"; _seeds = "cotton seed"; _val = 3;};
  33. case (_zone in ["olive_1"]): {_gather = "olive Plant"; _seeds = "olive seed"; _val = 3;};
  34. case (_zone in ["opium_1"]): {_gather = "opium Poppy"; _seeds = "opium seed"; _val = 1;};
  35. case (_zone in ["cannabis_1"]): {_gather = "cannabis Plant"; _seeds = "cannabis seed"; _val = 1;};
  36. case (_zone in ["pumpkin_1"]): {_gather = "pumpkin"; _seeds = "pumpkin seed"; _val = 1;};
  37. default {""};
  38. };
  39.  
  40. //gather check??
  41. if(vehicle player != player) exitWith {hint localize "STR_NOTF_GatherVeh";};
  42.  
  43. life_action_inUse = true;
  44.  
  45. _plantnearby = false;
  46.  
  47. _plantclsnamearr = [
  48. "A3L_Wheat",
  49. "A3L_Corn",
  50. "A3L_Beans",
  51. "A3L_Cannabis",
  52. "A3L_Cotton",
  53. "Ficus_Bush_1",
  54. "A3L_Pumpkin",
  55. "A3L_Sunflower",
  56. "Oleander2"
  57. ];
  58.  
  59. {
  60. _objectarr = nearestObjects [player, [_x], 3];
  61. if(count _objectarr == 0) then {} else {_plantnearby = true;};
  62. } foreach _plantclsnamearr;
  63.  
  64. if(_plantnearby) then
  65. {
  66. ["Too close to another plant",20,"red"] call A3L_Fnc_Msg;
  67. life_action_inUse = false;
  68. } else {
  69. if(!([false,_seeds,1] call life_fnc_handleInv)) exitWith {
  70. ["You need to buy seeds at the Farming Market",20,"red"] call A3L_Fnc_Msg;
  71. life_action_inUse = false;
  72. };
  73. _plantedtext = format["You planted some %1",_gather];
  74. [_plantedtext,20,"red"] call A3L_Fnc_Msg;
  75. [[player,_gather],"svr_plantseed",false,false,false] spawn life_fnc_MP;
  76. life_action_inUse = false;
  77. player playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
  78. waitUntil{animationState player != "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";};
  79. sleep _time;
  80. };
  81.  
  82. if ([true,_resource,_diff] call life_fnc_handleInv) then {
  83. _itemName = M_CONFIG(getText,"VirtualItems",_resource,"displayName");
  84. titleText[format [localize "STR_NOTF_Gather_Success",(localize _itemName),_diff],"PLAIN"];
  85. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement