Jump to content
Sign in to follow this  
thebarricade

TBR_takeoff - "force" AI to take off from short runways in C130's

Recommended Posts

I've made a smallish script which forces AI-pilots to actually take-off in a C130, instead of crashing into trees, hills, fences or whatever.

It isn't extremely realistic, but if we pretend the C130's are using rocket-assisted take-off, it's easier to accept. :)

I've tested it on all runways in Chernarus, and as long as the plane starts from the south-east (roughly), it manages to get airborne.

Now the script is capable of getting a plane airborne whereever there is a strip of flat land without obstructions...

Also tested on FDF Podagorsk, where it manages to clear that pesky hill at the end of the runway.

Usage:

[plane1, 70, 300, 0.35, 200, 15] execvm "tbr_fnc_takeoff.sqf";

Needs the BIS Functions-module placed on the map!

takeoff_su34.utes.7z

Now the mission-author has more control over climb-angle, takeoff speed and some more things...

_plane 			// the plane that is forced to take-off
_release_height 	// the script will control the plane until it reaches this height (meters)
_height 		// height the plane should fly in (meters, via flyInHeight, the AI should take care of this)
_acc			// some sort of acceleration-factor (0.25 is good for the C130, 0.35 seems to fit the Su34)
_to_speed 		// the plane should take-off at this speed (in kph)
_climb_angle 		// and use this climb-angle (in degrees, somewhere between 15 and 20 degrees, or the script seems to have problem ascending to release-height)

Edited by thebarricade
more files

Share this post


Link to post
Share on other sites

What the heck? Where's my bad luck gone!?

I'm putting together a quick mission for today with a couple of friends and thought I would want a plane taking off, obviously the plane crashed into a tree so I went on here to see if someone knew how to do it. And here you have posted the exact solution - today!

Nice one! :)

It's working perfectly by the way, thank you!

Share this post


Link to post
Share on other sites

I also noticed that the AI would crash the su34 if he was piloting it and the player was sitting next to him. If both are computer players then it would take off successfully

Share this post


Link to post
Share on other sites

Maybe the player should lose some weight?

Sorry, bad joke.

I also noticed other occasions where the AI mess up their duties if a player is in the vehicle.

Driving cars is one.

Share this post


Link to post
Share on other sites

Please also test NW airport (unpaved) on Duala v1.0. If C130 AI takes off from there, hats off to you :)

Share this post


Link to post
Share on other sites

I had to place the plane out in the rough, or it would do a turn or two before finding its way down the "runway":

169mf4m.jpg

Up, up, and away (with plenty of room to spare)...

2is8w92.jpg

So, hats off then :) (if this was the correct runway)

I had to adapt the script a tiny bit, though...

tbr_takoff.sqf
Line 15: _hgt = _hgt + 3;

Without that change, the plane still takes off, but it starts flying out in the rough, which looks kind of funny...

---------- Post added at 05:32 PM ---------- Previous post was at 05:27 PM ----------

I also noticed that the AI would crash the su34 if he was piloting it and the player was sitting next to him. If both are computer players then it would take off successfully
Gnat;1547789']Yes' date=' noticed the same.

But with the C130, it still crashes with AI only onboard[/quote']

This isn't related to my script, is it? I haven't experienced that myself (inregards to the script, that is).

Edited by thebarricade

Share this post


Link to post
Share on other sites

I have "improved" the takeoff script. Now it is capable to takeoff anywhere there is enough flat land (in the region of 300-400 meters, I think).

Improved script (on Isla Duala)

The new demo-mission is set on Isla Duala, since there are quite a lot of open space (and isn't too cluttered with trees and bushes).

Share this post


Link to post
Share on other sites

This isn't related to my script, is it? I haven't experienced that myself (inregards to the script, that is).

Nope, but perhaps your script could come in useful if adapted to make the su34 AI takeoff with a human co pilot.

Share this post


Link to post
Share on other sites
Nope, but perhaps your script could come in useful if adapted to make the su34 AI takeoff with a human co pilot.

Enjoy: takeoff_su34.utes.7z

Now the mission-author has more control over climb-angle, takeoff speed and some more things...

_plane 			// the plane that is forced to take-off
_release_height 	// the script will control the plane until it reaches this height (meters)
_height 		// height the plane should fly in (meters, via flyInHeight, the AI should take care of this)
_acc			// some sort of acceleration-factor (0.25 is good for the C130, 0.35 seems to fit the Su34)
_to_speed 		// the plane should take-off at this speed (in kph)
_climb_angle 		// and use this climb-angle (in degrees, somewhere between 15 and 20 degrees, or the script seems to have problem ascending to release-height)

Edited by thebarricade

Share this post


Link to post
Share on other sites

hi, thebarricade

do you have a working link or could you paste script tbr_fnc_takeoff.

Working on script where C130 comes into land but aborts and flys off. (maybe impossible)

1) AI lands

2) Clear AI http://forums.bistudio.com/showthread.php?t=107520&highlight=disableai

