Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Graphicscore

[Q][.NET]AI Drive to Coords, Fly Helicopter to location and land on gr

Recommended Posts

Graphicscore

Hello there,

 

I want that a Ped drives/flys to given COORDS and lands on the ground.

 

I am currently using the following funciton to make the Ped flying to given coords.

void TASK_VEHICLE_DRIVE_TO_COORD(Ped pedHandle, Vehicle vehicleHandle, float x, float y, float z, float speed, Any p6, Hash vehicleModel, int drivingMode, float p9, float p10) // E2A2AA2F659D77A7 E4AC0387

The ped is actually flying to the given x y z , but the ped does not land on the the ground, is will hover mid air and wander around the point.

 

Do I have to call a fuction for landing the vehicle or do I just have to make sure that the landing area is not occupied ?

 

Regards

Share this post


Link to post
Share on other sites
qwerasdzxc

Hello there,

 

I want that a Ped drives/flys to given COORDS and lands on the ground.

 

I am currently using the following funciton to make the Ped flying to given coords.

void TASK_VEHICLE_DRIVE_TO_COORD(Ped pedHandle, Vehicle vehicleHandle, float x, float y, float z, float speed, Any p6, Hash vehicleModel, int drivingMode, float p9, float p10) // E2A2AA2F659D77A7 E4AC0387

The ped is actually flying to the given x y z , but the ped does not land on the the ground, is will hover mid air and wander around the point.

 

Do I have to call a fuction for landing the vehicle or do I just have to make sure that the landing area is not occupied ?

 

Regards

What do you put in Hash vehicleModel, I can't make it work because of that?

Share this post


Link to post
Share on other sites
Graphicscore

 

Hello there,

 

I want that a Ped drives/flys to given COORDS and lands on the ground.

 

I am currently using the following funciton to make the Ped flying to given coords.

void TASK_VEHICLE_DRIVE_TO_COORD(Ped pedHandle, Vehicle vehicleHandle, float x, float y, float z, float speed, Any p6, Hash vehicleModel, int drivingMode, float p9, float p10) // E2A2AA2F659D77A7 E4AC0387

The ped is actually flying to the given x y z , but the ped does not land on the the ground, is will hover mid air and wander around the point.

 

Do I have to call a fuction for landing the vehicle or do I just have to make sure that the landing area is not occupied ?

 

Regards

What do you put in Hash vehicleModel, I can't make it work because of that?

 

 

Its the model of the Valkyrie (Helicopter), and the Ped is driving with a Valkyrie

Share this post


Link to post
Share on other sites
c39687

 

Hello there,

 

I want that a Ped drives/flys to given COORDS and lands on the ground.

 

I am currently using the following funciton to make the Ped flying to given coords.

void TASK_VEHICLE_DRIVE_TO_COORD(Ped pedHandle, Vehicle vehicleHandle, float x, float y, float z, float speed, Any p6, Hash vehicleModel, int drivingMode, float p9, float p10) // E2A2AA2F659D77A7 E4AC0387

The ped is actually flying to the given x y z , but the ped does not land on the the ground, is will hover mid air and wander around the point.

 

Do I have to call a fuction for landing the vehicle or do I just have to make sure that the landing area is not occupied ?

 

Regards

What do you put in Hash vehicleModel, I can't make it work because of that?

 

Do...

Hash model = GAMEPLAY::GET_HASH_KEY("put_heli_name_here");

Share this post


Link to post
Share on other sites
qwerasdzxc

 

 

Hello there,

 

I want that a Ped drives/flys to given COORDS and lands on the ground.

 

I am currently using the following funciton to make the Ped flying to given coords.

void TASK_VEHICLE_DRIVE_TO_COORD(Ped pedHandle, Vehicle vehicleHandle, float x, float y, float z, float speed, Any p6, Hash vehicleModel, int drivingMode, float p9, float p10) // E2A2AA2F659D77A7 E4AC0387
The ped is actually flying to the given x y z , but the ped does not land on the the ground, is will hover mid air and wander around the point.

 

Do I have to call a fuction for landing the vehicle or do I just have to make sure that the landing area is not occupied ?

 

