Jump to content
Sign in to follow this  
norrin

AI Convoy Script

Recommended Posts

// convoyDefend.sqf

// © MARCH 2010 - norrin

Description: This is a script that improves the convoy behaviour of AI controlled vehicles. W0lle asked me to write it for him a few days back and suggested I post it here as he thought others might benefit.

readMe

Thanks to W0lle for the idea behind this one

Download:

http://norrin.org/downloads/ArmA2/convoy/convoy_test.utes.rar

To use:

1. Add the code from the init.sqf into your mission init.sqf

2. copy the convoyDefend folder from the test mission into your mission directory.

3. Create a convoy of AI vehicles, not grouped, spaced about 40 metres apart along a road, make sure each vehicle is named in the editor

4. Add markers on the map that you want the convoy to move through. Note the number of these required depend on the straightness of the road. Tanks in particular are notorious for going cross country so you may need a few more of these if there are tanks in the convoy. You may also want to increase the skill of the AI vehicles as this may help their path finding. Finally, W0lle tells me that the convoys don't like crossing bridges so you may want to avoid these.

Its also a good idea to fly the convoy route with the convoy to check that you don't need extra moveTo markers

The parameters in the script-call are:

1. An array of convoy route markers eg. ["pos1","pos2","pos3","pos4"]

2. An array that contains the names of the vehicles in the convoy eg. [c1,c2,c3,c4,c5,c6]

*If you destroy any of the vehicles in the convoy, then the other vehicles will stop and all units on board except the gunners will disembark and assume combat behaviour.

* Theoretically you can have a convoy of any size you like but its only been checked for a convoy of up to 8 vehicles.

License: These scripts are not to be altered or used for commercial purposes without the author's prior consent.

@W0lle - if you see this mate this is an updated version of the script that allows you to define multiple convoy route markers, which improves convoy behaviour, especially on windy roads.

Share this post


Link to post
Share on other sites

Very cool!

On a Side note:

I hope we will get a "Editing&Script-Release" Subforum for Script-pack releases soon, as they get lost here with the countless of editing questions, and neither is the "Addons & Mods:Complete" Forum appropriate IMHO.

Share this post


Link to post
Share on other sites
What's the difference between this and the convoy creater & control script? :)

You're right, probably nothing - wasn't aware of that script - just ignore this if you like - oh well, more time wasted.

Share this post


Link to post
Share on other sites

Cool script norrin, bur how can i add a infantry group to one of the trucks in your demo mission ?

I have just made a group and put that in the leaders init:

{_x moveincargo c6} foreach units group this

The group is in cargo but if one of the vehicles gets destroyed this group get out but is not in combat mode !

Can you help ?

Share this post


Link to post
Share on other sites

I think the focus with this script is for a convoy group to react on being attacked appropriately. Its a nice idea and would make for a useful tool for practicing ambushes on convoys from either end of the ambush.

Norrin, I havent tested this yet but some general thoughts about this:

Many mission makers will benefit from a convoy management system like this. Its the kind of thing that can expand endlessly because it applies to missions like real logistics applies to real war. The mundane job of delivering vehicles with their cargo to a destination is the stuff that helps win and lose real wars. It can be a simple training tool with a fake convoy all the way to a small sub mission in a real simulated war as we have missions now that span the entire island and the game can support a large scale operation. So taking out or working on a convoy can be the most signifigant part of a large engagement. But built in wp tools arent enough so scripts come in to the rescue here but it takes some setup. This script by norrin is to help a mission maker with that setup and its focused on combat scenario in addition to basic functions of point to point travel.

I was thinking it could have different location types for each waypoint such as the type of area it is (URBAN,WOODS,OPEN) because different reactions could be made based on the type of environment the waypoint is in. The AI could rely more on nearby buildings for cover if in urban or a make tactical decision to head for the treeline if in wooded In in the open AI can look for nearest cover and possibly surrender if truly overwhelmed. Or stay and fight to the last man and so forth.

What if the passenger teams after they jump out can somehow use the vehicles for cover by moving behind them relative to the enemy position. Also there could be a supporting element that would come and react to the ambush. Medevac system and other existing systems can handle the AI reaction. It could go like this:

convoy is attacked and starts the reaction script as we have here, then:

/convoy team gets out and tries to take cover and get out of the killzone somehow

/support teams arrive for reaction to attack and evacuation of convoy team. If evacuated then mission failed for ambush team if evac fails then mission failed for convoy team.

or if ambush destroyed the convoy can continue if enough vehicles remain because the mission is more critical.

It could become a well rounded system that uses multiple parts from existing or new script systems with some modifications.

I could see a whole game mode designed around this idea actually. Sorry norrin, you need to let ACE or PR know that you are taking time off for this now very important and ever expanding project ;).

Anyway very neat idea for a script and congrats on joining up with PR!

Edited by TJ72

Share this post


Link to post
Share on other sites

Very good norrin. The convoy arrived safely and in good time :)

