Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Support

    3. Suggestions

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

How to make a ped fly a heli?


NoNameSet
 Share

Recommended Posts

I am looking for someone who can explain me how to make a ped fly a helicopter properly (go to custom places...stop in mid air)

also when I try to spawn a heli further than 300ish meters away from the player is self destructs, if I give it invincibility/infinite health, its unvisible...

btw am using RagePluginHook as a reference.

thanks.

Link to comment
Share on other sites

So, you could do

myHelicopter.IsPersistent = true; // Im pretty sure, that its nearly the same in RagePluginHook

in C#, this would probably stop the Helicopter from exploding. But the other things i would like to know myself.

Link to comment
Share on other sites

So, you could do

myHelicopter.IsPersistent = true; // Im pretty sure, that its nearly the same in RagePluginHook

in C#, this would probably stop the Helicopter from exploding. But the other things i would like to know myself.

 

//

yeah, my problem with the heli crashing is when im to far away from it, it crashes...if I go there right away(start the callout) it wont crash but will do stuff as you want, after that it works? foking weird af I know.

Edited by NoNameSet
Link to comment
Share on other sites

yeah, my problem with the heli crashing is when im to far away from it, it crashes...if I go there right away(start the callout) it wont crash but will do stuff as you want, after that it works? foking weird af I know.

 

Well, Idk about your explosion problem, you might wanna show your code if you want help with that.

 

I've updated the AI:: TASK_HELI_MISSION native: http://www.dev-c.com/nativedb/func/info/dad029e187a2beb4

Function.Call(Hash.TASK_HELI_MISSION, driver, heli, 0, 0, position.X, position.Y, position.Z, 4, 50.0, 10.0, (position - heli.Position).ToHeading(), -1, -1, -1, 32);
Edited by sollaholla
Link to comment
Share on other sites

 

yeah, my problem with the heli crashing is when im to far away from it, it crashes...if I go there right away(start the callout) it wont crash but will do stuff as you want, after that it works? foking weird af I know.

 

Well, Idk about your explosion problem, you might wanna show your code if you want help with that.

 

I've updated the AI:: TASK_HELI_MISSION native: http://www.dev-c.com/nativedb/func/info/dad029e187a2beb4

Function.Call(Hash.TASK_HELI_MISSION, driver, heli, 0, 0, position.X, position.Y, position.Z, 4, 50.0, 10.0, (position - heli.Position).ToHeading(), -1, -1, -1, 32);

 

thanks. if the heli is still weirdly exploding at the start of the callout i'll post the code here.

 

btw is there something i can do like:

 

if (Game.LocalPlayer.Character.IsInAnyVehicle)

{

while (true)

{

Ped.Tasks.DriveToPosition(...)

}

}

// tried something like this but doesn't seem to work...any ideas? (helpful if code would be RagePluginHook related)

Link to comment
Share on other sites

I'm using this to fly heli to a certain location in Scene director mod

AI::TASK_VEHICLE_DRIVE_TO_COORD(pedDriver, pedVehicle, m_location.x, m_location.y, m_location.z, m_speedInVehicle, 1, ENTITY::GET_ENTITY_MODEL(pedVehicle), 1, -1.0, -1);
Link to comment
Share on other sites

thanks. if the heli is still weirdly exploding at the start of the callout i'll post the code here.

btw is there something i can do like:

 

if (Game.LocalPlayer.Character.IsInAnyVehicle)

{

while (true)

{

Ped.Tasks.DriveToPosition(...)

}

}

 

Well, I'm sure you know, but that code would crash your game. Although you don't need to call this kind of thing every frame, a task will run constantly (until stopped) if called once. If you want the ped to drive to an entity, then use _TASK_VEHICLE_FOLLOW instead.

Edited by sollaholla
Link to comment
Share on other sites

@sollaholla I am trying to use the TASK_HELI_MISSION Native but for some reason it doesn't work..what I used:

 

NativeFunction.CallByName<uint>("TASK_HELI_MISSION", Pilot, Helicopter, 103.724449f, -1908.7843f, 25.3152027f, 4, 30, 15, 49.26533f, -1, -1, -1, 0)

 

please tell me if I used some unknown values wrong or somethign else,

Regs.

Link to comment
Share on other sites

and also could you take a look at my code, for some reason this doesn't work:

if (Game.LocalPlayer.Character.IsInVehicle(DetectiveCar, true))                {                    Detective.Tasks.LeaveVehicle(DetectiveCar, LeaveVehicleFlags.None);                }

full code w/ IsInVehicle function not working:

public override void Process()        {            if (!IsTask1Finished && Game.LocalPlayer.Character.DistanceTo(DetectiveCar) < 8f)            {                Game.DisplayHelp("Press ~b~F~w~ to enter the ~b~Detective's~w~ vehicle", 5000);                while (!Game.IsKeyDown(System.Windows.Forms.Keys.F))                    GameFiber.Yield();                Game.LocalPlayer.Character.Tasks.Clear();                Game.LocalPlayer.Character.Tasks.EnterVehicle(DetectiveCar, 5000, 1, 10, EnterVehicleFlags.None);                IsTask1Finished = true;                if (Game.LocalPlayer.Character.IsInVehicle(DetectiveCar, true))                {                    Detective.Tasks.LeaveVehicle(DetectiveCar, LeaveVehicleFlags.None);                }            }            base.Process();        }
Link to comment
Share on other sites

 

and also could you take a look at my code, for some reason this doesn't work:

if (Game.LocalPlayer.Character.IsInVehicle(DetectiveCar, true))                {                    Detective.Tasks.LeaveVehicle(DetectiveCar, LeaveVehicleFlags.None);                }

full code w/ IsInVehicle function not working:

public override void Process()        {            if (!IsTask1Finished && Game.LocalPlayer.Character.DistanceTo(DetectiveCar) < 8f)            {                Game.DisplayHelp("Press ~b~F~w~ to enter the ~b~Detective's~w~ vehicle", 5000);                while (!Game.IsKeyDown(System.Windows.Forms.Keys.F))                    GameFiber.Yield();                Game.LocalPlayer.Character.Tasks.Clear();                Game.LocalPlayer.Character.Tasks.EnterVehicle(DetectiveCar, 5000, 1, 10, EnterVehicleFlags.None);                IsTask1Finished = true;                if (Game.LocalPlayer.Character.IsInVehicle(DetectiveCar, true))                {                    Detective.Tasks.LeaveVehicle(DetectiveCar, LeaveVehicleFlags.None);                }            }            base.Process();        }

Your not waiting for the player to enter the vehicle before checking:

if (Game.LocalPlayer.Character.IsInVehicle(DetectiveCar, true)){     Detective.Tasks.LeaveVehicle(DetectiveCar, LeaveVehicleFlags.None);}

so it never gets a chance to return true.

 

Try moving it out of the if statement...

if (!IsTask1Finished && Game.LocalPlayer.Character.DistanceTo(DetectiveCar) < 8f)

and into an if statement that says this:

if (IsTaskFinished && Game.LocalPlayer.Character.IsInVehicle(DetectiveCar, true) && Detective.IsInVehicle(DetectiveCar, true)){    Detective.Tasks.LeaveVehicle(DetectiveCar, LeaveVehicleFlags.None);}
Edited by sollaholla
Link to comment
Share on other sites

@sollaholla , that didn't work. what did work is this:

if (!IsTask1Done && Game.LocalPlayer.Character.Position.DistanceTo(DetectiveCar)<= 10)            {                Game.DisplayHelp("Press ~b~F~w~ to enter the ~b~detective's~w~ vehicle");                while (!Game.IsKeyDown(System.Windows.Forms.Keys.F))                    GameFiber.Yield();                Game.LocalPlayer.Character.Tasks.Clear();                Game.LocalPlayer.Character.Tasks.EnterVehicle(DetectiveCar, 2);                IsTask1Done = true;            }            if (IsTask1Done == true && !IsTask2Done)            {                Detective.Tasks.Clear();                Detective.Tasks.DriveToPosition(EndDrivePoint, 20, VehicleDrivingFlags.Normal);                IsTask2Done = true;            }
Edited by NoNameSet
Link to comment
Share on other sites

also please tell me how to use TASK_HELI_MISSION with these coords, for some reason I can get it to work:

<Position>
<X>-913.2695</X>
<Y>-378.5633</Y>
<Z>137.905716</Z>
</Position>
<Heading>161.713531</Heading>


I use:

NativeFunction.CallByName<uint>("TASK_HELI_MISSION", Pilot, Helicopter, 0, 0, -913.2695f, -378.5633f, 137.905716f, 4, 25, 10, 161.713531f, -1, -1, -1, 32);
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
 Share

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