Regards

What do you put in Hash vehicleModel, I can't make it work because of that?

 

Do...
Hash model = GAMEPLAY::GET_HASH_KEY("put_heli_name_here");
Thanks!

Share this post


Link to post
Share on other sites
Graphicscore

 

 

 

Hello there,

 

I want that a Ped drives/flys to given COORDS and lands on the ground.

 

I am currently using the following funciton to make the Ped flying to given coords.

void TASK_VEHICLE_DRIVE_TO_COORD(Ped pedHandle, Vehicle vehicleHandle, float x, float y, float z, float speed, Any p6, Hash vehicleModel, int drivingMode, float p9, float p10) // E2A2AA2F659D77A7 E4AC0387
The ped is actually flying to the given x y z , but the ped does not land on the the ground, is will hover mid air and wander around the point.

 

Do I have to call a fuction for landing the vehicle or do I just have to make sure that the landing area is not occupied ?

 

Regards

What do you put in Hash vehicleModel, I can't make it work because of that?

 

Do...
Hash model = GAMEPLAY::GET_HASH_KEY("put_heli_name_here");
Thanks!

 

 

Actually, because I am using the .NET plugin, I tried to do :

Model valkyrie = new Model(VehicleHash.Valkyrie);Vehicle valkyrieVehicle = World.CreateVehicle(Hash VehicleHash, float xCoord, float yCoord, float zCoord, float Heading, BOOL networkHandle, BOOL vehiclehandle) Hash = valkyireVehicle.Model.hash;

But thanks for that, I am going to try your suggestion ! :)

Share this post


Link to post
Share on other sites
c39687

 

 

 

 

Hello there,

 

I want that a Ped drives/flys to given COORDS and lands on the ground.

 

I am currently using the following funciton to make the Ped flying to given coords.

void TASK_VEHICLE_DRIVE_TO_COORD(Ped pedHandle, Vehicle vehicleHandle, float x, float y, float z, float speed, Any p6, Hash vehicleModel, int drivingMode, float p9, float p10) // E2A2AA2F659D77A7 E4AC0387
The ped is actually flying to the given x y z , but the ped does not land on the the ground, is will hover mid air and wander around the point.

 

Do I have to call a fuction for landing the vehicle or do I just have to make sure that the landing area is not occupied ?

 

Regards

What do you put in Hash vehicleModel, I can't make it work because of that?

 

Do...
Hash model = GAMEPLAY::GET_HASH_KEY("put_heli_name_here");
Thanks!

 

 

Actually, because I am using the .NET plugin, I tried to do :

Model valkyrie = new Model(VehicleHash.Valkyrie);Vehicle valkyrieVehicle = World.CreateVehicle(Hash VehicleHash, float xCoord, float yCoord, float zCoord, float Heading, BOOL networkHandle, BOOL vehiclehandle) Hash = valkyireVehicle.Model.hash;

But thanks for that, I am going to try your suggestion ! :)

 

half of this code is .net and the other half is from the c++ header... :)

 

I was talking about the native for driving. Since the shdn has an enum with all the hashes, just use the value for the valykrie when you call the native for making the ped drive... VehicleHash.Valkyrie. For creating a vehicle in .Net, use the Model class instead since his method is setup to use the Handle from the Model.

Edited by c39687

Share this post


Link to post
Share on other sites
leftas

Are you using native which get position on ground ? Have you tried this TASK_HELI_MISSION ?

 

All the best,

Paul.

Edited by leftas

Share this post


Link to post
Share on other sites
Graphicscore

Are you using native which get position on ground ? Have you tried this TASK_HELI_MISSION ?

 

All the best,

Paul.

No I havent which params do I have to provide to the function ?

 

 

I still can't get the chopper landed, I tried the following params :

 Vehicle valkyrie; Model valkyrieModel = new Model(VehicleHash.Valkyrie); valkyrie = World.CreateVehicle(valkyrieModel, new GTA.Math.Vector3(2378.245F, 6618.386F, 2.459F));

--