Will be sure to put this into my missions :)

Share this post


Link to post
Share on other sites
What's the difference between this and the convoy creater & control script? :)

I tried that one before I bothered norrin with yet another script for me. :)

Maybe I did something wrong but that script didn't fixed anything for me. The AI still was driving like crazy even on pretty straight roads.

@Wiggum

For best results (in defending the convoy) you should group the men with the vehicle and in the "special menu" of each unit select "IN CARGO".

The way you placed them in works too of course but they might not defend the convoy once attacked.

And yeah norrin, thanks again for that mate. :)

Edited by W0lle

Share this post


Link to post
Share on other sites

Just wanted to thank everyone for their support :)

@TJ72 - you've raised some very interesting possibilities mate and I would love to develop this system further but as you know other demands on my time are pretty great at the moment so its unlikely to happen in the near future - sorry.

@wiggum - Concerning your problem with units in cargo W0lle's got it pretty much covered in his last post.

@Foxhound - if you see this, as always thanks for the news post and the mirror at ArmAholic

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

i have spent half the day looking at this and the old convoy script, the old convoy script if any combat happens it just freezes...

in this one they stop and dismount, seems to me a convoy that stops in a kill zone is dead...

so anyways it would be nice to have the option to keep moving..

Share this post


Link to post
Share on other sites
so anyways it would be nice to have the option to keep moving..

Would be an added bonus if this was possible for "Stop the Convoy" scenarios.

Another great, straight forward script Norrin. Many thanks, works very well. :rthumb:

Share this post


Link to post
Share on other sites

Great one

Something il be downloading when i get my pc back!!

Share this post


Link to post
Share on other sites
Cool script norrin, bur how can i add a infantry group to one of the trucks in your demo mission ?

I have just made a group and put that in the leaders init:

{_x moveincargo c6} foreach units group this

The group is in cargo but if one of the vehicles gets destroyed this group get out but is not in combat mode !

Can you help ?

Will infantry mounted this way still move to their intended waypoints (if set) on auto dismount?

Share this post


Link to post
Share on other sites

Great script Norrin. Although, I'm having a problem where each vehicle wants to switch to a line formation on the last waypoint. Any ideas for this? I was hoping that once the lead humvee reaches the final waypoint on the road, that it would just stop and wait, with the other humvees stopping behind it waiting on the road. But once the lead humvee stops, all the rear humvees want to pull up beside the lead in a line formation before stopping. I'm not sure how to change this behavior since they are not grouped.

Share this post


Link to post
Share on other sites

Ok, I made some edits to the convoy script fixing the above behavior for me and sent the changes to Norrin in case they are useful to him. Thanks again Norrin.

Share this post


Link to post
Share on other sites

Can this be made into a module that defaults ALL convoys with norrin's proper convoy behaviour ?

Share this post


Link to post
Share on other sites

Thanks for this script :)

In the example, russian units are blocked at the first marker waypoint when I put ennemies units in front and russians don't shoot. Does somone has the same problem ?

Share this post


Link to post
Share on other sites

Convoy script works perfectly many thanks. What I would like to do is have the convoy start when a trigger condition is met (ie: Blue force present). When I add the code

//init.sqf

// Code for convoy defend script

if (isServer) then

{

[["pos1","pos2","pos3","pos4"],[c1,c2,c3,c4,c5,c6]] execVM "convoyDefend\convoyDefend_init.sqf";

};

to my init.sqf then convoy starts moving immediately. Is there a way I can activate via a trigger?

Many thanks in advance

Share this post


Link to post
Share on other sites
Convoy script works perfectly many thanks. What I would like to do is have the convoy start when a trigger condition is met (ie: Blue force present). When I add the code

to my init.sqf then convoy starts moving immediately. Is there a way I can activate via a trigger?

Many thanks in advance

Doodle thanks, I've been wondering this for weeks and meant to ask it before I left for my hiatus. I'd like to take this one further.

I'd like the convoy to start when my BLUFOR team gets in the final vehicle. I want them to drive the vehicle and follow the convoy but this vehicle will not be effected by this script.

I've been trying to get it to work via trigger but I can't figure out what to put in the Condition line or the best way to activate the convoy scripts.

Share this post


Link to post
Share on other sites

well i "think" I managed to get my problem resolved. I removed the above codefrom the init.sqf and placed it in a trigger set to radio foxtrot for test purposes and it seems to work ok.

I am not sure but my convoy was made up of BOTH Independant and Opfor vehicles, and that may have screwed it up once I changed them all to the same faction it worked fine.

Share this post


Link to post
Share on other sites

Ahh, that's a good idea. I could always use a radio activation once they all get in the vehicle.

I'd still like to what a good trigger condition would for having it activate when all group members enter the last vehicle, say "gmv_1" is the name. I've checked around but what I've come up with hasn't worked yet. I'm a bit slow with this stuff. :)

Share this post


Link to post
Share on other sites

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?

Edited by Egosa-U

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  

×