Jump to content
Sign in to follow this  
DTM2801

Convoy creator & convoy control v1.0

Recommended Posts

Convoy creator & convoy control

Version: 1.6

Description:

This script wil create a convoy (configurable) and will keep monitoring all convoy vehicles for the correct distance by adjusting speed.

If the distance between convoy vehicles gets too far the forward vehicle will slowdown and eventually wait until the follower gets back

in acceptable distance.

Usage:

To make it more versatile there are 4 ways to make use of these scripts to suit your needs.

1. Convoy with default vehicles and cycle waypoint, spawns vehicles using the convoysize and default side vehicles with controlscript.

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

2. Convoy with classname vehicles, spawns all vehicles in the defined array with controlscript.

null= [this,WEST,["convoywp1","convoywp2","convoywp3"],false,0,7,["HMMWV_M2","MTVR","HMMWV_M2"],[],true,false]execvm "convoy.sqf";

3. Convoy with preplaced vehicles on the map, adds vehicles to an array and assigns waypoints and controlscript.

null= [this,WEST,["convoywp1","convoywp2","convoywp3"],false,0,7,[],[veh1, veh2, veh3],true,false]execvm "convoy.sqf";

4. Convoy with preplaced vehicles and waypoints on the map, using only the controlscript.

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";

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

- Define a route for the convoy by placing and naming markers on the map.

- Place a Game Logic on the map at the location and direction where you want the convoy to be spawned.

- Put the initstring in the initialisation field of the Game Logic and maybe change to your needs.

NOTE: ** Functions module must be placed on the map **

The included sample mission has all 4 different convoy options placed, including cargo (soldiers).

Explanation of initstring:

null= [1: objectname,2:side,3:["nameofmarker1","nameofmarker2","nameofmarker3"],4:cycle,5:convoysize,6:delay,7:["classname1","classname2",classname3"],8:[nameofvehicle1,nameofvehicle2,nameofvehicle3],9:wpmarkers,10:debug]execvm "convoy.sqf";

1: _position : objectname where convoy is spawned (default: this)

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

3: _wparray : array of markernames used to create waypoints (have to be between "")

4: _cycle: turn on/off cycle waypoint, will be added by script (true/false)

5: _convoysize : number of default spawned vehicles * (default: 5)

6: _delay : time between vehicle spawns, needed to prevent pile ups (default: 7)

7: _vehiclearray : array of vehicle classnames by choice, will be spawned it the order left to right (default: [])

8: _customarray : array of vehiclenames preplaced in the map (default: [])

9: _wpmarkers : turn on/off display of waypoint markers on map (true/false)

10: _debug : turn on/off debug messages (true/false)

* default side vehicle

WEST = "MTVR"

EAST = "Kamaz"

RESISTANCE = "V3S_Gue"

CIVILIAN = "UralCivil2"

How to use the control script (convoy_control.sqf):

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

If you any suggestions/comments to make this script work better please share your ideas.

Changes:

v1.1

- Added convoy tracking markers.

- Some code cleanup.

- Test mission cleared of external addons.

v1.2

- Added description.

v1.3

- Added vehicle names.

- Added eventhandlers.

- Added option to enable/disable waypoint map markers (found in convoy.sqf)

- Dropped vehmarkers.sqf (still looking for a way to integrate in main script).

- Updated convoy_control while parameter.

v1.4:

- Added side selection to init. (thanks zonker3210)

- Added default vehicle for 3 sides.

- Added init string checks.

- Moved waypoint markers option to init.

- Moved debug option to init.

v1.5:

- Introduced cases into the script for more flexibity.

- Added multiple ways to use the script. (see usage notes)

- Added createcenter to ensure vehicle spawns.

- Added CIVILIAN to side choices.

- some code cleanup.

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)

Todo:

- Optional vehicle markers.

Credits & special thanks:

- TRexian for providing random cargo piece :cool:

- Everyone who reads this.

Mirrors: (including sample mission)

Armaholic.com - http://www.armaholic.com/page.php?id=8286

ArmedAssault.info - http://www.armedassault.info/index.php?game=1&cat=addons&id=1137

AssaultMissionStudio.de - http://www.assaultmissionstudio.de/downloads.php?page_id=255

Filefront.com - http://www.filefront.com/14941751/convoy_v1.6.Chernarus.rar

** check for latest version number **

Edited by DTM2801
script update v1.6

Share this post


Link to post
Share on other sites

I get this error message when I load the mission:

"C:\...\missions\convoy.Chernarus\mission.sqm/Mission/Groups/Item1/Vehicles/Item0.vehicle: vehicle class SLX_VehicleCargoLogic no longer exists"

Share this post


Link to post
Share on other sites
I get this error message when I load the mission:

"C:\...\missions\convoy.Chernarus\mission.sqm/Mission/Groups/Item1/Vehicles/Item0.vehicle: vehicle class SLX_VehicleCargoLogic no longer exists"

Oops, shame on me :rolleyes:...

Fixed the sample mission and added some new stuff, changes in original post.

Share this post


Link to post
Share on other sites
errrrr...any noob-guide?

however awesome idea!

Guide for downloading/placing the mission in your computer? or using the script? as for the script, its all working in the sample mission convoy loaded using the editor on Chernarus map.

If you wanna use it in your own mission, copy the files "convoy.sqf", "convoy_control.sqf" & vehiclemarker.sqf" to your own mission folder.

Place the route markers and a game logic (or any other object) and put in the init-string as stated in the readme file or original post.

If its not clear, specify at what point you are stuck :)

