Jump to content
Sign in to follow this  
DTM2801

Convoy creator & convoy control v1.0

Recommended Posts

Very nice work!

But what about a route without end? Some Missions need a convoy that continuesly drive around a city or something like that.

If 4 of the 5 cars are destroyed, the last car of the convoy just stand still. That could be improved. It should drive to the next waypoint.

The Problem with the never ending route is solved by usage #4 (Version1.5), thanks.

The 2nd problem occurs sometimes with usage #1, as far as I have tested (Version 1.4!).

In Version 1.5 I have not seen this, but it doesn´t occur any time. Just a few times, when I shot vehicles with an OPFOR Helicopter, it looks like the last vehicle can´t remember the waypoints and just stand still.

Share this post


Link to post
Share on other sites

Very nice and usefull script! :)

Put it on our scripts section at Assault Mission Studio

dlicon.gif

Convoy Creator & Convoy Control [1.5] by DTM2801

Share this post


Link to post
Share on other sites

Question please: So if your using a Game Logic how would one go about not starting the Convey until sometime into the mission?

Share this post


Link to post
Share on other sites
Question please: So if your using a Game Logic how would one go about not starting the Convey until sometime into the mission?

You can put the initstring in the On Act. field of a trigger.

The GL will only function as a locationholder then, so leave the initfield empty.

-Place a GL on the map where you want the convoy to start and give the GL a name, lets say for this example GLNAME.

example with standard initstring:

 null= [[b]GLNAME[/b],WEST,["convoywp1","convoywp2","convoywp3"],5,7,[],[],true,false]execvm "convoy.sqf";

Hope this helps :)

Share this post


Link to post
Share on other sites

Hey DTM-

That reminds me - when I started the civ traffic module, I thought about the same kind of game logic implementation. Then, I realized that, by using the .hpp trick from DM's stuff, that you could have a self-contained module. I'm thinking that this may be getting to the point where you may consider something like that. Just have a self-contained module, where people could have all sorts of options in the hpp.

Just brainstorming a bit, of course. :) Keep up the good work!

Share this post


Link to post
Share on other sites
Hey DTM-

That reminds me - when I started the civ traffic module, I thought about the same kind of game logic implementation. Then, I realized that, by using the .hpp trick from DM's stuff, that you could have a self-contained module. I'm thinking that this may be getting to the point where you may consider something like that. Just have a self-contained module, where people could have all sorts of options in the hpp.

Just brainstorming a bit, of course. :) Keep up the good work!

It could make the convoy placement alot easier :p, in the upcoming version there are 10 config fields to be filled through the initstring (which will be released tonight).

I'll have a good look at your ambientciv work, might be a convoy 2.0 revamp. Thanks for the tip :cool:.

Share this post


Link to post
Share on other sites

PM me if you want to discuss it via email. :) It really isn't that hard - just realize that the hpp values don't really act like global variables. To me, they are more like string replacements - whatever the hpp values are, that is literally what the game engine will "see" instead of the variables. So, you can't necessarily add to an array that is defined in the hpp.

It can require some creative workarounds :) and modularity, but I think your script set is already well on its way to that!

Share this post


Link to post
Share on other sites
You can put the initstring in the On Act. field of a trigger.

The GL will only function as a locationholder then, so leave the initfield empty.

-Place a GL on the map where you want the convoy to start and give the GL a name, lets say for this example GLNAME.

example with standard initstring:

 null= [[b]GLNAME[/b],WEST,["convoywp1","convoywp2","convoywp3"],5,7,[],[],true,false]execvm "convoy.sqf";

Hope this helps :)

Thanks!

Share this post


Link to post
Share on other sites

Script update to v1.6:

- Added random units in cargo of spawned vehicles (thanks TRexian)

- Added optional cycle waypoint ** remember to update the existing convoy initstrings **

- Improved control script (less distance, more speed)

Share this post


Link to post
Share on other sites

The control script changes arent working that well, for a quick fix I recommend reverting back convoy_control.sqf to v1.5.

Just copy/paste this in the existing version (or save as new file and name it convoy_control.sqf):

// =========================================================================================================

// Convoy control

// Version: 1.5

// Author: DTM2801

// =========================================================================================================

// - to tweak the behaviour change the distance (example: _backdist > 80) or forcespeed (example: forceSpeed 0).

//

// example using only controlscript with vehicles and named on the map:

// veh1: first vehicle nothing

// veh2: null = [veh2,veh1,false] execVM "convoy_control.sqf";

// veh3: null = [veh3,veh2,false] execVM "convoy_control.sqf";

// veh4: null = [veh4,veh3,false] execVM "convoy_control.sqf";

// and so on

// to enable/disable debug change option 3 to true/false

// =========================================================================================================

