Jump to content
Sign in to follow this  
norrin

AI Convoy Script

Recommended Posts

Convoy worksfine exept some limitations:

1.) Setting wheeled and non-wheeled vehicles into the convoy starts messing it up. The vehicles try to reassign positions, wheeled vehicles go awkward: They try to turn around , crash, go back on route, etc....

Could be a US and CDF problem, too.

EDIT: Doesnt matter, if c1 is wheeled or not.

2.) Convoy stops at Waypoint 3:

Could have 2 reasons:

a.) When using either more than 4 waypoints (i used 57 ;-) ) it stops at "a_2" . All named in a row: a, a_1, a_2, ....

b.) Using Markernames with _ in it?

I had this sort of problem with convoy stopping at pos1 - you could try making all the vehicles the same type and side and see if that sorts it out. Then work forward from there.

Share this post


Link to post
Share on other sites

Yes, did that - changed everything to wheeled and to same side. But since the US hasnt got a light tank (like BMP-2), its somehow not challenging enough to ambush the convoy. the M1A1 is too powerful though and doesnt fit into a convoy. I would appreciate it, to have that sort of convoy: Hummvee+240, Hummvee+launcher, Fuel+Ammo+Repair-truck, 2 Cargotrucks and a BMP for covering the back. So now its got to be another Hummvee. :(

Share this post


Link to post
Share on other sites

Yeah, same for me... I made a convoy from 2 BMPs escorting a SCUD launcher :D but the convoy stops at WP 1

If I use only BMPs or only SCUDs it works fine

Share this post


Link to post
Share on other sites

The LAV25 is supposed to be the U.S. Version of the BMP-2. It's an armored vehicle, it's amphibious, and it can carry troops.

Share this post


Link to post
Share on other sites

I have this working a treat from a Present trigger with the ini code in the Act section.

Thanks norrin great script

Share this post


Link to post
Share on other sites

Finally I got a chance to have a look into the script using it in a multiplayer mission on the dedicated server. The script works so far, even with two huge convoys on west and east side having different cars and a chopper in it. However the AI still drives crazy from time to time leaving the formation and abandoning the road. I guess this can't be fixed without work done by BIS.

One issue (?): If the convoy gets attacked, the crew disembarks from their vehicles. That's very annoying when using armored vehicles.

One question: If the convoy is attacked by the enemy, will it continue its route or will it stay at the ambush position?

Share this post


Link to post
Share on other sites

OK anoither question. My convoy of 6 vehicles works fine from start to finish. But when the lead vehicle reaches the final point it stops but then the other vehicles try and get to the last point also and seem to get stuck as vehicle 1 is "blocking" the final marker.

Is there a way that when vehicle 1 reaches final waypoint all the other vehicles stop.

thanks in advance

Share this post


Link to post
Share on other sites

@Legislator

For the initial mission I requested that script I modified the "convoiDefend_init.sqf" a bit so the gunners stay in the vehicle. To my surprise it even works.:D

// convoyDefend_init.sqf
// MARCH 2010 - norrin
if (!isServer) exitWith {};

_marker = _this select 0;
_convoyArray = _this select 1;
_convoyVclDestroyed = false;
_groups = [];
_c = 0;
{_x setSpeedMode "LIMITED";
_x setBehaviour "SAFE";
_x doMove getMarkerPos _marker;[_x, _convoyArray, _c]execVm "scripts\maxspeed.sqf"; _c = _c + 1} forEach _convoyArray;

_convoyVclDestroyed = false;

while {!_convoyVclDestroyed} do
{
 {if (!alive _x) then {_convoyVclDestroyed = true}}forEach _convoyArray;
 sleep 1;
};

{if (alive _x) then {_x doMove getPos _x}} forEach _convoyArray;

for [{ _loop = 0 },{ _loop < count  _convoyArray},{ _loop = _loop + 1}] do
{
 _vcl = _convoyArray select _loop;
 if (alive _vcl) then
 {
   _groups = _groups + [(group _vcl)];
   _crew = crew _vcl;
   waitUntil {speed _vcl < 2};
   for [{ _loop1 = 0 },{ _loop1 < count _crew},{ _loop1 = _loop1 + 1}] do
   {
     _unit = _crew select _loop1;
     if (_unit != gunner _vcl) then
     {
       _unit action ["GetOut", _vcl];
       sleep 0.2;
       [_unit] allowGetIn false;
     } else {
       _unit assignAsGunner _vcl;
     };
     sleep 0.1;
   };
 };
 sleep 0.1;
};
sleep 1;
{_x setBehaviour "COMBAT"} forEach _groups;

However since this is the first version, it has not the multiple waypoints option included.

From my experience it looks like the vehicles stay at the ambush position but I also had situations where after a while the surviving vehicle(s) started moving again.

@Doodle

You could do this with an additional trigger which checks the distance between the first vehicle and the end marker. Once activated you stop the other vehicles either with the stop or disableAI command.

But: this works only as long as the first vehicle in the convoy is not destroyed.

Eventually norrin will add a way more comfortable function one day, who knows. :)

Share this post


Link to post
Share on other sites

Hopefully, I'll post an update in the next few days that will address some of these issues.

Share this post


Link to post
Share on other sites

Just got it to work :P

---------- Post added at 01:15 AM ---------- Previous post was at 12:20 AM ----------

Great script norrin, works like a charm. Thanks!

Fiddled around in the maxspeed.sqf because i wanted the convoy to be more closer together. Somehow the first vehicle always drives away a bit, but its ok.

Which parts of the Maxspeed.sqf would i edit to change the distance between each vehicle?

