Jump to content
hermanJnr.

"Simple" squad vehicle choice problem driving me nuts!

Recommended Posts

Hello all! First of all a big thank you to the whole ARMA community for having some really excellent tutorials for this great editor, I've just recently got into the game and designing missions is proving very enjoyable, in no small part due to the amazing tutorials people have made for newcomers like myself.

 

Anyway...now the rump-kissing is out the way, time to irritate everyone with a newb question. Sorry 😉

 

I imagine this has been asked 200,000,000 times and is extremely simple for the heavy scripters here, but I cannot for the life of me find a good answer after searching a bunch of threads so I will just explain the situation. TLDR at the bottom.

 

Full explanation: My mission has you attack a static enemy convoy, then an enemy base with a big (12 men I think) USMC squad (loaded in a truck originally). You are not in command, and the squad leader is immune to damage, so he gives the commands through the mission so it should run like clockwork. The player destroys the convoy with C4, kills an AAF commander in the base and then the squad is given a task to get in his command vehicle  (one of those Humvee things) and drive it to the next waypoint where you have to defend against a counter attack by two choppers and three trucks of riflemen.

 

Ironically I have all these fiddly objectives and triggers working great individually, but the "swap vehicles" part in the middle is totally borked. Obviously 12 men won't fit in a Humvee so I added two empty enemy trucks behind them to accomodate the rest of the surviving squad. These are scripted to be Locked until the base is clear of enemies, at which point they Unlock, to stop the enemy soldiers driving them around for a laugh (this was also happening previously). The issue is that the Squad Leader and the player will jump happily in the "command car" and then whatever waypoint ("Get In" or "Get In Nearest") I'm using, the rest of the squad runs merrily back to the original truck.

 

This takes literally 10 minutes and even if you have the patience to suffer through that God-awful pacing, they then start driving like Destruction Derby in some sort of insane attempt to get behind the Leader's truck in a line from 500 m away. Mission basically dies as they smash up the truck and get stuck and the Squad Leader refuses to move the Humvee because of this.

 

Is there any way I can circumvent the preference for the "USMC truck" at the start to get the remaining X soldiers to just park their butts in the AAF trucks and follow the leader in a line?

 

TLDR for brevity: Whether I use "Get In Nearest", "Get In" or permutations of "Get In" with "X attachwaypointVehicle Y;" my large (12 men) USMC squad fails to transfer from their original truck to a bunch of empty AAF trucks that are unlocked and next to each other. Instead the Leader and a couple of guys get in one AAF vehicle, and everyone else runs 50 km to the original USMC vehicle. Pathing insanity ensues. What gives and how do I stop this obsessive love for the original truck? 😕

 

Thanks anyone for any help you are able to render, appreciate it 🙂

  • Like 1

Share this post


Link to post
Share on other sites

How about deleting or locking the initial truck?

 

deleteVehicle nameOfInitialTruck

 

That might be a simple solution. More are possible but they will be more or far more complicated.

 

By the way, I am impressed on how far you have gone by using the AI IQ. Nice  :thumbsup:

  • Like 3

Share this post


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

How about deleting or locking the initial truck?

 


deleteVehicle nameOfInitialTruck

 

That might be a simple solution. More are possible but they will be more or far more complicated.

 

By the way, I am impressed on how far you have gone by using the AI IQ. Nice  :thumbsup:

 

Oh man looks like it's going to get complicated, unfortunately! Ha. Deleting or locking the original truck results in the squad inexplicably changing the "GET IN" or "GET IN NEAREST" waypoint to a "Wait" waypoint, and they just run to the new vehicles and stand there forever 😕

 

I added a delay trigger to the waypoint order, to make sure it wasn't getting confused by being issued at the same time as the Unlock command. Turns out that isn't the problem either...

 

Thank you! I must admit the ordering the AI is like trying to herd rabid cats with a chainsaw, but if I can learn to control this bunch of lemmings I can theoretically make almost any cinematic SP or MP mission ever, right?

 

Annoyingly, I have solved the problem in an isolated VR level, but not in my actual mission.

 

To solve it in the Test Map I...

 

- Took an 8 man USMC squad with group name AlphaTrucks

- Took 2 AAF Humvees (HV1, HV2). Picked AAF transports because I wanted to see if this is a differing faction vehicle problem.

