Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cannot use called in pursuit with crime report correctly

Featured Replies

Hello,

I have this while loop with an sleep of 100ms.

It detects wether an officer or the player gets involved and controls the pursuit.

while (suspectalive)
{
    LogVerboseDebug_withAiC("Doing new check on All entitys.");
    if (false)//!Functions.EntityValidityChecks(MO, false))
    {
        LogTrivial_withAiC("ERROR: in AiCallout object: At Process(): Some Entitys where invalid while having them on persistent. Aborting Callout");
        return false;
    } else
    {
        //-------------------------------------- Player -----------------------------------------------------
        #region Officer Tasks
        //If Player is near enough to the scene and other units spotted the suspect already => auto pursuit
        if (someoneSpottedSuspect 
            && !playerSpottedSuspect
            && (Game.LocalPlayer.Character.DistanceTo(Suspects[0]) < 65f || Game.LocalPlayer.Character.DistanceTo(Location) <= arrivalDistanceThreshold)
            )
            LSPDFR_Functions.SetPursuitIsActiveForPlayer(pursuit, true);


        //Player Spottet Suspect
        if (!someoneSpottedSuspect)
            if (NativeFunction.Natives.HAS_ENTITY_CLEAR_LOS_TO_ENTITY<bool>(Game.LocalPlayer.Character, Suspects[0])
                && Game.LocalPlayer.Character.Position.DistanceTo(Suspects[0]) < 45f + (playerRespondingInAdditon ? 20f : 0f)) {
                LogVerboseDebug_withAiC("player has visual on suspect");
                playerInvolved = true;
                //someoneSpottedSuspect = true;
                playerSpottedSuspect = true;
                LSPDFR_Functions.SetPursuitIsActiveForPlayer(pursuit, true);                  //what should i do? the player cannot get into pursuit after reporting 
                                                                                                //maybe due to the SetPursuitAsCalledIn(pursuit, false)
                LSPDFR_Functions.SetPursuitAsCalledIn(pursuit, false);                          //problem: not beeing able to repot the pursuit. no pursuit radar?
            }


        //wenn player nach ai suspect sieht
        if (someoneSpottedSuspect && !playerSpottedSuspect)
        {
            if (NativeFunction.Natives.HAS_ENTITY_CLEAR_LOS_TO_ENTITY<bool>(Game.LocalPlayer.Character, Suspects[0])
                && Game.LocalPlayer.Character.Position.DistanceTo(Suspects[0]) < 70f)
            {
                LogVerboseDebug_withAiC("player has now visual on suspect too");
                playerInvolved = true;
                playerSpottedSuspect = true;
                LSPDFR_Functions.SetPursuitIsActiveForPlayer(pursuit, true);
                //LSPDFR_Functions.SetPursuitAsCalledIn(pursuit, true);               //the solution? no its not because the officer still wouldn't be able to call in the pursuit
            }
        }

        //Is near enough to the Suspect
        if (Game.LocalPlayer.Character.DistanceTo(Suspects[0]) < 15f && Game.LocalPlayer.Character.IsAlive)
        {
            LogVerboseDebug_withAiC("player is near enough to suspect");
            suspectflees = true;
            LSPDFR_Functions.SetPursuitDisableAIForPed(Suspects[0], false);
        }
        //--------------------------------------- Unit Officers ------------------------------------------
        foreach (PatrolUnit u in Units)
        {
            foreach(var o in u.UnitOfficers)
            {
                //Able to spot the Suspect
                if (!someoneSpottedSuspect)
                    if (NativeFunction.Natives.HAS_ENTITY_CLEAR_LOS_TO_ENTITY<bool>(o, Suspects[0])
                        && o.DistanceTo(Suspects[0]) < 50f)
                    {
                        LogVerboseDebug_withAiC("cop" + o + "has visual on suspect");
                        someoneSpottedSuspect = true;
                        if (playerSpottedSuspect) LSPDFR_Functions.SetPursuitAsCalledIn(pursuit, true);
                        LSPDFR_Functions.SetPursuitCopsCanJoin(pursuit, true);
                    }

                if (someoneSpottedSuspect) if (!LSPDFR_Functions.IsPedInPursuit(o)) LSPDFR_Functions.AddCopToPursuit(pursuit, o);

                //Arrived at the Scene still moving
                if (o.IsAlive && o.IsInVehicle(u.PoliceVehicle, false)
                && u.PoliceVehicle.Speed <= 4
                && u.PoliceVehicle.DistanceTo(Location) < arrivalDistanceThreshold + 40f
                && !someoneSpottedSuspect)
                {
                    if (u.PoliceVehicle.Driver == o) u.PoliceVehicle.Driver.Tasks.PerformDrivingManeuver(VehicleManeuver.Wait);
                }

                //Arrived at the Scene - Get out
                if (o.IsAlive && o.IsInVehicle(u.PoliceVehicle, false)
                && u.PoliceVehicle.Speed == 0
                && u.PoliceVehicle.DistanceTo(Location) < arrivalDistanceThreshold + 40f
                && !someoneSpottedSuspect)
                {
                    o.Tasks.LeaveVehicle(LeaveVehicleFlags.LeaveDoorOpen);
                }

                //Is near enough to the Suspect
                if (o.IsAlive && o.DistanceTo(Suspects[0]) < 15f)
                {
                    suspectflees = true;
                    LSPDFR_Functions.SetPursuitDisableAIForPed(Suspects[0], false);
                }
            }

        }

        #endregion


        #region Suspect Tasks
        if (!Suspects[0].IsAlive) suspectalive = false;
        
        if (suspectalive && !suspectflees) {
            //NativeFunction.Natives.TASK_COMBAT_HATED_TARGETS_IN_AREA(Suspects[0], Location, arrivalDistanceThreshold + 40f, null);
            var ped = getClosestOfficer();
            if (ped != null) Suspects[0].Tasks.FightAgainst(ped);
        }
        #endregion
    }

    GameFiber.Sleep(100);
}


But i do get wierd responses if i SetPursuitIsActiveForPlayer(pursuit, true) l.28 with SetPursuitAsCalledIn(.., false ) l.30.
- Like no pursuit radar after reporting the crime over Button B. But as soon as another unit arrives it triggers the first section officer - if statement. A SetPursuitAsCalledIn(.., true ) and i get my pursuit radar and units marking. 
So somehow in this construct i cant use B to trigger SetPursuitAsCalledIn(.., true ) which is my actual problem.

and when i turn the //SetPursuitAsActiveForPlayer(true) at line 28 in comment. I am not able to report the suspect at all like he is protected from the crime report button (B) although he is actively shooting.

 

After each pursuit with a pursuit radar the units keep their fancy lspdfr pursuit blip until the unit disapears.

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

  • The title was changed to Cannot use called in pursuit with crime report correctly
  • Author
On 3/21/2021 at 9:24 PM, LMS said:

Could you explain what exactly you are trying to achieve? Maybe I can see what works better then.

 

If the player becomes the first one who sees the suspect,

the player should be able to report the suspect via crime report (Hold Key B) (GrammarPolice: "Show me in pursuit / i got visual on the suspect").

Either you report or the ai cops maybe lose or find the suspect and report it to the pursuit them self. 
 

After calling-in via crime report button the pursuit radar should apear but it does not. <---
@LMS you know what to do?

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

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

Similar Content

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.