KeyCat 131 Posted October 14, 2004 I want to reuse a plane for air strike but I'm not able to get it back to the ground without damage? I try to use the code below but the plane (an A-10 in my tests) always crash into the ground and damages. Looks like it's not extending it's landing gears and therefor bumping somewhat up and down and gets more and more damaged. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ... unassignVehicle _pilot _plane setVelocity [0,0,0] _pilot setVelocity [0,0,0] _plane setPos [_x,_y,0] _pilot setPos [_x,_y,0] ... Any ideas? /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
Guest [B.B.S.] T_D Posted October 14, 2004 plane land "land" Share this post Link to post Share on other sites
KeyCat 131 Posted October 14, 2004 Haven't tried that since command reference states that it's for choppers... Good idea and just tried it but unfurtunately it doesn't work /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
sanctuary 19 Posted October 14, 2004 You can use the autopilot function , if the island has an AI capable runway , you can have it to land safely <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nameofplane setspeedmode "LIMITED"; nameofplane action ["LAND"] the LIMITED speed is necessary, else the AI plane will miss everytime the good path and will just fly in circle for an unlimited amount of time, unable to obtain the good landing speed. -tested- Share this post Link to post Share on other sites
BoweryBaker 0 Posted October 14, 2004 old school manual landing. Â slow to like 300, line up with the runway or a good idea of where it is, slow down to like 100 when you're really close, gears down, flaps down at some point before landing, make the back wheels touch first on touchdown and start breaking, front wheels will touch down, steer for any additional lining up needed and stay on the breaks till it stops and you're good. Share this post Link to post Share on other sites
havocsquad 0 Posted October 14, 2004 For an AI aircraft, you need to do this... Have a trigger with a radius of 10 meters on the spot where the AI gets out of their aircraft on the airport and stick a trigger in that position in mission editor. Make sure it is set where the trigger will repeat the process. Then, declare a variable such as "landed" equal to true. When you want to launch the aircraft again, you have to create another trigger in mission editor with 0 meter radius, selecting a Radio Action, then in the "Condition" field, have this... Â this AND landed This condition will ensure that the aircraft has landeded and stopped before executing the trigger to launch the A10 again. Now that you've met the condition for the trigger, you will create a script for the A10. [] exec "something.sqs" The script should look something like this... "aircraftname" setfuel 1 "pilotname" moveindriver "aircraftname" If you plan just to sortie the aircraft ONCE after it has landed, then you can use waypoints to move it where you want it to go. Â You must though have a boolean variable in the condition field of the waypoint after "GETOUT" so that the pilot won't run off following the waypoints or take off as soon as the pilot disembarks the A-10. Just declare that variable true and the plane will go and do its stuff. variablename=true If you plan to reuse the aircraft more than just once, I suggest you use commandmove statements in this script instead of waypointing, or you could use a "Cycle" waypoint to avoid that but its slightly more complicated using aircraft with the "cycle" waypoints. ~40 "pilotname" setbehaviour "Combat" "pilotname" setcombatmode "RED" exit "objectlocation" is either a trigger with a specific name you write into it, a gamelogic with a name you assign it, or an actual object in OFP. My best advice for you is to bone up on understanding conditions and logic arguments (AND, OR, NOR, XOR). Â And to also experiment a "TON". Â Play with some simple aircraft missions and learn how mission makers make it work. Â I'd avoid any really complicated mission, especially when they mostly use scripts to control overall behaviour. Share this post Link to post Share on other sites
T J 0 Posted October 14, 2004 Keycat, it depends how realistic you want to be. Looking at your first idea I would guess the effects are the important thing, and not that the plane goes off and lands and rearms and refuels etc (this is possible and is a neat trick but is usually unseen by the player and probably just a waste of resources. For what your script above does you may as well deletevehicle the original plane, and createvehicle another one, you can even use the same pilot if you wish. You could prevent the damage in your script above by extending the gear before doing the setpos, possibly, but as you are faking it anyway, why not just have him fly off somewhere and then artificially re-arm him mid air and bring him back as required. There is a number of ways of doing this, either using domove or better by moving his waypoints. For ultimate realism you could have an aircraft who lands after a run and then rearms, with a time limit enforced between attacking runs. To bring the plane under your control for the duration of his attack, so that you can assign him targets, you can also join him to your group temporarily. The possibilities are endless........................ TJ Share this post Link to post Share on other sites
KeyCat 131 Posted October 15, 2004 Thanks for your suggestions guys. Sanctuarys solution worked fine if I wanted to have the AI to land the plane at an airstrip but as TJ noticed I just wanted to get the planes back on ground using setPos. All this happens outside players view so it's overkill to actually land the plane. I managed to get the plane down undamaged by lowering the landing gears (_plane action ["Land gear"]) and everything looked fine. But after testing it several times I noticed that it only would run as it should the first time I called it. If I "re-use" the plane as planned the AI seems to behave different to "move" command and I also notice a faint smoke after the plane even if it's not damaged (i.e getdamage returns 0)? TJ, before I tested the above I used createvehicle and  deletevehicle to get another plane but the problems was as above and also the first time I used the plane for a strike? It's very strange but it seems the AI (or something else) behaves differently after using a setVelocity? Quote[/b] ]The possibilities are endless........................ Yea! Thats the beauty of our belowed OFP. Due to the kick ass mission editor, script language and high quality addons made by the community OFP is to last, thats for sure  /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
redface 1 Posted October 15, 2004 old school manual landing. Â slow to like 300, line up with the runway or a good idea of where it is, slow down to like 100 when you're really close, gears down, flaps down at some point before landing, make the back wheels touch first on touchdown and start breaking, front wheels will touch down, steer for any additional lining up needed and stay on the breaks till it stops and you're good. this thread is about AI of course ... I assume there is no way to land an airplane on custom islands that have failed to change the airstrip ILS system markings? I'm always disappointed when I find out that a beautiful, crafted island becomes unusuable because the airport cannot be used by AI. Share this post Link to post Share on other sites
hardrock 1 Posted October 15, 2004 I assume there is no way to land an airplane on custom islands that have failed to change the airstrip ILS system markings? I'm always disappointed when I find out that a beautiful, crafted island becomes unusuable because the airport cannot be used by AI. yet . . . We're working on a solution that will (should) also work for mutiple airstrips. Share this post Link to post Share on other sites
Unnamed_ 0 Posted October 15, 2004 Quote[/b] ]We're working on a solution that will (should) also work for mutiple airstrips. You and me both then Although I'm happy to say you definatly can have multiple AI Airstrips and Carriers. Although I cant help thinking how much time and effort will go into developing the same thing? Share this post Link to post Share on other sites
hardrock 1 Posted October 15, 2004 I don't know, we're practically finished and combined the whole thing also with an ILS system to enable these landings also for the player. The last problem we're trying to solve is to get the AI to lower their gear, because the plane action ["LAND GEAR"] thing doesn't work. I PMed Suma about it and he told me that he _thinks_ (OMG who knows it then? ) that the AI will decide for themselves most of the time and cannot be manipulated concerning lowering or retracting the gear. But let's have a talk though, would be interesting to compare our results Share this post Link to post Share on other sites
nephilim 0 Posted October 15, 2004 wot about forcng the ai to do so? i mean the newest gears are animated right? why not doing so when AI on approach checking (i refer to lesters FSS 1.01) ils points or wot ever u use for that Share this post Link to post Share on other sites
hardrock 1 Posted October 15, 2004 The problem is not to check WHEN the AI should lower the gear, it's rather to get the AI to DO so. And, how it seems, you can't do that. You can enforce gear lowering when the player is the pilot of the plane by using the syntax <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player action ["LAND GEAR",vehicle player] but the same doesn't work for AI. So it's a problem if you let the AI land somewhere but it won't lower the gear. Share this post Link to post Share on other sites
Unnamed_ 0 Posted October 15, 2004 Quote[/b] ]So it's a problem if you let the AI land somewhere but it won't lower the gear. Are you talking about AI units landing or the player landing using AI autopilot? I use the same method nephilim suggested, for AI units. For the player I planned on adding an extra action to the menu. Then when selected, moving him off to some place and swaping him with a suitable AI unit and a call to switchcamera. Sounds like your pretty much there. I think the problem is having to fight OFP's pilot AI at certain points during landing and takeoff. Once it gets a mind to do something, there is no stopping it @KeyCat If it all goes on out of sight, does the plane have to be on the ground to re-use it? Cant the refueling, ammo, repair and passangers be done with scripts, in flight? Share this post Link to post Share on other sites
KeyCat 131 Posted October 16, 2004 Quote[/b] ]but the same doesn't work for AI. So it's a problem if you let the AI land somewhere but it won't lower the gear. @ hardrock: Hmm, in the testings above I managed to do just that when experimented with the action ["Land gear"] on an AI controlled BIS A-10? Quote[/b] ]If it all goes on out of sight, does the plane have to be on the ground to re-use it? Cant the refueling, ammo, repair and passangers be done with scripts, in flight? @ Unnamed_: That would somewhat work but I would prefer to have it on the ground for some reasons. First I suspect it take less resources if not flying and second thing is that you would probably at distance hear the plane in the air. /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
nephilim 0 Posted October 16, 2004 hmm question does ear have to be named like with a selection so the ai uses it properly?? if so create like an AI version of it adn name the gaer diffrent ly ten u run teh average ils script or sth like it to get the ai to land then simpel use a script to animate th gear down dunno if this will work its just a though Share this post Link to post Share on other sites
hardrock 1 Posted October 16, 2004 @ hardrock: Hmm, in the testings above I managed to do just that when experimented with the action ["Land gear"] on an AI controlled BIS A-10? really? well, please feel free to send me a sample mission, because I spent an hour to get the AI (it's an AI pilot is it?) to lower the gear, but wasn't able to make it. Maybe I'm simply too dumb . . . Share this post Link to post Share on other sites
Unnamed_ 0 Posted October 16, 2004 You can only lower AI's landing gear if the plane is stationary and/or on the ground. Cant remember exactly, checkout this thread over at OFPEC: http://www.ofpec.com/yabbse....start=0 Share this post Link to post Share on other sites
T J 0 Posted October 16, 2004 i would keep the same plane, fly him out of sight, re-arm him, then bring him back tj Share this post Link to post Share on other sites
KeyCat 131 Posted October 18, 2004 really?well, please feel free to send me a sample mission, because I spent an hour to get the AI (it's an AI pilot is it?) to lower the gear, but wasn't able to make it. Maybe I'm simply too dumb . . . Sorry but I don't have any sample mission since I was only experimenting but if I recall correctly I used setVelocity just before I gave the action command, something like... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _plane land "land" _plane setVelocity [0,0,0] _plane action["Land gear"] unassignVehicle _pilot _pilot setVelocity [0,0,0] _plane setPos [_sx,_sy,0] _pilot setPos [_x+20,_y,0] Hope this helps... /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites