Jump to content
Sign in to follow this  
THEBLITZ6794

convoys...again

Recommended Posts

i have (in this order)

LAV-25

m2 humvee

truck

ambulance

ammo

fuel

m2 humvee

all are loaded full of men incase of ambush

i forced speed 2 8. i synced their way points. i put them in HC, ect. they cant make a fucking convoy.

wut do i do?

Share this post


Link to post
Share on other sites

its broken in Arma2, they just try to drive around each other, its ridiculous. I loved attacking convoys in A1 but I can't in A2.

Share this post


Link to post
Share on other sites

I made a convoy ambush mission a few nights ago, worked decent on the editor. When it was put on a dedicated server, they screwed up the paths, drove off the road, messed up the entire ambush. Hopefully it gets fixed.

Share this post


Link to post
Share on other sites

I have tryed making a convoy to, i had some Humvees and 2 LAV, then i set all units in noformation, and created a waypoint far away, with formation line, that workt for me.

Share this post


Link to post
Share on other sites

I use a little script. it is not very professionell, cause no function, but it works.

First you have to build a convoy with the editor. Every vehicle in his own group with one or more waypoints, and every vehicle with a name (vehicle1, vehicle2). its not very comfortable, i know :)

the first vehicle will get the speed "Limited" with the waypoint or with setspeedmode "limited".

the second vehicle needs this in the init line:

[vehicle1,vehicle2] exec "konvoi.sqs"

the third vehicle

[vehicle2,vehicle3] exec "konvoi.sqs"

and this is the konvoi.sqs:

_fahrzeug1=_this select 0

_fahrzeug2=_this select 1

#konvoi

? _fahrzeug1 distance _fahrzeug2 > 35: goto "tempo"

? _fahrzeug1 distance _fahrzeug2 < 25: goto "stop"

~0.1

goto "konvoi"

#tempo

_fahrzeug2 setspeedMode "normal"

@ _fahrzeug1 distance _fahrzeug2 < 45

_fahrzeug2 setspeedMode "limited"

goto "konvoi"

#stop

_fahrzeug2 stop true

@ _fahrzeug1 distance _fahrzeug2 > 15

_fahrzeug2 stop false

goto "konvoi"

exit

if someone wants to change this into a function, no problem.

Now you have a slow real convoy.

Share this post


Link to post
Share on other sites

Doesn't SAFE + LIMITED for the lead (highest rank) vehicle function properly?

Share this post


Link to post
Share on other sites

I've been trying to make a sqf script for a convoy, with mixed results, but I'll post it anyway, see what you think.

Any help, suggestions, improvements very welcome. :)

First my sqf script based on Rohrkrepierer's sqs.

I'm quite pleased with the results with this, seems to keep them in the proper station for the convoy.

station.sqf

if (isServer) then {

_Veh1 = _this select 0;
_Veh2 = _this select 1;

while {true} do
{
	if ((_Veh2 distance _Veh1) >=10) then
	{
		if ((_Veh2 distance _Veh1) <30) then
		{
			_Veh2 limitSpeed 5;
		}
		else
		{
			_Veh2 forceSpeed -1;
		};
	}
	else
	{
			 _Veh2 stop true;
	};
};
};

Now the second script which makes the convoy (inside the spoiler). I decided to spawn the vehicles with a script rather than place them in the Editor

because I can create the convoy in one spot, instead of making a long line of vehicles etc.

Place two markers name them (start and Fini) with axis a & b at 0 (put the name in the text box as well so you can find them)

I tried calling a waypoint script using addWaypoint but they don't complete as well as they do with

	_Veh doMove (getmarkerpos "Fini");
_Veh setSpeedMode "LIMITED";

I also made a "waypoint" script with doMove, to call in the convoy script, which works better.

