Jump to content

Auto Gather - Mine


GraveYard

Recommended Posts

  

I know a lot of people have been asking how to add auto gather, well here is a very easy way to do it.

At the end of fn_gather.sqf below: 

sleep 1;
life_action_inUse = false;

Add the following:

// Automatically gather again if there are resources nearby
_ie585895 = -1;
_zoneSizeCfg = getNumber(_resourceCfg >> "zoneSize");
if (_zone != "") then {

  waitUntil {
      if (speed player > 0)exitWith{_ie585895  = 0;true};  //moved
      if (life_interrupted) exitWith {_ie585895  = 1;true};  //interrupted key press
      if ((player distance (getMarkerPos _zone)) < _zoneSizeCfg) exitWith {_ie585895 = 2;true}; // left area
    true
  };
    
if (_ie585895 >= 0) exitWith{
   switch _ie585895 do {
        case 0 : {hint "You moved so you stoped gathering"};
        case 1 : {hint "Dont do anything <life_interrupted>"};
        case 2 : {hint "You left the gathering area";};
        };
    };

    [] spawn life_fnc_gather;
};

At the end of fn_mine.sqf below: 

sleep 1;
life_action_inUse = false;

Add the following:

// Automatically gather again if there are resources nearby
_ie585895 = -1;
_zoneSizeCfg = getNumber(_resourceCfg >> "zoneSize");
if (_zone != "") then {

  waitUntil {
      if (speed player > 0)exitWith{_ie585895  = 0;true};  //moved
      if (life_interrupted) exitWith {_ie585895  = 1;true};  //interrupted key press
      if ((player distance (getMarkerPos _zone)) < _zoneSizeCfg) exitWith {_ie585895 = 2;true}; // left area
    true
  };
    
if(_ie585895 >= 0)exitWith{
   switch _ie585895 do {
        case 0 : {hint "Stay still <player speed>"};
        case 1 : {hint "Dont do anything <life_interrupted>"};
        case 2 : {hint "You left the mining area";};
        };
    };
   [] spawn life_fnc_mine;
};

 

Edited by GraveYard
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.