Jump to content
Tova

Simple Convoy Script [RELEASE]

Recommended Posts

Great script, I've used it before and it has worked. But when I've tried using it recently it says

"TOV_fnc_SimpleConvoy|#| = { params ["_convoyGroup",["_con... ERROR Missing ;"

This appears when I paste the script into any init. It has worked before I don't know how I've messed it up this time. Please help, thanks.

Share this post


Link to post
Share on other sites

Got it to work finally. I don't know, but when copying this from the browser straight to the game apparently sometimes something must be thrown out or formated wrong. But it works now beautifully. In over 2 hours of letting the convoys drive around, not once did break! Absolutely baffling that this is not part of the basegame. Have you approached the devs with this script?

Share this post


Link to post
Share on other sites

Thanks for this script, it really solves a big problem. I added an exit condition to it and now the exit does not need to be called manually.

TOV_fnc_SimpleConvoy = 
	{ 
		params ["_convoyGroup",["_convoySpeed",50],["_convoySeparation",50],["_pushThrough", true], ["_condition", {false}]];
		
		if (_pushThrough) then 
			{
				_convoyGroup enableAttack !(_pushThrough);
				{(vehicle _x) setUnloadInCombat [false, false];} forEach (units _convoyGroup);
			};
			
		_convoyGroup setFormation "COLUMN";
		
			{
				(vehicle _x) limitSpeed _convoySpeed*1.15;
				(vehicle _x) setConvoySeparation _convoySeparation;
			} forEach (units _convoyGroup);
			
		(vehicle leader _convoyGroup) limitSpeed _convoySpeed;
		
		while {sleep 5; (!isNull _convoyGroup) && !(call _condition)} do 
			{
				{
					if ((speed vehicle _x < 5) && (_pushThrough || (behaviour _x != "COMBAT"))) then 
						{
							(vehicle _x) doFollow (leader _convoyGroup);
						};	
						
				} forEach (units _convoyGroup)-(crew (vehicle (leader _convoyGroup)))-allPlayers;
				
				{(vehicle _x) setConvoySeparation _convoySeparation;} forEach (units _convoyGroup);
				
				//if (call _condition) exitWith {};
			}; 
		
		/// Exiting:					
		
			{
				(vehicle _x) limitSpeed 5000;
				(vehicle _x) setUnloadInCombat [true, false];
			} forEach (units _convoyGroup);
			
		_convoyGroup enableAttack true;	

		terminate _thisScript;		
	};

spawn it without script handler:

condition = {/*code*/};
[convoyGroup, convoySpeed, convoySeparation, pushThrough, condition] spawn TOV_fnc_SimpleConvoy;

 

  • Like 2

Share this post


Link to post
Share on other sites

Works well, but when I use the russian RHS vehicles it trips, they go off the road and in all directions they aren't supposed to go, and when I use multiple different russian RHS vehicles they just dont work. This had me frustrated alot. Any ideas?

Share this post


Link to post
Share on other sites
26 minutes ago, soundblaster said:

Can we get another download mirror, Armaholic is down 😕

 

Just apply the TOV codes like Ibragim A wrote. It's not so bad (some useless lines)! I'd just add a line to keep drivers in  "careless" behavior by:

if (driver vehicle _x == _x && !isnull vehicle _x) then {_x setCombatBehaviour "careless"};

 

This way, the drivers stay careless and follows the roads each time it's possible. The other crew can engage enemies.

  • Like 2

Share this post


Link to post
Share on other sites
On 7/14/2022 at 1:22 PM, pierremgi said:

 

Just apply the TOV codes like Ibragim A wrote. It's not so bad (some useless lines)! I'd just add a line to keep drivers in  "careless" behavior by:

if (driver vehicle _x == _x && !isnull vehicle _x) then {_x setCombatBehaviour "careless"};

 

This way, the drivers stay careless and follows the roads each time it's possible. The other crew can engage enemies.

I think I found the original one:
 

/**
 * @ Author: Tova (https://forums.bohemia.net/forums/topic/226608-simple-convoy-script-release/)
 * @ Create Time: 2019-11-21 07:20:02
 * @ Version: 2.0.0
 * @ Description: Start a convoy of AI vehicules
 * @ Usage: convoyScript = [convoyGroup, convoySpeed, convoySeparation, pushThrough] spawn TOV_fnc_SimpleConvoy;
 *  Once final waypoint is reached :
 *	 terminate convoyScript;
 *	 {
 *	 	(vehicle _x) limitSpeed 5000;
 *	 	(vehicle _x) setUnloadInCombat [true, false];
 *	 } forEach (units convoyGroup);
 *   convoyGroup enableAttack true;
 */

