Log in to reply

[Q] [C#] Better Flight AI?

  • I've been studying the TASK_PLANE_MISSION native, but it really sucks. Anyone know a better way to have a ped attack you from a plane? Thanks.

  • @sollaholla Maybe @Cyron43 knows?

  • @sollaholla I've been also looking for an alternative method to fly and shoot at the same time at least for jets (WarV project). I've only found this native so far, perhaps creating some sort of coordinates which would belong to a circle with the target being the center would work. Then you could simply force the jet to fly to the opposite coordinates in order to have time to engage properly.

    Natives needed :

    • SHOOT_SINGLE_BULLET_BETWEEN_COORDS (in case the pilot can't be tasked to shoot)

    alt text

    Let's say for example our jet is at Vector3 anotherPos, well we could task it to fly towards Vector3 lastStep and at the same time check for angles, if ped is in sight, shoot (with vehicle weapon or with single bullet native). In case we just want the jet to 'fly around' then it would follow the real path. Indeed the downside of this method is that it constantly relies on TASK_VEHICLE_DRIVE_TO_COORD, this would unfortunately only be accurate with static targets and the amount of work behind it is huge, but not impossible..

    Maybe if we RE TASK_PLANE_MISSION we could find out more about it as well.



  • @AHK1221 Thank you. :slight_smile:
    Well, the only way I found to AI-drive/AI-fly and shoot at the same time are the chase-tasks. I haven't tried it with planes yet but it works with helicopters. Coincidentally I am about to release an experimental moving target chasing (and escorting) project, which was originally meant to be implemented in my VAutodrive mod. I hope I get the time today to create the guide and then I release it. Feel free to fork my repo. The compiled mod is contained in "MovingTargetTracker/MovingTargetTracker/bin/x64/Release" but in order to have it work you must run the Saves_configuration "test" in the test-project and place the generated file into C:\Users[LocalAccountName]\Documents\Rockstar Games\GTA V\ModSettings. You need my VCommonFunctions library too.

    A quick and dirty "how to use": Lock a target in either of two ways.

    1. Sit on a driver seat, aim at the target and while aiming press the space bar.
    2. Press Shift+Space and go to map view. Set a waypoint onto the blip of a moving target and leave the map view. In either way, once the target is locked you will see a message "Escorting target" at the bottom of the screen. If this message does NOT appear, the lock has failed. Try again. Please note the escort mode tries to keep a certain distance while the target is not moving. So don't wonder that you don't move as long as the target is closer than 10 meters.

    Change from Escort mode to Chase mode with the Arrow right key.
    Change from Chase mode to Escort mode with Arrow left.
    Dismiss by pressing Ctrl+Shift+D
    Spawn a moving test entity by pressing Ctrl+Shift+C. A light green blip appears. The entity will not move before you locked it as target.
    Dispose the test entity with Ctrl+Shift+X (it will be automatically dismissed).
    You can change the vehicle of the test entity in the MovingTargetTrackerConfig.xml

  • @winject You're illustration is so perfect! Yes, though. I'm quite sure that the jet's at zancudo use TASK_PLANE_MISSION so there's possible some magic flag/number that may be what we're looking for.

  • @Cyron43 Thanks dude! :D I'll have a look at that later today.

  • @sollaholla The mod is uploaded and currently awaiting admin approval. Just in case someone wants to try it without the hassle of downloading the project and compiling it himself.

  • Do you guys think it's possible to set the maximum roll angle that a ped can achieve? Seems to be about 45 deg max for most planes.

  • @sollaholla Unless we look at how the native directly works in memory, I'm not sure.
    However, setting the roll manually still remains possible if you play with the rotation vector.
    Combined with a good tick, it would even look natural.

Log in to reply

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.