Jump to content

AI::TASK_PLANE_MISSION experiments


S1C88

Recommended Posts

I wanted to create jets to fly by and bomb a certain area - so I looked closely at the am_airstrike.c4 file. I really don't understand the rPtr and the wPtr and other stuff. I was able to pick apart some things though. What I did was I teleported to McKensie Airfield, I placed a marker on the map and spawned the aircraft. I set up a icon for friendly. Just wish I could set it as an aircraft so i know.

 

However, messing around with the AI::TASK_PLANE_MISSION variables I noticed that some of the values control the flaps, rudder and other components of the plane. It takes off but usually crashes into something. When it does take off - it soars in the sky which is nice!

 

What I've figured out so far is:

AI::TASK_PLANE_MISSION(pedHandle, vehHandle, (???),pedHandle,x,y,z,4(whatever this is), 60.0f - speed, 15.0 - not sure what this is, -1.0f - not sure what this is, SYSTEM::CEIL(50.0 + 5.0), 20);

some parts II'm able to understand the rest I'm not 100% sure. I know when you replace the 4 with the 8 does a roll.

 

Has anyone else messed with this?

Link to comment
Share on other sites

Amey.Banaye

I got that working by Editing the values :-

 Function.Call(Hash.TASK_PLANE_MISSION, pilot, selectedAirplane, 0, 0, Target.X, Target.Y, Target.Z, 4, 30f, 50f, -1f, 100, 20);

This will make the pilot fly the plane to the coordinates.

 

100 stands for the Max Speed whereas 20 stands for the minimum speed.

 

Maybe 30f,50f,-1f are the minimum distance between the target and the plane ?

 

Beware if you use this scripts on heli's the game will crash.


 Function.Call(Hash.TASK_PLANE_LAND, pilot, selectedAirplane, runwayStartPoint.X, runwayStartPoint.Y, runwayStartPoint.Z, runwayEndPoint.X, runwayEndPoint.Y, runwayEndPoint.Z); 

To land a plane.

Edited by Amey.Banaye
Link to comment
Share on other sites

Vrock_wave

I use this method for airplane it works well

AI.TASK_VEHICLE_DRIVE_TO_COORD(ped, car, hop.coodrp.x,hop.coodrp.y,hop.coodrp.z, 150, 1,ENTITY.GET_ENTITY_MODEL( car), 262144, -1.0, -1.0)




Link to comment
Share on other sites

  • 1 month later...

Does anyone know how to get a plane spawned in the air (already at a high velocity) to retract its landing gear? I'd done it before somehow but now I cannot seem to get it to work. When I picked up planes with the gravity gun and tossed them a little, they would kind-of auto-recover, and they would ascend and put their landing gear away. Is there any way to check to see if the landing gear is deployed?

 

Using AI::TASK_PLANE_MISSION and AI::TASK_HELI_MISSION natives on spawned planes makes them behave much more naturally if you later command them to do something else. The Harrier (Hydra), for example, will hover-fly in its distinct way after you use TASK_PLANE_MISSION.

Edited by whorse
Link to comment
Share on other sites

fwiskalicious

Does anyone know how to get a plane spawned in the air (already at a high velocity) to retract its landing gear? I'd done it before somehow but now I cannot seem to get it to work. When I picked up planes with the gravity gun and tossed them a little, they would kind-of auto-recover, and they would ascend and put their landing gear away. Is there any way to check to see if the landing gear is deployed?

 

Using AI::TASK_PLANE_MISSION and AI::TASK_HELI_MISSION natives on spawned planes makes them behave much more naturally if you later command them to do something else. The Harrier (Hydra), for example, will hover-fly in its distinct way after you use TASK_PLANE_MISSION.

 

These work for me:

VEHICLE::_SET_VEHICLE_LANDING_GEAR(Vehicle vehicle, int state)

and

VEHICLE::_GET_VEHICLE_LANDING_GEAR(Vehicle vehicle)

 

Landing gear states:

0: Deployed

1: Closing

2: Opening

3: Retracted

 