Share this post


Link to post
Share on other sites

Nice script. Maybe little bit not-so-userfriendly (Kind of hard to place to the mission), but still nice.

I am positive I will see this script in custom missions. Who knows, maybe I include it to mine. :)

Share this post


Link to post
Share on other sites

Excellent idea and implementation! :) Will try this for my own, too...

Share this post


Link to post
Share on other sites

@Gekkibi: I try to keep all userinput as simple and easy as possible, the long initcode is needed to give the flexibility to change the script to your needs without actually changing the script itself. The goal is to simplify this in future releases. Until then if you have any questions regarding the config feel free to ask them :)

Script update to v1.03:

- Added vehicle names.

- Added eventhandlers.

- Added option to enable/disable waypoint map markers (found in convoy.sqf)

- Dropped vehmarkers.sqf (still looking for a way to integrate in main script).

- Updated convoy_control while parameter.

Edited by DTM2801

Share this post


Link to post
Share on other sites

Nice script...and perfect timing as I was looking for some help in creating a convoy! A few suggestions, though...unless, I am mistaken, the following line:

_convoygrp = createGroup WEST;

...means that the convoys will always be associated with the WEST side, correct? If so, it'd be nice to be able to create OPFOR convoys without tweaking the script itself.

Likewise, it'd be nice to have the option of turning off the vehicle marker without tweaking the appropriate script. There are times when players shouldn't know a convoy's exact location unless they can actually see it (i.e., OPFOR convoys).

Finally, while the included README is helpful and your instructions clear, you forgot to mention the need to place a FUNCTIONS module on the map. I couldn't get the convoy script to work until I peeked thru the sample mission and noticed the extra object. You might want to add that to the instructions.

Thanks for writing this script!

Share this post


Link to post
Share on other sites
If so, it'd be nice to be able to create OPFOR convoys without tweaking the script itself.
Agreed, was thinking that too.. will put this on the todo list for the next version.
Likewise, it'd be nice to have the option of turning off the vehicle marker without tweaking the appropriate script. There are times when players shouldn't know a convoy's exact location unless they can actually see it (i.e., OPFOR convoys).
True, that's why (and because of minor fps drops) I removed the vehicle markers in version 1.3 unitil I've found a better solution. The waypoint map markers are made optional.
you forgot to mention the need to place a FUNCTIONS module on the map
That sentence was added to the descripton (forum and readme) in v1.3 last night. I think you still have v1.2 :D

Share this post


Link to post
Share on other sites

I haven't had a chance to check this out yet, but something else that would be handy would be a way to use an existing array of vehicles (perhaps some that have spawned), and send that to the script, which would then order them (in the order of the array would be fine), and send them to their waypoints?

Apologies (and kudos) if that is already part of the functionality. :)

Share this post


Link to post
Share on other sites
That sentence was added to the descripton (forum and readme) in v1.3 last night. I think you still have v1.2 :D

Ooops...that's correct. I downloaded the script pack last night from the Armaholic site. I must have gotten the files just before they were updated as I can see that the Armaholic site already has the new version up. Sorry about that!

...something else that would be handy would be a way to use an existing array of vehicles (perhaps some that have spawned), and send that to the script, which would then order them (in the order of the array would be fine), and send them to their waypoints?

I'm pretty sure that the script does allow for that, too. I haven't tried it myself but the README does suggest such a use. It's definitely a nice feature!

Share this post


Link to post
Share on other sites

Script update to v1.04:

- Description updated with some better explanations.

- Added side selection to init.(thanks zonker3210)

- Added default vehicle for 3 sides.

- Added init string checks.

- Moved waypoint markers option to init.

- Moved debug option to init.

Share this post


Link to post
Share on other sites

Before I go any farther, this time I double-checked to make sure that I had the most current release. ;)

Thanks for adding the option to create non-WEST convoys. There's one slight issue that may not be encountered often...I created a test mission and placed my character in a flying helo so that I could easily follow the convoy. Then I used a game logic to launch a new convoy for the Resistance side. At first, the convoy wouldn't move. I checked and everything was configured correctly. Turns out that since there were no other resistance forces placed on the map, the createGroup command must be preceded with a createCenter command in order to allow for communications for that particular side. So...I went into "convoy.sqf" file and replaced:

_convoygrp = createGroup _side;

...with...

_convoyHQ = createCenter _side;
_convoygrp = createGroup _side;

That's all that was needed and the convoy started up immediately. As I said, though, I don't know that this would be needed often since if there were any other forces for that side already placed via the editor, the createCenter command would be unnecessary. On the other hand, I'm not sure that adding it again via script really causes any problems. The game engine might simply ignore the extra call...? I'm not sure, though.