Function.Call<bool>(Hash.TASK_VEHICLE_DRIVE_TO_COORD, new InputArgument[] { companion_3, valkyrie, 3547.671F, 3789.323F, 15.047F, 60F, 1, valkyrie.Model.hash, 1, 0xC00AB, -1 });
Function.Call<bool>(Hash.TASK_VEHICLE_DRIVE_TO_COORD, new InputArgument[] { companion_3, valkyrie, 3547.671F, 3789.323F, 15.047F, 60F, 1, VehicleHash.Valkyrie.ToString(), 1, 0xC00AB, -1 });

I can't directly pass a VehicleHash.Valkery because it's not a valid InputArgument,

Edited by Graphicscore

Share this post


Link to post
Share on other sites
leftas

You could be not so lazy, and at least would take decomplied scripts and look how are they used...

AI::TASK_HELI_MISSION(VEHICLE::GET_PED_IN_VEHICLE_SEAT(getElem(num5, A_1, 4), -1), getElem(num5, A_1, 4), num11, PLAYER::PLAYER_PED_ID(), rPtrOfs(_s, 0), rPtrOfs(_s, 4), rPtrOfs(_s, 8), 8, 100f, -1f, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()), 100, 50, 0xBF800000, 0);

First pedHandle, second vehicleHandle, Third seems to be ped, fourth you see, then cordinates, eighth type maybe, ninth speed, unknown, heading, maybe same as ninth, unknown, float, unknown.

 

Why you need that InputArgument anyway ? And it doesn't return bool...

 

All the best,

Paul.

Edited by leftas

Share this post


Link to post
Share on other sites
c39687

 

Are you using native which get position on ground ? Have you tried this TASK_HELI_MISSION ?

 

All the best,

Paul.

No I havent which params do I have to provide to the function ?

 

 

I still can't get the chopper landed, I tried the following params :

 Vehicle valkyrie; Model valkyrieModel = new Model(VehicleHash.Valkyrie); valkyrie = World.CreateVehicle(valkyrieModel, new GTA.Math.Vector3(2378.245F, 6618.386F, 2.459F));

--

Function.Call<bool>(Hash.TASK_VEHICLE_DRIVE_TO_COORD, new InputArgument[] { companion_3, valkyrie, 3547.671F, 3789.323F, 15.047F, 60F, 1, valkyrie.Model.hash, 1, 0xC00AB, -1 });
Function.Call<bool>(Hash.TASK_VEHICLE_DRIVE_TO_COORD, new InputArgument[] { companion_3, valkyrie, 3547.671F, 3789.323F, 15.047F, 60F, 1, VehicleHash.Valkyrie.ToString(), 1, 0xC00AB, -1 });

I can't directly pass a VehicleHash.Valkery because it's not a valid InputArgument,

 

you have to probably cast to uint... (uint)VehicleHash.Valkery, the InputArgument class might only be able to interpret the underlying type

Share this post


Link to post
Share on other sites
Graphicscore

You could be not so lazy, and at least would take decomplied scripts and look how are they used...

AI::TASK_HELI_MISSION(VEHICLE::GET_PED_IN_VEHICLE_SEAT(getElem(num5, A_1, 4), -1), getElem(num5, A_1, 4), num11, PLAYER::PLAYER_PED_ID(), rPtrOfs(_s, 0), rPtrOfs(_s, 4), rPtrOfs(_s, 8), 8, 100f, -1f, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()), 100, 50, 0xBF800000, 0);

First pedHandle, second vehicleHandle, Third seems to be ped, fourth you see, then cordinates, eighth type maybe, ninth speed, unknown, heading, maybe same as ninth, unknown, float, unknown.

 

Why you need that InputArgument anyway ? And it doesn't return bool...

 

All the best,

Paul.

 

 

I tried :

Function.Call(Hash.TASK_HELI_MISSION, companion_3.Handle, valkyrie.Handle, companion_3, player.Handle, 3547.671F, 3789.323F, 15.047F, 8, 100f, -1f, player.Heading, 100, 50, 0xBF800000, 0);

no effect. Any ideas ?

Share this post


