The concept is simple but gives the possibility for some very complex backend stuff.
Have a pursuit manager, which contains various methods/functions for registering and handling pursuits. The benefit being for callouts or dynamic events is that we will be able to register our own pursuits and add peds to them. Internally the pursuit will have it's own thread, with various functions controlling the AI and opening up API alterations.
General layout/control flow would be like this:
1) Pursuit is registered, threads started etc
2) Peds get added to the pursuit
3) Player can then either be auto added to the pursuit (for callouts) or player can call in the pursuit (for traffic stops which....don't stop....)
4) Thread will control the AI, when to run, when to try and hide, when to attack etc. If out of view the blip for the suspect should vanish and a last area blip should appear (until visual regained)
5) Pursuit will end if suspect is arrested or dead
Auto Activation/ Call it In:
Players should be auto added to some pursuits, for example a stolen vehicle callout, as this is a known location, known incident, we can auto create a pursuit and start it.
Players should be able to be added to a pursuit (call it in manually) for things like failed traffic stops.
A pursuit would be classified as such:
• Started (passive) - pursuit has been created, peds are added and are now being told to flea, red blips assigned. If no player is auto added or calls it in the peds will easily escape
• Active - Once 1 player is added (auto or called in) send a notification out to all players "Engaging in Pursuit, location, data etc", blip the player like how backup does.
• Ended - For when a suspect is arrested/killed or escapes pursuit.
What about other players?:
If another player sees the pursuit blast by or they catch up to the pursuit they can "call it in" as well using the same keybind as manually calling in a new pursuit. The difference here is that the check will already determine the pursuit is active and has at least 1 player in it, and so instead of "starting" the pursuit it will just add them to it
A player can back out of a pursuit for whatever reason (RP examples: damaged vehicle, killed a ped, died, can't catch up) using the backup menu/some keybind, this will de-activate the pursuit for that person. If the last player in a pursuit drops out, it will set the pursuit as ended, the peds will have "escaped" and can potentially be respawned and "spotted" by ALPR/players etc.
Dropping out the last player should result in a notification "pursuit abandoned".
Players should be dropped out automatically if they are killed (this will prevent a pursuit remaining active if nobody is actually chasing them, but also stop weird AI things happening)
API stuff we would need access to:
• Function - RegisterPursuit() -> returns int Handle // does all the necessary creation for a pursuit
• Function - AddPedToPursuit(Ped p) // sets a ped as a suspect
• Function - SetPursuitActive() //Sets if the pursuit is currently active for the player (i.e already engaged or not)
• Function - GetActivePursuit() -> returns pursuit handle or null
• Function - IsPlayerInPursuit() -> returns true/false if player is in a pursuit or not
• Function - GetPursuitPeds(handle) -> returns Ped[ ] containing all peds in the pursuit.
• Possibly others I forget right now, I'll add them if I remember anything
This was a long one....sorry. (not sorry)