Jump to content

Suspect glitching (refusing to go down?)


w0nder

Recommended Posts

Hey guys! Recently got into developing and hope to eventually, after getting a little better release a callout pack. 

 

Today I've spent a few hours on some code and I'm not exactly sure why I'm having so many issues with it. It could just be something obvious and my lack of experience is making me miss something important, but I'm not able to find what is wrong with my code.

Any help would be amazing!

 

The issue is shown below this that video:

 

 

Here is the the only part I think I could have messed up in the code:

           

            if (Game.LocalPlayer.Character.DistanceTo(Suspect.Position) < 20f)
            {
                Suspect.Tasks.FightAgainst(Game.LocalPlayer.Character);
            }
            else
            {
                Suspect.Tasks.Wander().WaitForCompletion(20000);
            }
            if (Suspect.IsDead || Suspect.IsCuffed)
            {
                End();
                Game.DisplayNotification("Dispatch we are Code 4, No additionals needed");
                Functions.PlayScannerAudio("ALL_UNITS CODE_4_ADAM_NO_ADDITIONAL");
            }

 

Again, thanks for any help and if anyone would like to help me further, send me a pm or let me know in this forum and i'll send you the entire thing. 

 

I have these set as that as well.

  1.    Suspect.IsPersistent = true;
  2.             Suspect.BlockPermanentEvents = true;

Understand, our police officers put their lives on the line for us every single day. They've got a tough job to do to maintain public safety and hold accountable those who break the law. - Barack Obama

Link to comment
Share on other sites

You call  Suspect.Tasks.FightAgainst(Game.LocalPlayer.Character); directly inside Process() => it means that whenever (Game.LocalPlayer.Character.DistanceTo(Suspect.Position) < 20f) == true the game assigns a new task to your ped. You should use switch..case + enum containing stages or my method based on Action. I suggest to take a look at Albo's tutorials.

Here are links to my library and example of use:

https://github.com/LtFlash/LtFlash.Common/blob/master/LtFlash.Common/Processes/ProcessHost.cs

https://github.com/LtFlash/LtFlash.Common/blob/master/Examples/Processes/ProcessHost.cs

 

Link to comment
Share on other sites

Thanks for the help!

Understand, our police officers put their lives on the line for us every single day. They've got a tough job to do to maintain public safety and hold accountable those who break the law. - Barack Obama

Link to comment
Share on other sites

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...