Jump to content
Sign in to follow this  
ArmaMan360

Unable to make heli follow land leader wp

Recommended Posts

...

_convoy = [_vehicle1,_vehicle2,_vehicle3,_vehicle4];
{
  createVehicleCrew _x;
  _x setskill 0.7;
  _grp = group _x;
  _x = _grp addWaypoint [_mkrpos, 0];
  _x setWaypointType "MOVE";
  _x setWaypointSpeed "LIMITED";
  _x setWaypointBehaviour "SAFE";
  _x setWaypointFormation "COLUMN";//"STAG COLUMN"

} foreach _convoy;

sleep 1.5;

_array = _convoy;
{
waituntil {sleep 0.5; ((_mkrpos distance _x) < 40);};
} foreach _array;

hint "obj failed";

So _vehicle1 and _Vehicle 4 are assigned as guard units, and _Vehicle2 and _Vehicle3 are trucks which need to be protected. _Vehicle4 on the otherhand can be a heli or an MRAP as my array has both and put on selectrandom.

 

I am able to spawn everyone and if they are all land vehicles they start moving as planed, i.e. in a column formation. But if _vehicle4 returns a heli, it makes its own wp to the destination and moves toward it as a single unit, away from the group. The land units obey me very well.

 

So I want to make _vehicle1 as the leader of this group, and a way for the _vehicle2, _vehicle3, and _vehicle4 to follow the leader strictly in column formation.

 

Thank you. :)

Share this post


Link to post
Share on other sites

It seems like you are not actually grouping the units/vehcles, but rather they are given waypoints as single units and the fact that the land vehicles stick together is more likely a coincidence. The chopper gets his waypoints and heads straight there not regarding anything else.

 

If you want to group the units then try with the join command. However this will probably not help with the chopper since it will fly straight to its waypoint anyway. How about skipping the grouping thing and just using doFollow on all the units telling them to follow vehicle1 and then give only vehicle1 the waypoints? I dont know if it works but thats what I would try. 

Share this post


Link to post
Share on other sites

Yea i was thinking something like "dofollow". Thank you for the hint man. You are always with the right advice. I will get back with results. :)

Share this post


Link to post
Share on other sites

Finallyyy...
Here if someone needs it :D

call compile preprocessfile "SHK_pos\shk_pos_init.sqf";
_sidepos = getMarkerPos "m1";

// Spawn enemy convoy
_grp = createGroup west;
_vehlist = ["B_MRAP_01_hmg_F", "B_MRAP_01_gmg_F", "B_APC_Wheeled_01_cannon_F"];
_trklist = ["afr_kamaz_covered", "B_Truck_01_covered_F", "B_Truck_01_box_F"];

_mkrpos = [_sidepos, [4000,5500], [120,180], 0, [2,5000]] call SHK_pos;
_mkr = createmarker ["here", _mkrpos];
_mkr setMarkerShape "Icon";
_mkr setMarkerType "hd_destroy";
_mkr setMarkerColor "ColorBlufor";
_mkr setMarkerText "Stop the convoy from reaching here";

sleep 0.5;

_newPos = [_sidepos, 0, 25, 1, 0, 200, 0, []] call BIS_fnc_findSafePos;
_vehtype = (count _vehlist )-1;
_type = _vehlist select (round random _vehtype);
_vehicle1 = createVehicle [_type, _newpos, [], 0, "FORMATION"];
createVehicleCrew _vehicle1;
_vehicle1 setskill 0.7;
_vehicle1 setRank "COLONEL";
_grp = group _vehicle1;
_ldr = _vehicle1;
_wp1 = _grp addWaypoint [_mkrpos, 0];
_vehicle1 setWaypointType "MOVE";
_vehicle1 setWaypointSpeed "LIMITED";
_vehicle1 setWaypointBehaviour "SAFE";
_vehicle1 setWaypointFormation "COLUMN";
sleep 1;

_newPos = [_sidepos, 0, 25, 1, 0, 200, 0, []] call BIS_fnc_findSafePos;
_vehtype = (count _trklist )-1;
_type = _trklist select (round random _vehtype);
_vehicle2 = createVehicle [_type, _newpos, [], 0, "FORMATION"];
createVehicleCrew _vehicle2;
_vehicle2 setskill 0.7;
_vehicle2 setRank "LIEUTENANT";
sleep 1;

_newPos = [_sidepos, 0, 25, 1, 0, 200, 0, []] call BIS_fnc_findSafePos;
_vehtype = (count _trklist )-1;
_type = _trklist select (round random _vehtype);
_vehicle3 = createVehicle [_type, _newpos, [], 0, "FORMATION"];
createVehicleCrew _vehicle3;
_vehicle3 setskill 0.7;
_vehicle3 setRank "LIEUTENANT";
sleep 1;

_newPos = [_sidepos, 0, 25, 1, 0, 200, 0, []] call BIS_fnc_findSafePos;
_backend = ["B_Heli_Light_01_armed_F", "B_Heli_Transport_01_F"];
_type4 = _backend  call BIS_fnc_selectRandom;
_vehicle4 = createVehicle [_type4, _newpos, [], 0, "NONE"];
createVehicleCrew _vehicle4;
_vehicle4 setskill 0.7;
_vehicle4 setRank "CAPTAIN";

[_vehicle2, _Vehicle3, _vehicle4] join _ldr;


sleep 1.5;

_convoy = [_vehicle2, _vehicle3];
{
waituntil {sleep 0.5; ((_mkrpos distance _x) < 50);};
} foreach _convoy;

hint "obj failed";

Share this post


Link to post
Share on other sites

Glad I can help ^^

Just so you know. vehicle1 is not anymore the vehicle you created. After you run _vehicle1 = _grp addWaypoint [_mkrpos, 0]; vehicle1 is a waypoint. It might be a problem later if you want to call the vehicle1. I recomend using another variable for the waypoint like _wp1 or something.

Share this post


Link to post
Share on other sites

Ohhhhh yeahhh thanks... hate these small mistakes... :P

Share this post


Link to post
Share on other sites

The problem I had with choppers following vehicles/players is that they have a default min move distance.

They only move when the given distance is greater than 50 meters I think it is, so what you get can look very stop go.

Share this post


Link to post
Share on other sites

The problem I had with choppers following vehicles/players is that they have a default min move distance.

They only move when the given distance is greater than 50 meters I think it is, so what you get can look very stop go.

In a way it is but it is satisfying :D

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×