I dont want to edit the wrong think and screw it up.

Edited by A Smed

Share this post


Link to post
Share on other sites

anyone got a copy of the convoy_test.utes.rar? the link is down.

---------- Post added at 20:26 ---------- Previous post was at 20:23 ----------

Nevermind found it armaholic

Share this post


Link to post
Share on other sites

Sorry to bump this thread, but how can I get my convoy to get rolling again once a substantial amount of the enemy forces have fled or been killed? My mission involves an IED taking out the first vehicle. Typically the ambushers retreat after while though, even if the lead vehicle is down can we push past it?

Share this post


Link to post
Share on other sites

Can you explain the "IF isServer" line?

If i use this in a multiplayer mission will it execute for each player?

Share this post


Link to post
Share on other sites
Can you explain the "IF isServer" line?

If i use this in a multiplayer mission will it execute for each player?

if (!isServer) exitWith {};

isServer is a command that returns true if it's being executed on the server and not just an attached client. By putting the ! in front of it in the if statement you're saying "not" is server. So what that command is saying is "If you're not the server stop executing this script". So the server sees that says "I most certainly am the server!" and continues on it's way while all the other clients say "Whoa, man... not for me!" and exit the script.

Here's a list of what the various isWhatever commands return.

Share this post


Link to post
Share on other sites

OMG, Kylania, thank you for finally breaking that down "Barney Style" for me. I understood the "!" part, but I just couldn't wrap my brain around how it was commanding the MP world and said files. Again, seriously, thank you for putting it in laymen's terms.

Share this post


Link to post
Share on other sites
anyone got a copy of the convoy_test.utes.rar? the link is down.

---------- Post added at 20:26 ---------- Previous post was at 20:23 ----------

Nevermind found it armaholic

I was hoping to test it too, rather than use the Convoy Creator, but the link is still broken.

Share this post


Link to post
Share on other sites

I, just tested this on arma 3 and its fantastic!! :yay:

Continue with this script, upgrade it for arma 3. like

Having the units get back in the car and continue after an attack?

this is perfect, and simple!

little tip, you should write that people can use the INIT parameters/script in a trigger

Share this post


Link to post
Share on other sites

D'aaah... I'm trying to use this in a mission that involves you as a guerilla ambushing Takistani Army troops. But, I can't even get the convoy to get rolling. I started out with a convoy of two T-72s, one Shilka, three motorized infantry groups in trucks made using the group (F2) thing, one group of mechanized infantry with a BTR-70, and another with a BMP-2, one UAZ with 3 people inside, and four supply trucks. The lead vehicle would do a little stutter-like movement where he would advance some 2 or 3 inches each time and the rest of the convoy did nothing. Only after I crashed my helicopter into the T-72 in rage did the convoy begin to move, but I'm unsure if it did the rest of the trip normally. Now I've changed the T-72s, BMP-2s, and the Shilka to BTR-70s, and removed the UAZ and supply trucks, and the convoy doesn't do anything. The lead BTR eventually does a 3-point turn and starts moving toward the back of the convoy. I'm just about done to be honest, and ready to group everyone into the same squad for one massive thing for the sake of simplicity.

Pls halp.

Share this post


Link to post
Share on other sites
D'aaah... I'm trying to use this in a mission that involves you as a guerilla ambushing Takistani Army troops. But, I can't even get the convoy to get rolling.

Pls halp.

It depends How many pos markers do you have set up and how close are they to each other on the map?

For starters: your mission folder needs to look like this ....

[b]convoyDefend
init.sqf
mission.sqm[/b]

If you have more position markers on the map where the convoy need to move trough then you need to edit your init.sqf, open up the init.sqf with some text editor, I personally like to use notepad++

//init.sqf

// Code for convoy defend script
if (isServer) then
{
[["pos1","pos2","pos3","pos4","pos5","pos6"],[c1,c2,c3,c4,c5,c6]] execVM "convoyDefend\convoyDefend_init.sqf";
};

If you added vehicles and pos markers on the map you need to edit the above file eg.

//init.sqf

// Code for convoy defend script
if (isServer) then
{
[["pos1","pos2","pos3","pos4","pos5","pos6","pos7","pos8","pos9"],[c1,c2,c3,c4,c5,c6,c7,c8]] execVM "convoyDefend\convoyDefend_init.sqf";
};

Also, it is best to make sure that your convoy vehicles are correctly placed on the map eg.

c1 first then c2 and then c3 and this about 40 meters apart, to check if the convoy passes correctly trough the markers you can eater test it by riding with them in a cargo spot or by placing a trigger like this.

place a trigger make it around 100 radius or something activated by the side you are on and put in the activation box

hint "checkpoint 001"

you can shoos to set several triggers like this to check out the route to see if the convoy correctly passes all the pos markers ...

best of regards

Edited by LiquitHQ

Share this post


Link to post
Share on other sites

Hey is it possible to activate this convoy from a waypoint using hold on c1 unit? I want the convoy to start off a trigger from mulitple objective mission. Ideas?

Share this post


Link to post
Share on other sites
Hey is it possible to activate this convoy from a waypoint using hold on c1 unit? I want the convoy to start off a trigger from mulitple objective mission. Ideas?

I would say you could put the code from norrin's init.sqf into its own sqf called "convoy1.sqf, lets say, and then in the trigger activation you can call exec "convoy1.sqs"

Share this post


Link to post
Share on other sites

hello i have a request of this script i will a convoy in chernarus epoch add

when i go to this vehicles than delete the vehicle

i will add gear to the urals can i create a gear for the vehicles ?

thanks for answers sry for my bad english

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  

×