private ["_backdist", "_units", "_convoy1", "_convoy2", "_debug", "_unit1", "_unit2", "_frontdist"];

_convoy1 = _this select 0;

_convoy2 = _this select 1;

_debug = _this select 2;

_units = [];

_units = _units + [_convoy1];

_units = _units + [_convoy2];

_unit1 = _units select 0;

_unit2 = _units select 1;

while {alive _unit1 && alive _unit2} do {

_backdist = (_unit2 distance _unit1);

if (_backdist > 80) then {_unit2 forceSpeed 0; if (_debug) then {hintsilent format ["%1 waiting for %2",_unit2,_unit1]};};

if (_backdist < 70) then {_unit2 forceSpeed 2; if (_debug) then {hintsilent format ["%1 getting too far",_unit2]};};

if (_backdist < 60) then {_unit2 forceSpeed 4; if (_debug) then {hintsilent format ["%1 slowing down",_unit2]};};

if (_backdist < 50) then {_unit2 forceSpeed 6; if (_debug) then {hintsilent format ["%1 in formation",_unit2]};};

_frontdist = (_unit1 distance _unit2);

if (_frontdist > 40) then {_unit1 forceSpeed 6; if (_debug) then {hintsilent format ["%1 in formation",_unit1]};};

if (_frontdist < 30) then {_unit1 forceSpeed 4; if (_debug) then {hintsilent format ["%1 slowing down",_unit1]};};

if (_frontdist < 20) then {_unit1 forceSpeed 2; if (_debug) then {hintsilent format ["%1 getting too close",_unit1]};};

if (_frontdist < 10) then {_unit1 forceSpeed 0; if (_debug) then {hintsilent format ["%1 waiting",_unit1]};};

if (_debug) then {_unit1 sideChat format ["dist %1, to front %2",_frontdist,_unit2];};

sleep 1;

};

As the setup strings in its current form are getting out of hand, I decided to switch to a module based solution (thanks for the headsup TRexian). This does mean there will be no more updates of this script as it is now, but there will be a modularized version 2.0 release which will upgrade this project. This will make it alot easier to use and way more flexible/configurable to suit everyones needs.

Share this post


Link to post
Share on other sites

Heya DTM-

Would love to compare notes with you, either during your process of getting it set up or after. I'm still not sure I'm making the best use of this module idea.

One other thing to keep in mind is that one of the drawbacks of the hpp-config system is that the user's settings on his own machine would affect any mission made with convoy system. That is, the mission-maker's settings would be "over-ridden" by the user's local settings in the hpp. I think there are some ways to mitigate it, but it is worth keeping in mind on the front end. :)

I've had a request to post the code from my module, I'll do that in my release thread, along with my thoughts on various things. :)

Share this post


Link to post
Share on other sites
One other thing to keep in mind is that one of the drawbacks of the hpp-config system is that the user's settings on his own machine would affect any mission made with convoy system. That is, the mission-maker's settings would be "over-ridden" by the user's local settings in the hpp. I think there are some ways to mitigate it, but it is worth keeping in mind on the front end. :)

Yes, this was my thought at first too.. until I found out the use of standard default (although user-adaptable) hpp values combined with the variable setting which are set through the init of the module on the map like the BIS modules, this can make each placed convoy module work with its own settings, hence hold the config for a shared mission.

I've had a request to post the code from my module, I'll do that in my release thread, along with my thoughts on various things. :)

I'll check out your post :)

Share this post


Link to post
Share on other sites

Heya DTM-

Finally got around to checking out your scripts, instead of just talking out my a$$. :D

For element 4 - the cycle boolean, perhaps consider changing that to allow the user to designate the wp type for the final wp. For instance, the use I'm considering for this would conclude with an unload waypoint at the destination.

Looks good, though! :)

Share this post


Link to post
Share on other sites
Finally got around to checking out your scripts, instead of just talking out my a$$. :D

Its about time ;)

For element 4 - the cycle boolean, perhaps consider changing that to allow the user to designate the wp type for the final wp. For instance, the use I'm considering for this would conclude with an unload waypoint at the destination.

If you want to change the waypoint type you could use the control-script only option. This will stay this way for these scripts (unless you code it yourself ofc) until I finish the replacement modulair scripts that will allow waypoints to be configured seperately.

Share this post


Link to post
Share on other sites

I'm getting the following problems:

1.) The convoy DOES follow the road, but the vehicles keep moving off of the road a little, which makes them go slower, which forces the forward-most vehicle to stop. Considering this happens all the time, the convoy moves like this: stop, continue, stop, continue, stop, continue, etc...

I know the AI's somewhat dubious driving skills are to blame here though. Until BIS fixes this, perhaps you can add an option to let the vehicles behave more like a tank? i.e they don't slow down when they move off of the road.

