So, reading through them in detail, I see the functions as doing the following:
1.) take a unit, eg the player
2.) camcreate a dummy soldier 2 metres away from the player in specified directions (0, 45, 90, 135 etc degrees), AND 1 metre up into the air.
3.) Loop, checking each time that the x and y coordinates of the camcreated soldier are exactly equal to the x and y of the initial position (where the dummy was created).
4.) In the body of the loop, you call a function which moves the dummy 0.1 metres further away from the player, in the initial direction.
Immediately, you can see the loop will be broken as the position of the camcrated soldier is no longer the same as its starting position. You would need to update _pos, from gatherdata.sqf, as well. I see what you are trying to do though. You are moving the test soldier to a position, and testing to see whether or not he could actually be moved there; if he couldn't then you assume that there is some form of cover blocking him.
I would do away with move_probe altogether, and change some things in gatherdata, like this:
GatherData.sqfprivate ["_unit","_dir","_pos","_orig_pos","_cover","_probe","_return"];
_unit = _this select 0;
_dir = _this select 1;
_pos = [(getpos _unit select 0) + (2 * sin _dir),(getpos _unit select 1) + (2 * cos _dir),0];
_orig_pos = _pos;
_cover = false;
_probe = "soldierwb" camcreate _pos;
while "((getpos _probe select 0) == (_pos select 0) && (getpos _probe select 1) == (_pos select 1))) ||
(sqrt((((_pos select 0) - (_orig_pos select 0))^2) + (((_pos select 1) - (_orig_pos select 1))^2)) >= 5)" do
{
_pos = [(_pos select 0) + (.1 * sin _dir),(_pos select 1) + (.1 * cos _dir),0];
_probe setpos _pos;
};
if (sqrt((((_pos select 0) - (_orig_pos select 0))^2) + (((_pos select 1) - (_orig_pos select 1))^2)) < 5) then {_cover = true};
deletevehicle _probe;
_return =[_cover,_pos,_dir];
_return
I've added the condition from move_probe to this function; that is if the probe is more than 5 metres from the original position , scrub the attempt to find cover. Also, _pos is updated in the loop body as well as moving the probe, and then at the end of each loop the pos is checked again (to see if the move was successful).
Unfortunately, I'm fairly certain that the setpos attempt will always be returned as successful regardless of whether there was anything blocking the attempt; that's what happened when i tried doing a similar thing in a function. The actual move takes a certain amount of time (i believe ofp waits until the next game 'tick' to actually
move the object, despite setting it's position as described in the setpos instantly). However, you might have more success than i did. Failing that, you will have to resort to a script with a small ~ delay.