Link to post
Share on other sites
leftas

I suppose this native is for following other ped... third is vehicle handle and fourth is chased ped handle. Try to set them as 0. As it accepts the 0 handles as well. http://pastebin.com/TAgNEZLL

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
Graphicscore

It still doesn't seem to work.

 

Did anyone had archive something where the chopper actually goes all the way down to the ground ?

 

Basically I want to land a chopper with peds, near the Humane Labs Building.

 

I also tried some alternative ways to get down.....

 

I tried :

void TASK_RAPPEL_FROM_HELI(Ped ped, float p1) // 09693B0312F91649 2C7ADB93

But if I use it on the player, the player just ejects out of the valkyrie, If I use it one a ped, inside the valkyrie my game crashes.

 

Ideas ? Anyone ?

Edited by Graphicscore

Share this post


Link to post
Share on other sites
Fireboyd78

Try using AI::TASK_PLANE_LAND. You'll have to figure out the parameters, however. The decompiled scripts come in handy for figuring out stuff like this.

Share this post


Link to post
Share on other sites
Cyron43

The following is a workaround I implemented for a GTA IV mod already but it works also in GTA V. In a nutshell this code teleports the helicopter in tiny steps from the current position to the landing position. This happens so fast and tiny that it looks like a straight movement.

/// <summary>   ///    Implementierung eines eigenen Algorithmus für die Landung eines Hubschraubers.   /// </summary>   internal class HelicopterHandling   {      private const float INTERVAL_DISTANCE = 0.1f;      /// <summary>      ///    3. Berechne die Positionen entlang der Linie zum Landepunkt.      /// </summary>      /// <param name="initialApproachPosition"></param>      /// <param name="landingPosition"></param>      /// <returns>Liste mit Vektoren entlang der Landelinie.</returns>      internal List<Vector3> PositionsDownToLanding(Vector3 initialApproachPosition, Vector3 landingPosition)      {         var intervals = CalculateAmountOfIntervals(CalculateGreatestDistance(initialApproachPosition, landingPosition));         var xIntervalDistance = Math.Abs(initialApproachPosition.X - landingPosition.X) / intervals;         var yIntervalDistance = Math.Abs(initialApproachPosition.Y - landingPosition.Y) / intervals;         var zIntervalDistance = Math.Abs(initialApproachPosition.Z - landingPosition.Z) / intervals;         var xArray = new float[intervals];         var yArray = new float[intervals];         var zArray = new float[intervals];         float currentValue;         if(initialApproachPosition.X > landingPosition.X)         {            currentValue = initialApproachPosition.X;            for(var i = 0; i < intervals; i++)            {               xArray[i] = currentValue -= xIntervalDistance;            }         }         if(initialApproachPosition.X < landingPosition.X)         {            currentValue = initialApproachPosition.X;            for(var i = 0; i < intervals; i++)            {               xArray[i] = currentValue += xIntervalDistance;            }         }         if(initialApproachPosition.Y > landingPosition.Y)         {            currentValue = initialApproachPosition.Y;            for(var i = 0; i < intervals; i++)            {               yArray[i] = currentValue -= yIntervalDistance;            }         }         if(initialApproachPosition.Y < landingPosition.Y)         {            currentValue = initialApproachPosition.Y;            for(var i = 0; i < intervals; i++)            {               yArray[i] = currentValue += yIntervalDistance;            }         }         if(initialApproachPosition.Z > landingPosition.Z)         {            currentValue = initialApproachPosition.Z;            for(var i = 0; i < intervals; i++)            {               zArray[i] = currentValue -= zIntervalDistance;            }         }         if(initialApproachPosition.Z < landingPosition.Z)         {            currentValue = initialApproachPosition.Z;            for(var i = 0; i < intervals; i++)            {               zArray[i] = currentValue += zIntervalDistance;            }         }         var vectorList = new List<Vector3>();         for(var i = 0; i < intervals; i++)         {            vectorList.Add(new Vector3(xArray[i], yArray[i], zArray[i]));         }         return vectorList;      }      /// <summary>      ///    2. Damit nicht auffällt, dass der Heli von einer Position zur      ///    nächsten teleportiert, darf der Abstand einen bestimmten Wert      ///    nicht übersteigen, damit das Auge getäuscht wird. Hier für den      ///    Test nehme ich 0.5 Einheiten. Grundlage ist der größte Abstand.      ///    Bei den beiden anderen Distanzen fällt der Interval-Abstand      ///    entsprechend kleiner aus.      /// </summary>      private static int CalculateAmountOfIntervals(float greatestDistance)      {         return (int) (greatestDistance / INTERVAL_DISTANCE);      }      /// <summary>      ///    1. Herausbekommen, welcher Abstand am größten ist.      /// </summary>      private static float CalculateGreatestDistance(Vector3 currentPosition, Vector3 landingPosition)      {         var xLength = Math.Abs(currentPosition.X - landingPosition.X);         var yLength = Math.Abs(currentPosition.Y - landingPosition.Y);         var zLength = Math.Abs(currentPosition.Z - landingPosition.Z);         var list = new List<float> {xLength, yLength, zLength};         return list.Max();      }   }