- Synched HV1 and HV2 to both each other and AlphaTrucks (for consistency for the test, to see if it made any difference).

- Added code to the squad Init that I found on another forum post from a while back (see end of this post): 

{ AlphaTrucks addVehicle _x} foreach [HV1,HV2];

- This has the effect of grouping the unmanned lorries with the squad, I believe, replicating the effect of starting with them crewed in terms of ownership.

- I then gave the squad 2 sequential "GET IN" waypoints on each Humvee. The commander shouts Get In! once, climbs in with 3 guys, then gets out again alone (lol) and shouts to get in the second HV, at which point the squad fills both and the leader drives off in the back vehicle, with the front one following later.

 

This isn't ideal obviously but it works repeatedly, so that's great.

 

Unfortunately, doing this exact same fix in my mission has just caused my soldiers to become catatonic or (even worse somehow) mill around the area like bees looking for honey. Sigh.

 

(Old thread with the same problem, though this fix hasn't worked here)

 

Share this post


Link to post
Share on other sites

Welcome to the wild, whacky, and wonderful world of Arma Editing!

 

In my Property of Mabunga mission, I had 2 squads of 10 AI plus a player that needed to board evac choppers at the end.  There were 3 choppers to fit all the AI.  So I wrote this script to get subsets of the AI to board each chopper.  In my situation there were chopper pilots outside of the  boarding AI group that were driving the choppers.  So this script would have to be tweaked to board some of your AI as drivers, and the rest as cargo.  It could be a start for you though.  Good luck!

Spoiler

//board.sqf
// This script will have units board multiple vehicles (if they don't all fit in first one).
// nul=[w_alpha, [wHeli1, wHeli2]] execvm "Scripts\board.sqf";
// nul=[alpha, [eHeli1, eHeli2, eHeli3]] execvm "Scripts\board.sqf";
// nul=[bravo, [eHeli1, eHeli2, eHeli3]] execvm "Scripts\board.sqf";
_group = _this select 0;
_vehicles = _this select 1;

if !(isPlayer leader _group) then
{
    _units = units _group;
    _unitCount = count units _group;

    _seatsAvailable = 0;
    _unitIndex = 0;
    {
      if (canmove vehicle _x) then
      {
          _seatsAvailable = vehicle _x emptyPositions "cargo";
          while {_seatsAvailable > 0 and _unitIndex < _unitCount} do
          {
             (_units select _unitIndex) assignAsCargo _x;
             [_units select _unitIndex] orderGetIn true;  
             _seatsAvailable = _seatsAvailable -1;
             _unitIndex = _unitIndex +1;
          };
       };
    } foreach _vehicles;
};

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, johnnyboy said:

Welcome to the wild, whacky, and wonderful world of Arma Editing!

 

In my Property of Mabunga mission, I had 2 squads of 10 AI plus a player that needed to board evac choppers at the end.  There were 3 choppers to fit all the AI.  So I wrote this script to get subsets of the AI to board each chopper.  In my situation there were chopper pilots outside of the  boarding AI group that were driving the choppers.  So this script would have to be tweaked to board some of your AI as drivers, and the rest as cargo.  It could be a start for you though.  Good luck!

  Hide contents

//board.sqf
// This script will have units board multiple vehicles (if they don't all fit in first one).
// nul=[w_alpha, [wHeli1, wHeli2]] execvm "Scripts\board.sqf";
// nul=[alpha, [eHeli1, eHeli2, eHeli3]] execvm "Scripts\board.sqf";
// nul=[bravo, [eHeli1, eHeli2, eHeli3]] execvm "Scripts\board.sqf";
_group = _this select 0;
_vehicles = _this select 1;

if !(isPlayer leader _group) then
{
    _units = units _group;
    _unitCount = count units _group;

    _seatsAvailable = 0;
    _unitIndex = 0;
    {
      if (canmove vehicle _x) then
      {
          _seatsAvailable = vehicle _x emptyPositions "cargo";
          while {_seatsAvailable > 0 and _unitIndex < _unitCount} do
          {
             (_units select _unitIndex) assignAsCargo _x;
             [_units select _unitIndex] orderGetIn true;  
             _seatsAvailable = _seatsAvailable -1;
             _unitIndex = _unitIndex +1;
          };
       };
    } foreach _vehicles;
};

 

 

Thank you for the kind welcome, sir! Blimey that's a lot of scripting, haha. Fortunately it seems that JohnKalo's "delete the truck" option has worked after a couple of hours of sighing, swearing and more sighing! Nonetheless I'm going to have a good look at this script (and your mission) and see if I can learn from it, since being a script wizard like this must be immensely helpful 🙂

 

I would have thought getting a bunch of dudes in cars and then driving would have been a piece of cake given how much loading and unloading goes on in the average AI mission with vehicles, but wow. Turns out life is not so simple, eh? 😉

 

Guess why it all didn't work in my last post? I had somehow deleted the "true" condition of my Get In waypoint during all the editing I was doing. Facepalm 😄 But as long as the trucks are grouped to the squad it seems to work as soon as the old vehicle is gone.

 

It's a shame the old vehicle has to be sacrificed to get the new one going but it's trivial given that vehicle becomes useless at this point in the mission anyway - I imagine an "ungroup" command would do the same thing if there is one, so I might experiment with that.

 

The last hurdle I have with this now is the damn pathing. Turns out slowly driving a truck and a car out of a base along a clear road requires Herculean skill, grit and determination...lol.

 

For future easy step-by-step reference for myself and other newbies, the way I got this working "the easiest way" was:

 

1. Create enough vehicles to fit your squad in. Faction etc. is irrelevant. Name your vehicles. For this example - VEHICLE1, VEHICLE2.

2. If near the enemy and of their faction, lock these vehicles to prevent them driving about in them. This is done with VEHICLENAME setVehicleLock "LOCKED";

3. Unlock the vehicles prior to your squad using them with a trigger and VEHICLENAME setVehicleLock "UNLOCKED";

4. Name your squad that is going to use the vehicles. SQUADNAME will be used for this example.

5. Sync your vehicles to your squad leader using the UI. I don't think this is strictly necessary but I haven't tried it without yet and it's harmless to do. Also sync them to each other, ditto.

6. In your squad settings, add this code to group the unmanned vehicles to your squad as "usable". (Thanks Pierremgi)

{ SQUADNAME addVehicle _x} foreach [VEHICLE1,VEHICLE2];

7. Delete any vehicle(s) your squad has been using. This is done with... (thanks JohnKalo)

deleteVehicle nameOfInitialVehicle;

8. Issue "GET IN" commands, however many are necessary, with the waypoint on each desired vehicle. If it works correctly, the Squad Leader AI will immediately say "GET IN THAT VEHICLE" and a list of squaddies rather than "move here". If he says "move here" something is wrong.

9. Set the formation of the waypoint to File or the spaced Line, to prevent insanity like "V formation truck convoys" which are as ridiculous as they sound. Not sure which order you need to get the Squad Leader in the lead vehicle if you're using an AI, so it's ideal to have the vehicles side by side (with good spaces too) to make it easier to them to pull into a line formation. If they're in a line already, you might end up with your Squad Leader boarding the middle vehicle and causing havoc.

10. Set a move waypoint and the vehicles should start moving in formation. Also if the unit has recently been in combat, set them to Safe to ensure they use the roads.

 

While it's uglier and less effective than the advanced scripted version I'm sure, it's also good enough for basic scenarios and I think it works with things like Helis too (though I will have to test it). 5 hours total to get these little *!%$!*U£($£ driving in a straight line in 2 trucks, LOL.

  • Like 2

Share this post


Link to post
Share on other sites

Your 3rd post, and you are already being a good forum citizen by posting your findings.   Excellent and thanks.  If you want to learn more about AI driving and how to get a convoy to move successfully (even if taking fire) look at the video in this post, and read the entire thread.  If you have solved your current problem, then don't bother, but remember this link is here for you when you need a foolproof convoy some day.

If

  • Like 1

Share this post


Link to post
Share on other sites

Thank you mate. That link will be very helpful with my enemy response convoy at the end of the mission, who are halting immediately on the road upon being shot at, lol. I think you pretty much predicted my next thread 😉 

Share this post


Link to post
Share on other sites

Glad your mission troubling was solved. Really liked when the squad's commander got in the first vehicle, exited it and then boarded the second one 😂 The AI has indeed got such issues.

  • Like 1

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

×