2.) The convoy decides not to follow the road at all and travel to the waypoint in an almost straight line. Maybe I'm doing something wrong here? I'll try some more...

Share this post


Link to post
Share on other sites
1.) The convoy DOES follow the road, but the vehicles keep moving off of the road a little, which makes them go slower, which forces the forward-most vehicle to stop. Considering this happens all the time, the convoy moves like this: stop, continue, stop, continue, stop, continue, etc...

You can adjust the distance and speed in convoy_control.sqf, in the last version (1.6) the distance is too short and results in the stop and go behaviour and the distance (_dist) should be increased. You can tweak this yourself, but here is an better working version:

 
// =========================================================================================================
// Convoy control
// Version: 1.6
// Author: DTM2801
// =========================================================================================================
// - to tweak the behaviour change the distance (example: _dist > 80) or forcespeed (example: forceSpeed 0).
//
// example using only controlscript with vehicles and named on the map: 
// veh1: first vehicle nothing
// veh2: null = [veh2,veh1,false] execVM "convoy_control.sqf";
// veh3: null = [veh3,veh2,false] execVM "convoy_control.sqf";
// veh4: null = [veh4,veh3,false] execVM "convoy_control.sqf";
// and so on
// to enable/disable debug change option 3 to true/false
// =========================================================================================================
private ["_units", "_convoy1", "_convoy2", "_debug", "_unit1", "_unit2", "_dist"];
_convoy1 = _this select 0;
_convoy2 = _this select 1;
_debug = _this select 2;
_units = [];
_units = _units + [_convoy1, _convoy2];
_unit1 = _units select 0;
_unit2 = _units select 1;
while {alive _unit1 && alive _unit2} do {
_dist = (_unit1 distance _unit2);
if (_dist > 70) then {_unit2 forceSpeed 0; if (_debug) then {hintsilent format ["%1 waiting for %2",_unit2,_unit1]};};
if (_dist < 60) then {_unit2 forceSpeed 2; if (_debug) then {hintsilent format ["%1 front slowding down 2",_unit2]};};
if (_dist < 50) then {_unit2 forceSpeed 5; if (_debug) then {hintsilent format ["%1 front slowing down 4",_unit2]};};
// preffered distance
if (_dist < 40) then {_unit1 forceSpeed 8;_unit2 forceSpeed 8; if (_debug) then {hintsilent format ["%1 & %2 \nin formation",_unit1,_unit2]};};
if (_dist < 35) then {_unit1 forceSpeed 8;_unit2 forceSpeed 8; if (_debug) then {hintsilent format ["%1 & %2 \nin formation",_unit1,_unit2]};};
// ----------------------------------
if (_dist < 30) then {_unit1 forceSpeed 5; if (_debug) then {hintsilent format ["%1 back slowing down 4",_unit1]};};
if (_dist < 20) then {_unit1 forceSpeed 2; if (_debug) then {hintsilent format ["%1 back slowing down 2",_unit1]};};
if (_dist < 10) then {_unit1 forceSpeed 0; if (_debug) then {hintsilent format ["%1 waiting for %2 to move",_unit1,_unit2]};};
if (_debug) then {_unit1 sideChat format ["dist %1, to front %2",_dist,_unit2];};
sleep .2;
};
//failsafe
if (alive _unit1) then {_unit1 forcespeed -1; if (_debug) then {hintsilent format ["%1 gone, %2 without control",_unit1,_unit2]};};
if (alive _unit2) then {_unit2 forcespeed -1; if (_debug) then {hintsilent format ["%1 gone, %2 without control",_unit2,_unit1]};};

2.) The convoy decides not to follow the road at all and travel to the waypoint in an almost straight line. Maybe I'm doing something wrong here? I'll try some more...

This could be the result of a waypoint behaviour setting, if its not "SAFE" the vehicles wont stick to the road. If this is not the case please give some more info about what settings are used.

Edited by DTM2801

Share this post


Link to post
Share on other sites

How could I use a created convoy as a task?

If I refer to

grpconvoy

as target beofore it's created that would result in completed task too soon..

Any ideas how could I do it?

EDIT:

OK, how about if I use

player knowsAbout grpconvoy

as other condition?

Then the second "!(alive xxx)" condition should not backfire at beginning because it's not there yet... hmm

Well, just have to try it out

Edited by VanhA-ICON
idea

Share this post


