NoNameSet Posted August 15, 2017 Share Posted August 15, 2017 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 More sharing options...
Kolopsel Posted August 16, 2017 Share Posted August 16, 2017 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. NoNameSet 1 Link to comment Share on other sites More sharing options...
NoNameSet Posted August 16, 2017 Author Share Posted August 16, 2017 (edited) 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 August 16, 2017 by NoNameSet Link to comment Share on other sites More sharing options...
sollaholla Posted August 16, 2017 Share Posted August 16, 2017 (edited) 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 August 16, 2017 by sollaholla Link to comment Share on other sites More sharing options...
NoNameSet Posted August 17, 2017 Author Share Posted August 17, 2017 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 More sharing options...
elsewhat Posted August 17, 2017 Share Posted August 17, 2017 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); sollaholla 1 Link to comment Share on other sites More sharing options...
sollaholla Posted August 18, 2017 Share Posted August 18, 2017 (edited) 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 August 18, 2017 by sollaholla Link to comment Share on other sites More sharing options...
NoNameSet Posted August 19, 2017 Author Share Posted August 19, 2017 @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 More sharing options...
NoNameSet Posted August 19, 2017 Author Share Posted August 19, 2017 btw this is the problem I am having with the heli exploding when to far away: http://gtaforums.com/topic/828016-vehicles-exploding-when-spawning-far-away/?hl=helicopter Link to comment Share on other sites More sharing options...
NoNameSet Posted August 19, 2017 Author Share Posted August 19, 2017 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 More sharing options...
sollaholla Posted August 20, 2017 Share Posted August 20, 2017 (edited) 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 August 20, 2017 by sollaholla NoNameSet 1 Link to comment Share on other sites More sharing options...
NoNameSet Posted August 21, 2017 Author Share Posted August 21, 2017 (edited) @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 August 21, 2017 by NoNameSet sollaholla 1 Link to comment Share on other sites More sharing options...
NoNameSet Posted August 21, 2017 Author Share Posted August 21, 2017 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now