Better Convoy

If you liked this item, please rate it up on Steam Workshop page.

Author: nagas

Last revision: 14 May, 2022 at 20:01 UTC

File size: 97.28 KB

On Steam Workshop

Description:

The main function of this mod is to compose a vehicle formation where the follower vehicles reproduce the same path of the lead vehicle, by means of the setDriveOnPath function. In this fashion, this mod seeks to avoid situations where the followers would become stuck or would simply refuse to follow, which usually arrise in a traditional column group formation.
A secondary function of the mod is to regulate the speed of the convoy. This is performed according to the vehicles’ separation distances, relative speeds and the overall convoy curvature. The governing parameters are available for tuning.
The mod was tested for wheeled and tracked vehicles and it can be used on roads or off-road. This mod does not introduce any AI modifications and therefore the convoy’s path and behavior may be further improved with AI driving mods.
Personally, I find that using the mod is a more robust option. However, if the lead vehicle is not able to properly pathfind it might still be necessary to adjust its waypoints.

Instructions

In the editor, you can find the module in Systems/Modules/Effects/Convoy.
First, place the convoy vehicles, including the lead vehicle, in distinct groups.
Then, decide the order of the convoy and sync each vehicle with this module in the previously decided order (i.e. the lead vehicle must be synced first).
Finally, set the waypoints for the lead vehicle and run your mission.

Scripting Implementation

If the mission maker prefers to use the script directly, then the following example is instructive.

// create the logic (alternative to placing a synchronized module named Convoy_01)
logicCenter_01 = createCenter sideLogic;
logicGroup_01 = createGroup logicCenter_01;
Convoy_01 = logicGroup_01 createUnit ["Logic", [0,0,0], [], 0, "NONE"];
Convoy_01 setVariable ["maxSpeed", 40];
Convoy_01 setVariable ["convSeparation", 35];
Convoy_01 setVariable ["stiffnessCoeff", 0.2];
Convoy_01 setVariable ["dampingCoeff", 0.6];
Convoy_01 setVariable ["curvatureCoeff", 0.3];
Convoy_01 setVariable ["stiffnessLinkCoeff", 0.1];
Convoy_01 setVariable ["pathFrequecy", 0.05];
Convoy_01 setVariable ["speedFrequecy", 0.2];
Convoy_01 setVariable ["speedModeConv", "NORMAL"];
Convoy_01 setVariable ["behaviourConv", "pushThroughContact"];
Convoy_01 setVariable ["debug", false];

// create the convoy
call{ 0 = [Convoy_01,[vehicleLead,vehicle2,vehicle3]] execVM "nagas_Convoyfunctionsfn_initConvoy.sqf" };

// stop the convoy without erasing its waypoints
Convoy_01 setVariable ["maxSpeed", 0];
sleep 5; // wait for all vehicles to stop

// disband the convoy
vehicleLead setVariable ["convoy_terminate", true];
sleep .5; // wait for script to finish

// create a new convoy with only the first two vehicles
call{ 0 = [Convoy_01,[vehicleLead,vehicle2]] execVM "nagas_Convoyfunctionsfn_initConvoy.sqf" };

// resume
Convoy_01 setVariable ["maxSpeed", 40];