Jump to content
Sign in to follow this  
colinm478

AI chopper help?

Recommended Posts

Hey guys I have a complex one here for you. I am having my team move in during a night mission, but they are ambushed and forced to retreat. The enemy (AI) launches a search helicopter, (with spotlight on). I have been trying to figure out how to make them land near us on detection. I know how to set up the trigger and search, but how can I make them land near us?

We could be in a large area of space, so when it finds us it needs to know to land near us, so I can't just set a transport unload waypoint. Any ideas?

Share this post


Link to post
Share on other sites

No promises, as I am a bit of a novice myself, but I'll try to take a whack at this tomorrow.

If any more experienced posters know how to do this, go ahead and reply, as, as I said, I am still relatively inexperienced, and may not be able to figure it out.

Share this post


Link to post
Share on other sites

there are a few ways, but the biggest problem you will face is finding a position close enough to your team where the AI can actually land without crashing.

You might want to try this function for giving you a good position near your team:

landingPos= [[[getpos player, 50]]] call BIS_fnc_randomPos;

50 is the radius to search for, it gives back a random position that is not a building or on water (but it still isn't 100 fool proof)

Then you can tell the AI to land after, im not sure if code has changed since Arma 2, but this might work:

_helicopter move landingPos;

sleep 3;

while { ( (alive _helicopter) && !(unitReady _helicopter) ) } do
{
      sleep 1;
};

if (alive _helicopter) then
{
      _helicopter land "GET OUT";
};

note that you cant use while loop or sleep inside a trigger (in case you didn't know) but that would be the general gist of it.

Share this post


Link to post
Share on other sites
there are a few ways, but the biggest problem you will face is finding a position close enough to your team where the AI can actually land without crashing.

You might want to try this function for giving you a good position near your team:

landingPos= [[[getpos player, 50]]] call BIS_fnc_randomPos;

50 is the radius to search for, it gives back a random position that is not a building or on water (but it still isn't 100 fool proof)

Then you can tell the AI to land after, im not sure if code has changed since Arma 2, but this might work:

_helicopter move landingPos;

sleep 3;

while { ( (alive _helicopter) && !(unitReady _helicopter) ) } do
{
      sleep 1;
};

if (alive _helicopter) then
{
      _helicopter land "GET OUT";
};

note that you cant use while loop or sleep inside a trigger (in case you didn't know) but that would be the general gist of it.

It looks good, but if I can't use the loop or sleep in a trigger (I tried it caused the game to freeze and it didn't work) how would I go about using it? Do I have to figure it out without the loop or sleep or is there another way to use it

Share this post


Link to post
Share on other sites

Chopper lights are bugged since arma3 came out, unfortunately no response from the devs yet...

Check this out if you want to help:

http://feedback.arma3.com/view.php?id=15487

For the landing the most basic thing would be to use

dostop choppername;

{

unassignvehicle _x;
[_x] allowgetin false;
[_x] ordergetin false

} foreach assignedcargo choppername;

The chopper will land autonomously without having to spawn anything.

It will also search for a fitting spot to land in without crashing (most of the time at least)

Share this post


Link to post
Share on other sites
Chopper lights are bugged since arma3 came out, unfortunately no response from the devs yet...

Check this out if you want to help:

http://feedback.arma3.com/view.php?id=15487

For the landing the most basic thing would be to use

dostop choppername;

{

unassignvehicle _x;
[_x] allowgetin false;
[_x] ordergetin false

} foreach assignedcargo choppername;

The chopper will land autonomously without having to spawn anything.

It will also search for a fitting spot to land in without crashing (most of the time at least)

Thank you guy! I actually just got that aspect of my mission working with Igneous01's solution. I think my problem with landing was because I had allowFleeing set to 1. I fixed it now and now if we are detected it lands right near us and a commando squad jumps out and attacks while the chopper flies away.

As for the spotlight, I got that working earlier using another piece of script I found, I think it's just a spotlight at getpos, but it's good enough for this mission.

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  

×