But (this is the main problem that I haven't really overcome yet) I find if you try and add any sort of complexity into the route

then the chances of them messing up increases, but if you needed them to stop for a while you can do that.

So for simplicities sake I just put a finish marker for the convoy to move to in the convoy.sqf with the above doMove code.

One problem I did find with this is that if you come to a sharp corner where they can cut across the grass, they will and generally get stuck.

Otherwise they will follow the main route to the destination. See inside the spoiler for the convoy script.

convoy.sqf

if (isServer) then {
_grp = _this select 0;
_grp= createGroup WEST;

_Veh = "HMMWV_M2" createVehicle getmarkerpos "start";
_Drive = _grp createunit ["USMC_Soldier", [0,0,1], [], 0,"NONE"];
_Gunner =_grp createunit ["USMC_Soldier", [0,0,2], [], 0,"NONE"];
_Veh setDir 56;//set the vehicle heading
_Drive  moveInDriver _Veh;
_Gunner moveInGunner _Veh;

_Veh doMove (getmarkerpos "Fini");//instead of waypoints
_Veh setSpeedMode "LIMITED";
sleep 10;//lead vehicle moves of and the second vehicle spawns
_Veh1 = "MTVR" createVehicle getmarkerpos "start";
_Drive1 = _grp createunit ["USMC_Soldier", [0,0,1], [], 0,"NONE"];
_Veh1 setDir 56;
_Drive1 moveInDriver _Veh1;

_Veh1 doMove (getmarkerpos "Fini");
_Veh1 setSpeedMode "LIMITED";
call { [_Veh,_Veh1] execVM "station.sqf"; } ;//calls the station sqf above
sleep 10;
_Veh2 = "MTVR" createVehicle getmarkerpos "start";
_Drive2 = _grp createunit ["USMC_Soldier", [0,0,1], [], 0,"NONE"];
_Veh2 setDir 56;
_Drive2 moveInDriver _Veh2;

_Veh2 doMove (getmarkerpos "Fini");
_Veh2 setSpeedMode "LIMITED";
call { [_Veh1,_Veh2] execVM "station.sqf"; } ;
sleep 10;
_Veh3 = "MTVR" createVehicle getmarkerpos "start";
_Drive3 = _grp createunit ["USMC_Soldier", [0,0,1], [], 0,"NONE"];
_Veh3 setDir 56;
_Drive3 moveInDriver _Veh3;

_Veh3 doMove (getmarkerpos "Fini");
_Veh3 setSpeedMode "LIMITED";

call { [_Veh2,_Veh3] execVM "station.sqf"; } ;
//sets group leader and formation
_Drive setunitrank "SERGEANT";
_Drive=leader _grp;
_grp setFormation "COLUMN";

};

Edited by Padjur
replacing moveTo2.sqf with station.sqf

Share this post


Link to post
Share on other sites

This is actually the best working convoyscript I've encountered so far (after replacing moveTo2.sqf with station.sqf in convoy.sqf).

Thank you Padjur

Edited by DTM2801

Share this post


Link to post
Share on other sites

:oops: sorry missed that when posting. Thanks. Glad its of use to you. I would like to find ways to improve the AI driving skills, any help on that or any other parts from anyone, would be much appreciated.

Share this post


Link to post
Share on other sites

I have always simple put all the convoy vehicles in one group and have column compact. The group slows down so vehicles in the rear can catch up, and they maintain perfect formation.

Beats me why you have so much trouble. :p

Share this post


Link to post
Share on other sites

@Rommel would like to see a movie of that convoy maintaining formation, especially with multiple waypoints. The halt -> next waypoint -> drive vehicle behaviour makes the following convoy vehicles reverse, go left , go right, turn and maybe afterwards continue and join the leader in formation again.

I've made some adjustments to Pudjur's version of the convoy script, I've changed the vehicle spawn code and incorporated waypoints.

convoy.sqf:

if (isServer) then {
private ["_grp","_veh","_Veh1","_veh2","_veh3","_veh4"];
_grp = _this select 0;
_grp = createGroup WEST;
_sleep = 7;

_veh = [(getmarkerpos "start"), (markerdir "start"),"HMMWV_M2", _grp] call BIS_fnc_spawnVehicle;

_wp1 = _grp addWaypoint [(getmarkerpos "convoy1"), 0];
_wp1 setWaypointSpeed "LIMITED";
_wp1 setWaypointType "MOVE";
_wp1 setWaypointFormation "FILE";
_wp1 setWaypointBehaviour "SAFE";
_wp2 = _grp addWaypoint [(getmarkerpos "convoy2"), 0];
_wp2 setWaypointType "MOVE";
_wp3 = _grp addWaypoint [(getmarkerpos "convoy3"), 0];
_wp3 setWaypointType "MOVE";
_wp4 = _grp addWaypoint [(getmarkerpos "convoy4"), 0];
_wp4 setWaypointType "MOVE";
_wp5 = _grp addWaypoint [(getmarkerpos "fini"), 0];
_wp5 setWaypointType "CYCLE";

sleep _sleep;

_veh1 = [(getmarkerpos "start"), (markerdir "start"),"MTVR", _grp] call BIS_fnc_spawnVehicle;
_veh1 call { [_Veh1,_Veh] execVM "convoy_control.sqf"; } ;

sleep _sleep;

_veh2 = [(getmarkerpos "start"), (markerdir "start"),"MTVR", _grp] call BIS_fnc_spawnVehicle;
_veh2 call { [_Veh2,_Veh1] execVM "convoy_control.sqf"; } ;

sleep _sleep;

_veh3 = [(getmarkerpos "start"), (markerdir "start"),"MTVR", _grp] call BIS_fnc_spawnVehicle;
_veh3 call { [_Veh3,_Veh2] execVM "convoy_control.sqf"; } ;

sleep _sleep;

_veh4 = [(getmarkerpos "start"), (markerdir "start"),"HMMWV_M2", _grp] call BIS_fnc_spawnVehicle;
_veh4 call { [_Veh4,_Veh3] execVM "convoy_control.sqf"; } ;
_veh4 call { [_Veh,_Veh4] execVM "convoy_leader.sqf"; } ;

};

Waypoints are created on the marker positions and vehicles are created in the first marker direction. So just place the markers (in this code named: start, convoy1, convoy2, convoy3, convoy4, fini) on the map, start convoy.sqf and your convoy is ready to go.

convoy_control.sqf:

_unit1 = _this select 0;
_unit2 = _this select 1;

_control1 = _unit1 select 0;
_control2 = _unit2 select 0;

_loop = true;

while {_loop} do {
sleep 5;
if ((_control1 distance _control2) < 50) then {

if ((_control1 distance _control2) < 30) then {
_control1 limitSpeed 5;
// DEBUG
_control1 sideChat format ["in formation"];
// DEBUG
} else {
_control1 forceSpeed -1;
// DEBUG
_control1 sideChat format ["catching up"];
// DEBUG
};
};
};

convoy_leader.sqf:

_first = _this select 0;
_last = _this select 1;

_cfirst = _first select 0;
_clast = _last select 0;

_leader= true;
PAPABEAR=[West,"HQ"]; 

while {_leader} do {
sleep 5;
if ((_cfirst distance _clast) > 130) then {
_cfirst forcespeed 1;
// DEBUG
PAPABEAR sideChat format ["leader wait"];
// DEBUG
} else {
_cfirst forcespeed -1;
// DEBUG
PAPABEAR sideChat format ["leader normal"];
// DEBUG
};
};
};

There is an extra distance check between the convoyleader and last vehicle, which will make de leader slowdown to let the convoy regroup.

I left the debug checks enabled so you can see how the vehicles are handling the control script.

Edited by DTM2801
code update

Share this post


Link to post
Share on other sites

Issues I've encountered so far:

- Convoy breaks completely when leadervehicle is destroyed.

- Minor unwanted movement of the vehicles when changing waypoints, but convoy formation restores fairly quickly.

Some feedback would be nice

Edited by DTM2801

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  

×