Link to post
Share on other sites
You can adjust the distance and speed in convoy_control.sqf, in the last version (1.6) the distance is too short and results in the stop and go behaviour and the distance (_dist) should be increased. You can tweak this yourself, but here is an better working version:

 
// =========================================================================================================
// Convoy control
// Version: 1.6
// Author: DTM2801
// =========================================================================================================
// - to tweak the behaviour change the distance (example: _dist > 80) or forcespeed (example: forceSpeed 0).
//
// example using only controlscript with vehicles and named on the map: 
// veh1: first vehicle nothing
// veh2: null = [veh2,veh1,false] execVM "convoy_control.sqf";
// veh3: null = [veh3,veh2,false] execVM "convoy_control.sqf";
// veh4: null = [veh4,veh3,false] execVM "convoy_control.sqf";
// and so on
// to enable/disable debug change option 3 to true/false
// =========================================================================================================
private ["_units", "_convoy1", "_convoy2", "_debug", "_unit1", "_unit2", "_dist"];
_convoy1 = _this select 0;
_convoy2 = _this select 1;
_debug = _this select 2;
_units = [];
_units = _units + [_convoy1, _convoy2];
_unit1 = _units select 0;
_unit2 = _units select 1;
while {alive _unit1 && alive _unit2} do {
_dist = (_unit1 distance _unit2);
if (_dist > 70) then {_unit2 forceSpeed 0; if (_debug) then {hintsilent format ["%1 waiting for %2",_unit2,_unit1]};};
if (_dist < 60) then {_unit2 forceSpeed 2; if (_debug) then {hintsilent format ["%1 front slowding down 2",_unit2]};};
if (_dist < 50) then {_unit2 forceSpeed 5; if (_debug) then {hintsilent format ["%1 front slowing down 4",_unit2]};};
// preffered distance
if (_dist < 40) then {_unit1 forceSpeed 8;_unit2 forceSpeed 8; if (_debug) then {hintsilent format ["%1 & %2 \nin formation",_unit1,_unit2]};};
if (_dist < 35) then {_unit1 forceSpeed 8;_unit2 forceSpeed 8; if (_debug) then {hintsilent format ["%1 & %2 \nin formation",_unit1,_unit2]};};
// ----------------------------------
if (_dist < 30) then {_unit1 forceSpeed 5; if (_debug) then {hintsilent format ["%1 back slowing down 4",_unit1]};};
if (_dist < 20) then {_unit1 forceSpeed 2; if (_debug) then {hintsilent format ["%1 back slowing down 2",_unit1]};};
if (_dist < 10) then {_unit1 forceSpeed 0; if (_debug) then {hintsilent format ["%1 waiting for %2 to move",_unit1,_unit2]};};
if (_debug) then {_unit1 sideChat format ["dist %1, to front %2",_dist,_unit2];};
sleep .2;
};
//failsafe
if (alive _unit1) then {_unit1 forcespeed -1; if (_debug) then {hintsilent format ["%1 gone, %2 without control",_unit1,_unit2]};};
if (alive _unit2) then {_unit2 forcespeed -1; if (_debug) then {hintsilent format ["%1 gone, %2 without control",_unit2,_unit1]};};

This could be the result of a waypoint behaviour setting, if its not "SAFE" the vehicles wont stick to the road. If this is not the case please give some more info about what settings are used.

Works better now. I have found that the convoy works better (i.e. keeps driving in a more constant tempo) if you only use three vehicles. I really wish BIS would improve the vehicle pathfinding though, AI drivers behave like drunk drivers sometimes.

:(

Question, with the convoy_control.sqf method you don't need to use the waypoint markers, right? Just a conventional waypoint.

Now I'm trying to figure out how to delay the activation of the convoy waypoint until the players enter a trigger area, but I probably shouldn't ask that here. :P

Edited by Buzz_Fledderjohn

Share this post


Link to post
Share on other sites

Is there any way to spawn insurgents/CDF instead of russky/USMC? Making a multiplayer co-op, and I am little bit picky about the plot: No russians in Chernarus this time... :)

Share this post


Link to post
Share on other sites
Is there any way to spawn insurgents/CDF instead of russky/USMC? Making a multiplayer co-op, and I am little bit picky about the plot: No russians in Chernarus this time... :)

You need to use the insurgent / CDF class names:

http://forums.bistudio.com/showthread.php?t=73241

Insurgents are EAST, CDF is WEST if I'm correct.

Or you can just spawn the vehicles you want and use the convoy_control.sqf method.

Share this post


Link to post
Share on other sites
Ya, I can spawn INS truck, but all the passengers are russians.

You got a point there.. I'll have a look at the code tomorrow.

Share this post


Link to post
Share on other sites

Have you tried to change the side to "INS" in the initstring btw?

Share this post


Link to post
Share on other sites
Have you tried to change the side to "INS" in the initstring btw?

No I haven't. I obeyed the readme word for word. ;)

2: _side: side of convoy vehicles (WEST, EAST, RESISTANCE, CIVILIAN)

Share this post


Link to post
Share on other sites

how come o keep getting convoy.sqf not found?

ok nevermind =p after about 2hrs gawking at the scripts i forgot to add the convoy.sqf to my mission folder DUUHH.. Awsome script works great!

Edited by lostninja

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  

×