3) move to/Take off

The last past is what I am missing. AI taxis to other runway.

pilot = driver air_vehicle;

air_vehicle addEventHandler ["LandedTouchDown", "_dam = damage pilot ;pilot setdamage 0.9;sleep 0.1;pilot setdamage _dam;pilot doMove [landpos select 0, landpos select 1, 10];"];

pilot action ["Land", air_vehicle];

Share this post


Link to post
Share on other sites
Working on script where C130 comes into land but aborts and flys off. (maybe impossible)

UnitCapture and UnitPlay it.

Share this post


Link to post
Share on other sites

thx will read up.

Kind off got further with my code. Switch the pilot on touch down. But run way still to short for new AI pilot so he taxis.

pilot = driver air_vehicle;

air_vehicle addEventHandler ["LandedTouchDown",{nul = execVM "scripts\switch_pilot.sqf"}];

pilot action ["Land", air_vehicle];

switch_pilot,sqf...

sleep 1;

pilot setdamage 1.0;

dostop air_vehicle;

sleep 1;

aipilotinsert = creategroup West;

bobthepilot = aipilotinsert createUnit ["US_Soldier_Pilot_EP1", [0,0,0], [], 0, "CAN_COLLIDE"];

bobthepilot moveInDriver air_vehicle;

bobthepilot setrank "CAPTAIN";

aipilotinsert selectLeader bobthepilot;

sleep 0.5;

bobthepilot doMove [landpos select 0, landpos select 1, 100];

Share this post


Link to post
Share on other sites
hi, thebarricade

do you have a working link or could you paste script tbr_fnc_takeoff.

I've been away from the internets for a short while, but I can post a more permanent link to tbr_takeoff tomorrow (tuesday in euroland).

Share this post


Link to post
Share on other sites

thanks. Got it 95% working with your script. On zargabad airstrip.

plane touches down, accelerates, takes off. All smoothly.

As plane is moving changed _modspeed = 1 to 30.0; or it stops then starts again on landing. But this is causing plane to drop out of sky i guess when AI takes over. Thats for tomorrow.

using C130 with this call.

[air_vehicle, 200, 200, 0.25, 260, 10] execVM "scripts\tbr\tbr_fnc_takeoff.sqf"

Edited by cream-t

Share this post


Link to post
Share on other sites
´... when AI takes over.

Been trying to get this to work, and while I, as you, can get that darn plane to take-off again. As soon as the AI kicks in it eases of on the throttle and does a death-plunge. :eek:

I haven't a clue on why, so if you get this to work, please tell me how.

Share this post


Link to post
Share on other sites

before I changed _modspeed I did get the AI to take over and fly to a WP 90 degrees from air strip.

Will try tonight.

Share this post


Link to post
Share on other sites

This is an old thread but I just started using the script and it works perfectly ! One question - How can I get the script to be triggered? My current line is

waituntil {!isnil "trigger1"};

sleep 5.0;

{

sleep 1;

player sidechat format[ "%1", _x];

} ForEach [3,2,1];

[niceman, 70, 300, 0.35, 200, 15] execvm "tbr_fnc_takeoff.sqf";

But the plane does not wait for the trigger to go off, it just detects the trigger on the map and goes. Any way for it to be the trigger has to be activated before it takes off?

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  

×