One thing that I'd love to see...the ability to use existing vehicles in the convoy instead of spawned vehicles via classnames. I don't think that this would be enormously difficult since you already did a significant amount of the work. Shoot me a PM if you'd me to elaborate on how this might work.

Thanks again for an excellent script!

Share this post


Link to post
Share on other sites

Is there anyway to spawn soldiers inside the vehicles?

I'm not too sure how to assign each vehicle a name so i can use assignAsCargo.

Cheers

Share this post


Link to post
Share on other sites
_convoyHQ = createCenter _side;
_convoygrp = createGroup _side;

Yes didnt think of that scenario :), its an easy fix and will be applied in the next version.. thank you

One thing that I'd love to see...the ability to use existing vehicles in the convoy instead of spawned vehicles via classnames. I don't think that this would be enormously difficult since you already did a significant amount of the work. Shoot me a PM if you'd me to elaborate on how this might work.

I can see how that would be useful, this will requires some small changes in the way the units are defined and pushed in the main script. I can probably add this extra functionality later today where the control script can be called seperately from the units init on the map.

---------- Post added at 14:12 ---------- Previous post was at 14:09 ----------

Is there anyway to spawn soldiers inside the vehicles?

I'm not too sure how to assign each vehicle a name so i can use assignAsCargo.

Cheers

When I make the spawn and control script work independently from each other this will be possible whilst you use your own names and codes to put the units inside a unit ;).

Share this post


Link to post
Share on other sites

This is Great, works really well.

Is their any way to populate the cargo of the spawned convoy to add troops?

If the convoy comes under fire, they will automatically dismount and start to fight, no?

Great work btw, needed something like this, convoys are hard to produce in arma2, they just drive all over this place. This helps, alot :bounce3:

Edit : Are, this got asked already, sorry :P

Edited by Ronin =ASP=

Share this post


Link to post
Share on other sites

Hey DTM-

For populating cargo slots, here's something I have that's reasonably modular.

// determine if there is cargo area for vehicle
_cargoNum = _car emptyPositions "cargo";
if (_cargoNum > 0) then 
{
_fillSlots = round (random _cargoNum);
_locGr = _locCar findEmptyPosition [10, 100];
	sleep .2;
if (_locGr select 0 > 0)then
{
_cargo = [_locGr, CIVILIAN, _cargoNum,[],[],[],[],[_fillSlots,.5], _dir] call BIS_fnc_spawnGroup;

sleep .2;
	// move group into vehicle
	{
		_x moveInCargo _car;
	} forEach units _cargo;
};
};

Where _car can also be an _x in a forEach loop of each of the spawned cargo vehicles... Also, this creates civilians, obviously, but you can use your side variable in the BIS function for troops.

Sorry if you've already got this worked out. :)

Share this post


Link to post
Share on other sites

For populating cargo slots, here's something I have that's reasonably modular.

Where _car can also be an _x in a forEach loop of each of the spawned cargo vehicles... Also, this creates civilians, obviously, but you can use your side variable in the BIS function for troops.

Thanks for the code, I can try it out in the next version (after release of v1.5 which will be posted very shortly from now).

It incorporates the combined use of spawned and preplaced units on the map (which for instance gives the flexibility to put soldiers into cargo) in different scenarios.

---------- Post added at 19:07 ---------- Previous post was at 18:40 ----------

Script update to v1.5:- Introduced cases into the script for more flexibity.

- Added multiple ways to use the script. (see usage notes)

- Added createcenter to ensure vehicle spawns.

- Added CIVILIAN to side choices.

- some code cleanup.

Share this post


Link to post
Share on other sites
Hey DTM-

For populating cargo slots, here's something I have that's reasonably modular.

// determine if there is cargo area for vehicle
_cargoNum = _car emptyPositions "cargo";
if (_cargoNum > 0) then 
{
   _fillSlots = round (random _cargoNum);
   _locGr = _locCar findEmptyPosition [10, 100];
       sleep .2;
   if (_locGr select 0 > 0)then
   {
   _cargo = [_locGr, CIVILIAN, _cargoNum,[],[],[],[],[_fillSlots,.5], _dir] call BIS_fnc_spawnGroup;

   sleep .2;
       // move group into vehicle
       {
           _x moveInCargo _car;
       } forEach units _cargo;
   };
};

Where _car can also be an _x in a forEach loop of each of the spawned cargo vehicles... Also, this creates civilians, obviously, but you can use your side variable in the BIS function for troops.

Sorry if you've already got this worked out. :)

I've used it in the spawned vehicles cases, it works beautifully... almost just as nice as your civlife module :yay:. Will be releasing this together with the next update.

Share this post


Link to post
Share on other sites
I've used it in the spawned vehicles cases, it works beautifully... almost just as nice as your civlife module :yay:. Will be releasing this together with the next update.

Happy to help. :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
But what about a route without end? Some Missions need a convoy that continuesly drive around a city or something like that.

At the moment you can place your own vehicles on the map with their waypoints (using any type you wish) and make use only of the control script.(see usage nr4).

Although the idea of making waypoints more configurable is something I might pickup somewhere in the next releases :).

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.

Haven't seen this happen before, which convoy type are you using? (initstring would be nice)

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  

×