Hello everyone!
Still working on my project and coming across a bit of a challenge.
I’m leveraging one of the ped driving natives (taskplanemission) and it seems that whenever the ped gets either really far away from the map, or close to the ground, they try to avoid hitting the ground by pulling up, OR they try to turn around to head back in the general direction of the map.
My goal is:
Well, as bad as this sounds, I need the ped to sacrifice theirselves for me…
What I mean by that is - For my purposes, I need the ped to prioritize my direction rather than his own survival. For example, if I wanted my ped to Kamikaze into the ground, it just doesn’t seem possible with taskplanemission, and I think it’s due to the “survival-nature” of the ped.
What i’ve tried:
I’ve tried using SePedConfigFlag, but the documentation seems a bit scattered.
The ask:
I guess what I’m trying to ask is:
Is there any resourcing on the pedestrian itself to see if there’s a way to get him to ignore their own need to survive?
Alternatively, are there any other natives I can use to monitor ped behavior (e.g. when ped is doing this, this is because of THAT behavior).
Any help is eternally and permanently appreciated!
Thanks and happy developing out there! 
you can probably use one of these natives when the vehicle is low enough in altitude:
SetVehicleOutOfControl
DisableIndividualPlanePropeller
SetPlanePropellersHealth
SetVehicleOutOfControl
also provides an explodeOnImpact parameter, which should do exactly what you want
1 Like
This is pretty good, but the challenge is that I’d like the pilot to be able to fly low enough to perform dangerous maneuvers regardless of how close to the ground he is…
Breaking the plane is good but I was hoping for something a bit more specific…
okay! Still researching, but I’ve made some progress…after testing this with various flags from both TaskPlaneMission
AAND TaskDriveToCoord(Longrange)
it looks like nothing changed. No matter the flag (with some exception), the pilot was still unable to crash into the side of a mountain or a building…but I more or less, remembered where they tended to pull up (to avoid their utter demise).
After opening codewalker, I decided to take a look at different views, and what do you know it…it looks like these things called “navmeshes” are what’s causing the peds to fly away from the buildings, mountains, satellite dishes, and everything else!
Interesting, but not the finishline yet.
I was wondering:
- Do you know anything about navmeshes to help me understand them a bit more? (or resources on them)
- How can I get my AI pilot to ignore them when navigating
- If possible via a file, do you think it’d be possible to programmatically load in an “empty navmesh file?”
I love the resources!
I’ll test this after work!
Thanks!
Hmm I tried that but unfortunately, it didn’t give me anything interesting…
I also tried looking at the decompiled scripts here but couldn’t find anything too crazy.
Although side note I did see “disablenavmesh in area” which looked to be potentially useful. I thought it took two sets of xyz coords to form a box, but my ped is still blindly avoiding the buildings…stupid life preservation.
(Will come back to it later)
Hey, maybe there’s a way for me to disable it as a file…
I’ll see what I can find!
Okay, it’s starting to look a lot more assuring that this is navmesh related;
Although I’m kinda at a standstill…
Check this out:
TaskVehicleGotoNavmesh
link
Using this, Im able to get the plane to fly into mountains, but at one cost…it looks like this is specific to cars as I’m unable to get the vehicle to go up or down, left or right…
The plane DOES ignore his inner need to swerve away from buildings or the ground or anything (which is perfect), I just can’t control him…
Any silent watchers have thoughts?
Currently testing with TaskGoToCoordAnyMeansExtraParamsWithCruiseSpeed
One thing I learned is that the first param after speed (P5) is either:
“cut engines” or “use vehicle” - I’ll make a pull req to gith…
But sadly still avoiding navmeshes…
I also tried:
TaskVehicleAimAtCoord
and
TaskGoToCoordAnyMeansExtraParamsWithCruiseSpeed
and
TaskVehicleMission
and
TaskVehicleMissionCoorsTarget
But no dice soo far…
Fuuuck! I may have found it!
So take a look at this:
TaskPlaneMission(vnptab[i][2], vnptab[i][1], nil, nil, x, y, z, missionflag, angulardrag, unknownflag, heading, 0, -10000)
It seems that when the plane is diving or climbing, the above value (when negative) seems to change the ped behavior in which he doesn’t (really) care about crashing into stuff!
AWESOME!
But there’s a problem - It tends to make the ped want to dive…
so that means it’s a challenge getting the ped to fly straight as this value conflicts with the z
value above…
Will continue testing…
Lookie here what I found:
Looks like with the help of an undocumented native, I was able to disable my vehicle’s collision height avoidance…
Simply feed it your vehicle and whether or not it should avoid obstacles.
(Does NOT need to be called every frame…)
1 Like
How did you even get that native to do anything? I cant seem to get it to do anything at all, even in cars
Good question: For me, I had to use:
Citizen.InvokeNative(native, allarguments)
However, thanks to the bright staff here at fiveM, they’ve turned that into a native called:
_ENABLE_AIRCRAFT_OBSTACLE_AVOIDANCE
Make sure you’re calling it on the VEHICLE and NOT the ped, or it won’t work.
Also, as a best practice, I’d recommend calling it on your vehicle BEFORE you start trying to control it just to be safe…
If you’re facing issues after re-attempting, post your code snippet de-contextualizing anything that’s missing from your code, or abstract (aka create a simple to understand example that mirrors the functionality of your code).
And of course, please be sure to explain what your expectations are, and where you’re getting stuck! We’re not mind readers 
Good luck!