Here is how to use it:

      private void LandHelicopter()      {         if(CurrentVehicle == null)            return;         CurrentVehicle.FreezePosition = false;                  if(CurrentVehicle.Position.DistanceTo2D(_drivingData.StaticTarget) > 20)         {            UI.ShowSubtitle("Horizontal distance to landing spot too big."                            + " Please fly nearer to the landing spot and try again.", 3000);            return;         }                  UI.ShowSubtitle("Landing Helicopter. Please wait...", 3000);                  var vectorList = new HelicopterHandling()            .PositionsDownToLanding(CurrentVehicle.Position, _drivingData.StaticTarget);         foreach(var vector in vectorList)         {            CurrentVehicle.Position = vector;            if(CurrentVehicle.IsOnAllWheels)            {               break;            }            Wait(10);         }         CurrentVehicle.PlaceOnGround();               }

I hope this helps.

Edited by Cyron43

Share this post


Link to post
Share on other sites
c39687

nice code but the only problem is if other entities get in the way, they will get deleted (at least that is how it worked in IV). Better than nothing :)

 

If you can get that to work with applying force then we are talking :D

Edited by c39687

Share this post


Link to post
Share on other sites
Graphicscore

@Cyron43, I'll try that if I'm home :)

Share this post


Link to post
Share on other sites
Cyron43

Note: Vector3.DistanceTo2D doesn't yet exist in the .net script hook. You can either do that:

var currentPosition2D = new Vector3(currentPosition.X, currentPosition.Y, 0);var targetPosition2D = new Vector3(targetPosition.X, targetPosition.Y, 0);if(World.DistanceTo(currentPosition2D, targetPosition2D) > 20){   //...}

or write an extension method like I did.

 

@c39687: As I said it's a workaround. I know it has it's flaws. For instance you have to watch out there is no obstacle in that line down to the target position and once this landing procedure is triggered it can't be cancelled. It would need to run in it's own thread but alas that's not possible (at least it wasn't possible with the GTA IV .net script hook). Anyway it's better than nothing and the helicopter will end exactly at the target. I have used this countless times in ELFC.

 

@Graphicscore: Thanks, let me know how it worked out for you. :)

Edited by Cyron43

Share this post


Link to post
Share on other sites
c39687

 

@c39687: As I said it's a workaround. I know it has it's flaws. For instance you have to watch out there is no obstacle in that line down to the target position and once this landing procedure is triggered it can't be cancelled. It would need to run in it's own thread but alas that's not possible (at least it wasn't possible with the GTA IV .net script hook). Anyway it's better than nothing and the helicopter will end exactly at the target. I have used this countless times in ELFC.

 

i said it was nice code, I made a remote contorl helimod in IV a long ass time ago (my code is almost identical which surprised me when I saw this lol) so I know how your code works. No need to be defensive. And btw you can run your heli landing with other code, you just can't isolate it in its own method.

 

Or just add another class to inherit Script for this ;)

Edited by c39687

Share this post


Link to post
Share on other sites
Cyron43

