Jump to content
yxpoh

[RELEASE] AI Boarding/Alighting Your Helicopter Script

Recommended Posts

This is basically just a simple script to get the AI units in a group to get into the helicopter that you are riding in as a pilot. Not sure if any one need this, but just putting it out for people who might be interested.

NOTE: All these scripts are taking into consideration that you are the pilot, not the AI (seems to work even if it's empty lol...).

 

Pick up (To make sure that the AI doesn't take the copilot seat which might lead to issues.)

Quote

getin_fnc = {

    params ["_Grp", "_grpVeh"];

 

    {

        _x disableAI "TARGET";

        _x disableAI "AUTOTARGET"; 

        _x assignAsCargo _grpVeh;

    } foreach units _Grp;

 

    (units _Grp) orderGetIn true;

};

 

Alighting (Should have cleaned up enough)

Quote

getout_fnc = {
    params ["_Grp", "_grpVeh"];
    
    _Grp leaveVehicle _grpVeh;
    {

         unAssignVehicle _x;

         _x enableAI "TARGET";

         _x enableAI "AUTOTARGET";

     } foreach units _Grp;
};

 

Where

_Grp is group that is boarding or alighting the Helicopter,

_grpVeh is the helicopter you are trying to board or alight from.

 

I am currently trying to make a custom mission that uses the Hummingbird as the main theme and deploying AI units around is one of the requirements,so I ended up doing this to pickup the AI units.

 

Usage: (I can't attach a file for some reason.)

1. Copy both functions into a file or use this file, https://www.mediafire.com/file/jzllzdsojgol1ox/functions.sqf

 

2. Run this command in init.sqf, or whenever you need it. 

Quote

 call compile preprocessfilelinenumbers "functions.sqf";

where functions.sqf is where you save those two functions in.

 

3. Call the function and send the required parameters for it.

Quote

[_grp, _vehicle] call getin_fnc; //To get the group in

[_grp, _vehicle] call getout_fnc; //To get the group out

 

As of now, I tried it with an unmanned helicopter as well.

 

Hope it is useful to whoever find this.

 

PS: Place this because I was searching far and low for such a script but couldn't find it, so I thought since I get it working, I should put it out for people to use. Didn't like MoveinCargo since it's just scripting the AI to appear and disappear :P
Just my preference.

  • Like 1

Share this post


Link to post
Share on other sites

I would recommend something here,

use params in your function and allow for the user to call it and simply pass the parameters so in that, nothing is entirely static or manual.

I would put [RELEASE] before your thread title, so that everyone understands that you are showing a script you made and not that you need help.

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi @Midnighters

 

Thanks for the suggestion. But yeah, it was intended to be just a general idea. Actually, the code that I wanted to show is actually just the waypoint since I believe adding of spawn group is what exactly how the bohemia wiki defines. 

 

Nonetheless, making into a function in the mission I am making is definitely something I would want to explore next after I got my basic features sorted out.

 

Thanks again.

Share this post


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

Hi @Midnighters

 

Thanks for the suggestion. But yeah, it was intended to be just a general idea. Actually, the code that I wanted to show is actually just the waypoint since I believe adding of spawn group is what exactly how the bohemia wiki defines. 

 

Nonetheless, making into a function in the mission I am making is definitely something I would want to explore next after I got my basic features sorted out.

 

Thanks again.

Sweet! not a problem,

I am sure someone will find a use for this.

  • Like 1

Share this post


Link to post
Share on other sites

Just updated with relevant codes and uploaded the file through mediafire.. (Please teach me how to attach a file to the forums directly if you know how. Thanks.)

Hope this helps.

  • Like 2

Share this post


Link to post
Share on other sites

Edited to add Alternative script for picking up AI.

  • Like 1

Share this post


Link to post
Share on other sites

quick tip: repeat it, make into one line:

{unAssignVehicle _x} forEach units _Grp;
{_x enableAI "TARGET"; _x enableAI "AUTOTARGET";} foreach units _Grp;
//should be
{
unAssignVehicle _x;
_x enableAI "TARGET";
_x enableAI "AUTOTARGET"
} forEach units _Grp;

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks. Was just testing out things.. Haven't really went into optimizing the codes yet. Kinda lazy too :P haha

 

Anyway, thanks to this, I managed to clean up the mission I came up with. A bit like advertisement but here, https://steamcommunity.com/sharedfiles/filedetails/?id=1174045120.

Uses the above script but edited for the mission's use. Still in its barebones though

  • Like 1

Share this post


Link to post
Share on other sites
38 minutes ago, yxpoh said:

Thanks. Was just testing out things.. Haven't really went into optimizing the codes yet. Kinda lazy too :P haha

 

Anyway, thanks to this, I managed to clean up the mission I came up with. A bit like advertisement but here, https://steamcommunity.com/sharedfiles/filedetails/?id=1174045120.

Uses the above script but edited for the mission's use. Still in its barebones though

Sweet, I'll take a look

  • Like 1

Share this post


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

Sweet, I'll take a look

 

Oh! Thanks! I am still worried about the sync issues on a dedicated server as I was only able to test myself as a client on the server.

 

Server to client is ok. but not sure about server to multiple clients.

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

×