TOV_fnc_SimpleConvoy = {
	params ["_convoyGroup",["_convoySpeed",50],["_convoySeparation",50],["_pushThrough", true]];
	if (_pushThrough) then {
		_convoyGroup enableAttack !(_pushThrough);
		{(vehicle _x) setUnloadInCombat [false, false];} forEach (units _convoyGroup);
	};
	_convoyGroup setFormation "COLUMN";
	{
    	(vehicle _x) limitSpeed _convoySpeed*1.15;
        (vehicle _x) setConvoySeparation _convoySeparation;
    } forEach (units _convoyGroup);
	(vehicle leader _convoyGroup) limitSpeed _convoySpeed;
	while {sleep 5; !isNull _convoyGroup} do {
		{
			if ((speed vehicle _x < 5) && (_pushThrough || (behaviour _x != "COMBAT"))) then {
				(vehicle _x) doFollow (leader _convoyGroup);
			};
		} forEach (units _convoyGroup)-(crew (vehicle (leader _convoyGroup)))-allPlayers;
        {(vehicle _x) setConvoySeparation _convoySeparation;} forEach (units _convoyGroup);
	};
};

 

Share this post


Link to post
Share on other sites
On 7/14/2022 at 8:22 AM, pierremgi said:

 

I'd just add a line to keep drivers in  "careless" behavior by:

if (driver vehicle _x == _x && !isnull vehicle _x) then {_x setCombatBehaviour "careless"};

This way, the drivers stay careless and follows the roads each time it's possible. The other crew can engage enemies.

 

Added.

 

On 9/21/2021 at 5:07 AM, Ibragim A said:

I added an exit condition to it and now the exit does not need to be called manually

 

Using it.

 

Somehow, the script doesn't work properly anymore. As @YarnoR said, (and even with just the vanilla loaded) the vehicle behaviors are awful in my tests, going out of the way at the beginning.

Look by your self and any help could clarify for many of us:
https://drive.google.com/file/d/1CaNtFI2zwSY3SRtokWRdC-j33PXtHOmJ/view?usp=sharing

Share this post


Link to post
Share on other sites

That's because you mix sqf, function and you omit parameter(s) (group).

Your wrong way: in your initSever.sqf (autorun ok), you are execVMing an sqf (without parameter) and this sqf includes a code supposed to be a function you are trying to run via init field of the group.

 

one correct way (not the unique one) : disregard initServer.sqf, then execVM your sqf from the init field, but the sqf must be cleaned (it's already a code so no need for a function here).

Here my simplified version of your mission with that process:

https://www.dropbox.com/sh/ogio70vnos3r7cb/AAAFzOrP4odPnEaCV7t8bdWCa?dl=0

 

You can also create a function in description.ext with cfgFunctions and a reference to you sqf. This way the function will be compiled and ready for use. In Init field, you spawn the function, you don't execVM the sqf.

 

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

That's because you mix sqf, function and sometimes you omit parameters (group).

Here my simplified version of your mission:

https://www.dropbox.com/sh/ogio70vnos3r7cb/AAAFzOrP4odPnEaCV7t8bdWCa?dl=0

 

 

Thanks, @pierremgi

For you that won't download the file above:

 

0) Drag and drop the convoy vehicles, connecting each other to be the same group;

 

1) Copy and paste the code line below in the INIT of the group composition;

if (isServer) then {this execVM "TOV_fnc_SimpleConvoy.sqf"};

 

2) Into your mission folder, create the file TOV_fnc_SimpleConvoy.sqf, adding in its content:

// Original Bohemia Forums post: https://forums.bohemia.net/forums/topic/226608-simple-convoy-script-release/


params [["_convoyGroup", grpNull],["_convoySpeed", 50],["_convoySeparation", 50],["_condition", {false}]];

systemChat str _convoyGroup;

_convoyGroup setFormation "COLUMN";
_convoyGroup setBehaviour "SAFE";

private _vehicles = vehicles select {group _x == _convoyGroup};

systemChat str _vehicles;

{
	_x limitSpeed _convoySpeed*1.15;
	_x setConvoySeparation _convoySeparation;
	driver _x setCombatBehaviour "CARELESS";
} forEach _vehicles;

waitUntil {sleep 5; (!isNull _convoyGroup) && !(call _condition) };

{
	_x limitSpeed _convoySpeed*1.15;
	_x setConvoySeparation _convoySeparation;
	driver _x setCombatBehaviour "CARELESS";
} forEach _vehicles;
_convoyGroup enableAttack true;

 

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

×