Great idea! Thanks. :)

Share this post


Link to post
Share on other sites
c39687

Great idea! Thanks. :)

no problem, i think it is the best solution. I want to play with applying force to the same logic. I can kinda picture how to do it but Im not sure the heli would be stable.

 

The idea would be to apply force to always push the heli toward its center (like how a gravity gun would work) and then your code moves the center... if that makes sense, give it a try or I will test it out one day. Good luck.

Edited by c39687

Share this post


Link to post
Share on other sites
Cyron43

@c39687: Ugh I'm currently polishing some migrations from EFLC and that's a pita at times as the .net script hook is still in it's infant state and some natives are not even discovered or fully researched yet. Don't get me wrong, that's nothing against the hook. Idk have you read my posts in the .net scripthook thread about not being able to retrieve dead peds? That's just one example. Another is the driving style. That gives me a pain in the neck. So currently the landing functionality has low priority for me.

Edited by Cyron43

Share this post


Link to post
Share on other sites
c39687

@c39687: Ugh I'm currently polishing some migrations from EFLC and that's a pita at times as the .net script hook is still in it's infant state and some natives are not even discovered. Don't get me wrong, that's nothing against the hook. Idk have you read my posts in the .net scripthook thread about not being able to retrieve dead peds? That's just one example.

well the old scripthookdotnet, directly accessed the Ped Pool... it wasn't done via native, so you could always get every ped, dead and alive... here is the IV method (reflection from ILSpy)

 

this code would return a list of valid ped handles

public unsafe static int[] GetListOfHandlesInPool(int PoolAddress){    List<int> list = new List<int>();    int num = *(PoolAddress + 4);    int num2 = *(PoolAddress + 8);    int num3 = 0;    if (0 < num2)    {        do        {            int num4 = (int)(*(num3 + num));            if ((num4 & 128) == 0)            {                list.Add(num3 << 8 | num4);            }            num3++;        }        while (num3 < num2);    }    return list.ToArray();}

you just need to find the address of the ped pool, i imagine this has been documented somewhere already

Edited by c39687

Share this post


Link to post
Share on other sites
Cyron43

What the...?! Dude! That's awesome! Thanks mate! :)

I hope this makes it into the .net scripthook V.

Edited by Cyron43

Share this post


Link to post
Share on other sites
c39687

no problem, i havent researched any of it but if you make progress with that to get all ped handles, let us know ;)

Share this post


Link to post
Share on other sites
Cyron43

No luck yet with finding the ped pool address. I'm just saying so you know I'm still at it.

Share this post


Link to post
Share on other sites
Graphicscore

@Cyron43, I've tested your code, it works, it's not looking great but it seems to work. The only problem is that the chopper "lands" and then directly takes off again, and lands again, after the second landing it stays on the ground. I use your code in combination with the drive to task.

Share this post


Link to post
Share on other sites
Cyron43

@Cyron43, I've tested your code, it works, it's not looking great but it seems to work. The only problem is that the chopper "lands" and then directly takes off again, and lands again, after the second landing it stays on the ground. I use your code in combination with the drive to task.

Hehe, I know about that jumping. My original code has this at the end of the method (but I removed it from the post):

if(_drivingData.Driver != Game.Player.Character)            CurrentVehicle.FreezePosition = true;// The driver leaves the vehicle through the event driven StopIfTargetReached method.

Does it also jump if the player character had the task? Anyway you could try (right after the touch down)

CurrentVehicle.FreezePosition = true;CurrentVehicle.EngineRunning = false;Wait(1000); //or some value you see more fit.CurrentVehicle.FreezePosition = false;
Edited by Cyron43

Share this post


Link to post
Share on other sites
c39687

@Cyron43, I've tested your code, it works, it's not looking great but it seems to work. The only problem is that the chopper "lands" and then directly takes off again, and lands again, after the second landing it stays on the ground. I use your code in combination with the drive to task.

maybe clearing the drivers tasks after he lands... or possibly making him a mission character can change this unwanted behavior, not sure though. I know in IV you could clear all ped tasks.

Edited by c39687

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.