Jump to content
Sign in to follow this  
Fenrir

AI landing

Recommended Posts

Hi :)

Is there anyway of getting an AI jet to land without giving them a getout command?

Cause i want my AI jets to take off once a trigger has been activated, give air support, land, rearm, then take off again. So i dont really want the pilots getting out afterwards :p

Are there any other commands i can use ? or will i just have to tell them to get back in again then cycle?

Share this post


Link to post
Share on other sites

maybe.

vehicle unit action ["Land", vehicle unit] ;

and a eventhandler with

LandedTouchDown

and or

LandedStopped

thouse are other commands to use for landing. and checking which airport landed at..

Share this post


Link to post
Share on other sites

Thanks :)

pssst....what do you mean by event handler ? :p Im not too good on scripting part etc yet :rolleyes:

Share this post


Link to post
Share on other sites

Sorry to be a pain but....that didnt really hel pme to understand much :rolleyes: Do i make a script for these? or add them on a waypoint ?

Share this post


Link to post
Share on other sites

Please can someone explain how to use these event hadlers :o

And is there a way of forcing AI to stay in the vehicle, even with the engine off? Because if i use get out, once they pass through the rearm point, the engine shuts off while it's refueling and then they get out again. And because it's now inside the rearm point, whenever they get back in they jump straight out again :p

Share this post


Link to post
Share on other sites

Well, an eventhandler is a way to launch script based on some events. They are added with the addeventhandler command, and suppressed by the removeeventhandler one (astounding, no ?).

For example, if you wanna delete the body of a soldier killed, you can just :

name_of_soldier addenventhandler ["killed","deletevehicle _this select 0"]

Additionnaly, the eventhandler may return some values that can be used into the script : for example the above eventhandler returns an array (named _this) composed by : [the unit killed,the killer] that can be reached with the "select command".

For example try :

name_of_soldier addEventHandler ["killed", "hint format["Unit killed : %1, Killed by %2",_this select 0,_this select 1]"]

The list of all event handlers in ArmA are posted in my post above (you should look at it !) :

About your trouble, i dunno how the provide the pilot of the given landed plane from getting out of it (unless the moveindriver command as soon as he gets out with an getout event handler for example).

Share this post


Link to post
Share on other sites

try mess a bit with this.. its not perfect. you need to add more code to it..

like put a reloade function in it..

place 2,3 planes in editor not in group. name the plane example plane1 so on. and a marker named goto

i have not tested this on utes tho.

// names on init of planes in editor..
_planes = [plane1,plane2,plane3];
land = {
_unit = _this;
deleteWaypoint [group _unit, 1];
vehicle _unit action ["Land", vehicle _unit] ;
//	hint "ai take land fnc";
};
takeoff = 
{
      _unit = _this select 0;
vehicle _unit setfuel 1;
_pos = getMarkerPos "goto";
_grp = group _unit;
_wp = _grp addWaypoint [[_pos select 0,_pos select 1,1],1];
[_grp, 1] setWaypointCompletionRadius 400;
[_grp, 0] setWaypointBehaviour "CARELESS";
[_grp, 1] setWaypointBehaviour "CARELESS";
[_grp, 0] setWaypointCombatMode "BLUE";
[_grp, 1] setWaypointCombatMode "BLUE";
[_grp, 1] setWPPos [_pos select 0,_pos select 1,1];
[_grp, 1] setWaypointType "MOVE";
[_grp, 1] setWaypointTimeout [0,0,0];
[_grp, 1] setWaypointStatements ["true", "this call land;"];
//	hint "ai take off";
};

you should also change the behaviour of the modes. or even add in 1 more waypoint.

{ 
vehicle _x setfuel 0;
sleep 3;
_x addEventHandler ["LandedStopped", "_this call takeoff;"];
[_x] call takeoff;
} foreach _planes;

call this script by a radio trigger to test with

by adjustin [_grp, 1] setWaypointTimeout [0,0,0];

you can change how long before you call land on you planes. example if you use DESTROY mode

you want them to do a couple if runs around the zone.. "let the ai use its weapons.." so they may be need 2-3 min"

remember the ai will taxi on the airport.

problem i think is it will land on closest airport.. so you could add in gotoAirport function.. which set a wp close to your airport with a marker. before you call the land function or mess with the landAt command. but you need to know the airport id then.,2nd array of LandedStopped should give you that.

Edited by nuxil

Share this post


Link to post
Share on other sites

can anyone tell how to make the plane stop?

i have this code but the plane touches runaway and takes off again:

_plane addeventhandler ["LandedTouchDown", "_plane stop true; hint 'stopping'; "];

to make it land i used this code:

_plane landat 3;

_plane action ["Land", _plane] ;

where _plane is the plane placed in editor. should it rather be the pilot?

Edited by rrr44

Share this post


Link to post
Share on other sites
_plane addeventhandler ["LandedTouchDown", "_plane setfuel 0; hint 'stopping'; "];

Share this post


Link to post
Share on other sites
_plane addeventhandler ["LandedTouchDown", "_plane setfuel 0; hint 'stopping'; "];

Hmm i tried with setfuel 0 but no difference.....

Share this post


Link to post
Share on other sites

yup sure did wrote that line my self.

Share this post


Link to post
Share on other sites

nm i got working. the _plane variable didnt exist in that scope

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  

×