Hello again Sirglider,
I can see a couple of problems, and would make a few suggestions as well.
Your first problem is that the waypoint X/Y is uncoupled:
If (abs ((Temppos select 0) - (_RangerWP select 0)) > 50) then {Call format ["Ranger%1WP = Temppos; publicvariable {Ranger%1WP}",_IDofRanger]; _objRanger sidechat format ["Roger, UAV %1 moving to %2",_IDofRanger,Temppos]}
If (abs ((Temppos select 1) - (_RangerWP select 1)) > 50) then {Call format ["Ranger%1WP = Temppos; publicvariable {Ranger%1WP}",_IDofRanger]; _objRanger sidechat format ["Roger, UAV %1 moving to %2",_IDofRanger,Temppos]}
That is, it reads:
IF THE X HAS CHANGED BY MORE THAN 50 M, CHANGE THE X
IF THE Y HAS CHANGED BY MORE THAN 50 M, CHANGE THE Y
It would be more effective (and have less weirdness), if you set it to:
IF THE (X OR Y) HAS CHANGED BY MORE THAN 50 M, CHANGE THE (X AND Y)
--
Another problem is the game engine. If you give a MOVE order or set a waypoint for a long distance, the pathfinding routine will time out, and the object will not move.
--
But the big problem is exactly as the others stated: you cannot use PublicVariable on an array. It doesn't work.
SUGGESTIONS:
There are two ways around the "Cannot transmit 3D coordinates" problem.
First, you can break _RANGER%WP into _RANGER%WPX and _RANGER%WPY, and give them integer values.
Second, you can CreateVehicle a Gamelogic and SetPos it.
So when the UAV inits, you would do something local to server only like:
(where _objRanger 1 indicates the UAV's name)
call format ["Ranger%1WP={Logic}CreateVehicle [0,0,0]; Ranger%1WP SetPos getpos _objRanger; publicvariable {Ranger%1WP}", _IDofRanger]
Then, your OnMapSingleClick code looks like:
OnMapSingleClick {call format ["Ranger%1WP Setpos _pos", IDSelectedRanger]; [] call MyMapClickHandlerFunction}
That will update the waypoint position. A side benefit to this is that you can use the DISTANCE command to find if it's moved.
This brings me to my second suggestion:
You don't need a Loop to check (poll) if the Map has been clicked: it's much more effective to start a function at that event that does what you need to do (this is what MyMapClickHandlerFunction does).
And if you use a network layer like CoC Network Services you can automate the whole process by sending a remotecall to handle the change in waypoint on the other side. (but that may be too much).
In any case, the loop for the UAV's control system, checking if the waypoint has changed, should not be too frequent. I would put in a delay of say ~.5 or so: no need for instant controls. In any case, there is little sense in checking for changes in MP status shorter than ~.1, since the MP updates at its fastest at 5 Hz.
And you will probably need some sort of fix for really long waypoints: either an error message, or an intermediate waypoint or set of waypoints.
Cheers!