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. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    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 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 Mods
    10. GTA Vice City

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

      1. Guides & Strategies
      2. Help & Support
      3. GTA 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

Sign in to follow this  
NoNameSet

How to make a ped fly a heli?

Recommended Posts

NoNameSet

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.

Share this post


Link to post
Share on other sites
Kolopsel

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.

Share this post


Link to post
Share on other sites
NoNameSet

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

Share this post


Link to post
Share on other sites
sollaholla

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

Share this post


Link to post
Share on other sites
NoNameSet

 

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)

Share this post


Link to post
Share on other sites
elsewhat

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);

Share this post


Link to post
Share on other sites
sollaholla

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

Share this post


Link to post
Share on other sites
NoNameSet

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

Share this post


Link to post
Share on other sites
NoNameSet

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();        }

Share this post


Link to post
Share on other sites
sollaholla

 

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

Share this post


Link to post
Share on other sites
NoNameSet

@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

Share this post


Link to post
Share on other sites
NoNameSet

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);

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.

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.

Sign in to follow this  

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