You could try ENTITY::APPLY_FORCE_TO_ENTITY(Entity entity, int forceType, float x, float y, float z, float xRot, float yRot, float zRot, BOOL p8, BOOL isRel, BOOL ignoreUpVec, BOOL p11, BOOL p12, BOOL p13) to make the plane go forward(You'll have to look elsewhere for parameters relating to this native.)

Edited by blah265
Link to comment
Share on other sites

 

Does anyone know how to get a plane spawned in the air (already at a high velocity) to retract its landing gear? I'd done it before somehow but now I cannot seem to get it to work. When I picked up planes with the gravity gun and tossed them a little, they would kind-of auto-recover, and they would ascend and put their landing gear away. Is there any way to check to see if the landing gear is deployed?

 

Using AI::TASK_PLANE_MISSION and AI::TASK_HELI_MISSION natives on spawned planes makes them behave much more naturally if you later command them to do something else. The Harrier (Hydra), for example, will hover-fly in its distinct way after you use TASK_PLANE_MISSION.

 

These work for me:

VEHICLE::_SET_VEHICLE_LANDING_GEAR(Vehicle vehicle, int state)

and

VEHICLE::_GET_VEHICLE_LANDING_GEAR(Vehicle vehicle)

 

Landing gear states:

0: Deployed

1: Closing

2: Opening

3: Retracted

 

You could try ENTITY::APPLY_FORCE_TO_ENTITY(Entity entity, int forceType, float x, float y, float z, float xRot, float yRot, float zRot, BOOL p8, BOOL isRel, BOOL ignoreUpVec, BOOL p11, BOOL p12, BOOL p13) to make the plane go forward(You'll have to look elsewhere for parameters relating to this native.)

 

thanks so much! Those natives must have just been named recently, because there is nothing about landing gear in my natives.h file (so I just used it as "VEHICLE::_0xCFC8BE9A5E1FE575()" in my code).

 

Sorry to ask more, but do you or does anyone here know how to get a vehicle that is not usually armed to shoot missiles? I've seen mods as old as Angry Planes do it, with biplanes launching missiles out of each wingtip, but I cant seem to find much info about it online.

I've tried using these commands (below) and they work sufficiently for all vehicles that already have the hashed weapons, but planes/helis that don't have those exact weapons wont use them:

WEAPON::SET_CURRENT_PED_VEHICLE_WEAPON(pilot,GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLANE_ROCKET")); VEHICLE::SET_VEHICLE_SHOOT_AT_TARGET(pilot, target, targPos.x, targPos.y, targPos.z);
Link to comment
Share on other sites

fwiskalicious

thanks so much! Those natives must have just been named recently, because there is nothing about landing gear in my natives.h file (so I just used it as "VEHICLE::_0xCFC8BE9A5E1FE575()" in my code).

 

Sorry to ask more, but do you or does anyone here know how to get a vehicle that is not usually armed to shoot missiles? I've seen mods as old as Angry Planes do it, with biplanes launching missiles out of each wingtip, but I cant seem to find much info about it online.

I've tried using these commands (below) and they work sufficiently for all vehicles that already have the hashed weapons, but planes/helis that don't have those exact weapons wont use them:

WEAPON::SET_CURRENT_PED_VEHICLE_WEAPON(pilot,GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLANE_ROCKET"));
VEHICLE::SET_VEHICLE_SHOOT_AT_TARGET(pilot, target, targPos.x, targPos.y, targPos.z);

 

 

I'm not exactly sure if this will work, since I've never tried it, but you can try finding the vehicle's coords, then use that with GAMEPLAY::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(float x1, float y1, float z1, float x2, float y2, float z2, int damage, BOOL p7, Hash weaponHash, Ped ownerPed, BOOL isAudible, BOOL p11, float speed).

 

You can play around with the values.

I have not tried this, it is a suggestion, that might work.

Here is an example of the SHOOT_SINGLE_BULLET_BETWEEN_COORDS native used to fire five airstrike rockets in front of the player:

if (callairstrike){		Vector3 coords = GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER_PED_ID(), 0.0, 10.0, 0.0);		SHOOT_SINGLE_BULLET_BETWEEN_COORDS(coords.x + 2, coords.y + 2, coords.z + 100, coords.x, coords.y, coords.z, 200, 1, GET_HASH_KEY("WEAPON_AIRSTRIKE_ROCKET"), -1, 1, 0, 3.21283686E+09f);		WAIT(250);		SHOOT_SINGLE_BULLET_BETWEEN_COORDS(coords.x - 2, coords.y - 2, coords.z + 100, coords.x, coords.y, coords.z, 200, 1, GET_HASH_KEY("WEAPON_AIRSTRIKE_ROCKET"), -1, 1, 0, 3.21283686E+09f);		WAIT(250);		SHOOT_SINGLE_BULLET_BETWEEN_COORDS(coords.x + 2, coords.y + 2, coords.z + 100, coords.x, coords.y, coords.z, 200, 1, GET_HASH_KEY("WEAPON_AIRSTRIKE_ROCKET"), -1, 1, 0, 3.21283686E+09f);		WAIT(250);		SHOOT_SINGLE_BULLET_BETWEEN_COORDS(coords.x - 2, coords.y - 2, coords.z + 100, coords.x, coords.y, coords.z, 200, 1, GET_HASH_KEY("WEAPON_AIRSTRIKE_ROCKET"), -1, 1, 0, 3.21283686E+09f);		WAIT(250);		SHOOT_SINGLE_BULLET_BETWEEN_COORDS(coords.x + 2, coords.y + 2, coords.z + 100, coords.x, coords.y, coords.z, 200, 1, GET_HASH_KEY("WEAPON_AIRSTRIKE_ROCKET"), -1, 1, 0, 3.21283686E+09f);		}

Note: -1 is airstrike owner

3.21283686E+09f is the speed, not sure why I went with that.

You'll have to add namespaces(GAMEPLAY:: etc)

 

Link to comment
Share on other sites

  • 4 weeks later...
  • 6 years later...

Hate to resurrect an old topic from the grave, but ghat damn, there's not much research out there for these natives.  I'm playing around with it, and apparently there's a p13 argument from what I've seen around.  Anyone able to throw some additional findings on? I'm more than willing to be a ginnea pig, but as of rn, it all just seems all to unpredictable from the args I'm using atm.  :(

 

 

HELPZ PLEASEEE!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.