Guest User

Untitled

a guest
Mar 1st, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. /*
  2. File: fn_whereAmI.sqf
  3. Author: Dardo
  4.  
  5. Description:
  6. Return the nearest kind of resource field to the player
  7.  
  8. mine
  9. resource
  10. nothing
  11. */
  12.  
  13. private ["_zonem", "_zone", "_mine", "_zoneSize", "_resource", "_nothing"];
  14. _resourceCfg = missionConfigFile >> "CfgGather" >> "Minerals";
  15.  
  16. for "_i" from 0 to count(_resourceCfg)-1 do {
  17. private ["_curConfig", "_resourceZones", "_requiredItem"];
  18. _zonem = "";
  19. _curConfig = _resourceCfg select _i;
  20. _resourceZones = getArray(_curConfig >> "zones");
  21. _zoneSize = getNumber(_curConfig >> "zoneSize");
  22. {
  23. if ((player distance2D(getMarkerPos _x)) < _zoneSize) exitWith {
  24. _zonem = _x;
  25. };
  26. } forEach _resourceZones;
  27. if (_zonem != "") exitWith {};
  28. };
  29.  
  30. if (_zonem != "") exitWith {
  31. _mine = "mine";
  32. _mine;
  33. };
  34.  
  35.  
  36.  
  37. _resourceCfg = missionConfigFile >> "CfgGather" >> "Resources";
  38. for "_i" from 0 to count(_resourceCfg)-1 do {
  39. private ["_curConfig", "_resourceZones", "_requiredItem"];
  40. _zone = "";
  41. _curConfig = _resourceCfg select _i;
  42. _resourceZones = getArray(_curConfig >> "zones");
  43. {
  44. if ((player distance2D(getMarkerPos _x)) < _zoneSize) exitWith {
  45. _zone = _x;
  46. };
  47. } forEach _resourceZones;
  48. if (_zone != "") exitWith {};
  49. };
  50. if (_zone != "") exitWith {
  51. _resource = "resource";
  52. _resource;
  53. };
  54. if (_zone isEqualTo "") exitWith {
  55. _nothing = "nothing";
  56. _nothing;
  57. };
Advertisement
Add Comment
Please, Sign In to add comment