Jump to content
Sign in to follow this  
domcho

Problem with getting AI in helicopter

Recommended Posts

Hello. I've been trying to make spetsnaz and pilots get in Hinds and fly away. I placed 4 Hinds, 8 pilots and 32 spetsnaz. On every spetsnaz team leader I typed spetsnaz(number)=group this where (number) is from 1-4 because there are 4 groups of 8 spetsnaz. The trigger has the following command for the first group:

{_x assignAsCargo Hind(number)} forEach units Spetsnaz(number); Pilot(number) assignAsDriver Hind(number); Pilot(number) assignAsGunner Hind(number); {[x] orderGetIn true} forEach units Spetsnaz(number); [Pilot(number), Pilot(number)] orderGetIn true

Here (number) is the index in the name of the helicopter/spetsnaz group/pilot, for example group spetsnaz1 gets in hind1, pilot 1 gets in as driver, pilot 2 gets in as gunner

Now everything works just fine. However there is a problem with the 4th group. It depends where I place them on the map. The closer they are to the Hind the more soldiers get in. I mean their squad leader tells them to board the helicopter and some of them get in, the rest stays out and disobeys for no reason. Also when the get in command is issued they start running around and stop at a particular position. Same for the pilots. Either the pilot gets in and the gunner stays out or vice versa. The first 3 spetsnaz groups and pilots do they're job properly, no problem, but the last 4th group doesn't. It has the same trigger and everything, I triple checked if I typed something wrong but everything is correct, however they do not get in the helicopter or at least not all of the spetsnaz and 1 of the pilots. I don't understand what's causing this. There are no enemies around to trouble them. It's just a simple trigger telling them to get in the helicopter and they respond to it with a strange behavior. Can you guys please tell me how can I fix this? To me it looks like an AI bug and it really surprises me. This is just the beginning of my mission and I'm stuck on this.

I know I can use the moveInCargo/moveInDriver/moveInGunner commands but I want them to board the helicopters normally not just start inside them. And also the problem is NOT the space in the helicopter, each Hind can fit 8 soldiers in the back and each of my spetsnaz groups is formed of 8 men. Thank you.

Share this post


Link to post
Share on other sites

Hi... one of your variables is missing the undescore... and check your pilot numbers.

{_x assignAsCargo Hind(number)} forEach units Spetsnaz(number); Pilot(number) assignAsDriver Hind(number); Pilot(number) assignAsGunner Hind(number); {[[color="#FF0000"]_[/color]x] orderGetIn true} forEach units Spetsnaz(number); [Pilot(number), Pilot(number)] orderGetIn true

Here's a friendly suggestion... start writing scripts and stop trying to cram stuff into those text boxes in the editor!

myscript.sqf:-

_vehicle = _this select 0;
_pilots = _this select 1;
_group = _this select 2;

(_pilots select 0) assignAsDriver _vehicle; 
(_pilots select 1) assignAsGunner _vehicle; 
{[_x] orderGetIn true} forEach _pilots;

{_x assignAsCargo _vehicle } forEach units _group;
{[_x] orderGetIn true} forEach units _group;

Execute it from your triggers like this:-

nul = [Hind1,[Pilot1,Pilot2],Spetsnaz1] execVM "myscript.sqf";

Hope it helps.

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

I typed it correct in the editor, I mistyped it here because I didn't copy+paste what was in the trigger.

I don't like using script files. I like sticking to the trigger and waypoint boxes, but if scripts are the only way then could you please explain the myscript.sqf code

I have done scripts before but only simple and this was back in Operation Flashpoint. I never understood what are the lines like

_vehicle = _this select 0;

_pilots = _this select 1;

_group = _this select 2;

(_pilots select 0) assignAsDriver _vehicle;

(_pilots select 1) assignAsGunner _vehicle;

_this select and _vehicle select what do they mean? I know I can copy+paste it and try it but I want to know what they mean and what they do exactly line by line. Thanks though.

Share this post


Link to post
Share on other sites

I made the script. Still the same. They run around and some of them get in, the rest disobey and after 2 minutes they decide to finally get in. Also when they're boarding, before they board they run around like idiots and take strange paths until they decide to go to the helicopter and get inside.

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  

×