Jump to content
Fiskey111

Last Ditch Effort to Save Callouts...

Recommended Posts

Hi Everyone,

I don't know if you know, but Secondary Callouts has had an issue with disabling pursuit backup ever since the release of 0.3.  I don't know why the callouts would do this since I never touch backup (unless I call it Code 3).  I'm just curious to know what was added in the update that could have possibly caused this to occur.  I've tried a fix (that at least made it better and last longer) where I call DisablePursuitAI(pursuit, false) every callout, just to make sure that the pursuit doesn't disable the AI.  If someone has a permanent fix/idea that will help please let me know.

I really didn't want to do this, but I've attached my code for you, if you are willing to help that would be fantastic, if not- I'm not sure what I'll do haha.  

Thank you so much!

 

Edited by fiskey111
Removed Callout File

Share this post


Link to post
Share on other sites

I don't think this is going to be the cause of the problem, but when you are done using a SoundPlayer instance you should call the Dispose() method. You can add it in your End() method. Remember to do this with every class that implements the IDisposable interface.

Also did you try to remove all the pursuit methods? CreatePursuit(), AddPedToPursuit(), SetPursuitDisableAI(), etc. 
And you can try to register only one callout and test if it works, then you register only the next callout and test it,... until you find if it only happens with one callout or if it happens with every callout.

Share this post


Link to post
Share on other sites
1 hour ago, alexguirre said:

Also did you try to remove all the pursuit methods? CreatePursuit(), AddPedToPursuit(), SetPursuitDisableAI(), etc. 
And you can try to register only one callout and test if it works, then you register only the next callout and test it,... until you find if it only happens with one callout or if it happens with every callout.

Also, while not required, I split all of my callouts into separate files for organization and testing. It's a lot easier to read that way too.

Share this post


Link to post
Share on other sites
2 hours ago, goigle said:

Can you show the crash log so I can see where to look?

 

55 minutes ago, goigle said:

Also, while not required, I split all of my callouts into separate files for organization and testing. It's a lot easier to read that way too.

There is no crash- it just seems like for some reason my callouts like take over the control of the AI and don't hand it back to LSPDFR.

 

2 hours ago, alexguirre said:

I don't think this is going to be the cause of the problem, but when you are done using a SoundPlayer instance you should call the Dispose() method. You can add it in your End() method. Remember to do this with every class that implements the IDisposable interface.

Also did you try to remove all the pursuit methods? CreatePursuit(), AddPedToPursuit(), SetPursuitDisableAI(), etc. 
And you can try to register only one callout and test if it works, then you register only the next callout and test it,... until you find if it only happens with one callout or if it happens with every callout.

Thanks for that!  Good to know!  I'll make sure to do that from now on!

I didn't try that yet.  My goal is to stay up all Thursday night and basically doing that.  I'll set each call to always and only enable one at a time and test them over and over.  Hopefully that'll tell me whether it's all of them or just one callout doing it.  I just wasn't sure if there was something I missed in the update to 0.3 that caused this to happen.

 

Thanks guys!  Hopefully I'll be able to figure out this.  I won't be able to for a bit, I'm super busy the next couple days.

Share this post


Link to post
Share on other sites

Normally the AI disabled flag is per pursuit instance, so it shouldn't carry over. I'll see if I can take a look this weekend though.

Share this post


Link to post
Share on other sites
3 hours ago, LMS said:

Normally the AI disabled flag is per pursuit instance, so it shouldn't carry over. I'll see if I can take a look this weekend though.

I think the problem here is that the pursuit is not being marked as Active.

Functions.SetPursuitActiveForPlayer(pursuit, true); should fix the issues :smile:

Share this post


Link to post
Share on other sites
5 hours ago, LMS said:

Normally the AI disabled flag is per pursuit instance, so it shouldn't carry over. I'll see if I can take a look this weekend though.

Thanks LMS!

1 hour ago, Albo1125 said:

I think the problem here is that the pursuit is not being marked as Active.

Functions.SetPursuitActiveForPlayer(pursuit, true); should fix the issues :smile:

I wish it fixed it :(  I'm thinking it's fight in progress- that's the callout I think is causing my troubles!

Share this post


Link to post
Share on other sites

Just an update:

I'm running into a wall.  Originally I thought I had isolated it down to two specific callouts.  However, when I had put all the other ones together that "worked" the bug still occurred, however it didn't occur when they were in like groups of 4.  I'm going to try going through them all again one by one and spending about 30 mins on each.  I'll report my findings here once I finish.

Share this post


Link to post
Share on other sites

Just another important update:

I've found one source of the problem with this issue.  I've done a decent amount of testing (~15 callouts each with both scenarios) which has been consistent with what I thought.

The problem (at least one of them) is with the knife callout, specifically this code:

Spoiler

                    else
                    {
                        Game.DisplayNotification("Native run");
                        myPed.Tasks.FightAgainst(victim);
                        NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", victim, myPed);
                    }

 

If the above is called for the callout - backup will be disabled.
If the above is not called for the callout - backup is normal.

Now the million dollar question (I don't have a million dollars so sorry I can't give it to you if you can answer it):

Why does that code disable backup?

Walking through that code:
1. Notification doesn't matter
2. FightAgainst is valid and myPed does actually do it (sorry about the name, this was my first callout made and I've never gotten around to changing the code).
3. The native function is valid and called successfully - the victim runs away.

It's very simple.  I just don't get why those three lines of code disable backup.

Quoting something that Stealth22 said in one of my earlier days of pretending to code: 

"The computer only does what it's told to do. :turned: "

But I don't get how I'm telling it to disable backup.

@Albo1125
@LMS

I apologize for tagging you guys in this, I just figure that you won't see it and it'll be lost in the ever-growing forums, but this is a breakthrough (in my opinion)!

 

Below is the other code for the other two scenarios in the knife callout (for a total of three scenarios)

Spoiler

                    if (r == 1)
                    {
                        Game.DisplayNotification("Pursuit");
                        //Add ped to pursuit so he runs
                        Functions.AddPedToPursuit(pursuit, myPed);

                        //Make victims flee
                        victim.Tasks.Wander();
                        victim.Dismiss();
                        myPed.Dismiss();
                        GameFiber.Yield();
                    }
                    else if (r == 2)
                    {
                        Game.DisplayNotification("Hands Up");
                        myPed.Tasks.FightAgainst(victim);

                        victim.Tasks.PutHandsUp(5000, myPed);

                        GameFiber.Sleep(5500);

                        victim.Tasks.Wander();
                        victim.Dismiss();

                        Functions.AddPedToPursuit(pursuit, myPed);

                        myPed.Dismiss();
                        GameFiber.Yield();
                    }

 

 

Share this post


Link to post
Share on other sites
1 hour ago, fiskey111 said:

Just another important update:

I've found one source of the problem with this issue.  I've done a decent amount of testing (~15 callouts each with both scenarios) which has been consistent with what I thought.

The problem (at least one of them) is with the knife callout, specifically this code:

  Reveal hidden contents


                    else
                    {
                        Game.DisplayNotification("Native run");
                        myPed.Tasks.FightAgainst(victim);
                        NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", victim, myPed);
                    }

 

If the above is called for the callout - backup will be disabled.
If the above is not called for the callout - backup is normal.

Now the million dollar question (I don't have a million dollars so sorry I can't give it to you if you can answer it):

Why does that code disable backup?

Walking through that code:
1. Notification doesn't matter
2. FightAgainst is valid and myPed does actually do it (sorry about the name, this was my first callout made and I've never gotten around to changing the code).
3. The native function is valid and called successfully - the victim runs away.

It's very simple.  I just don't get why those three lines of code disable backup.

Quoting something that Stealth22 said in one of my earlier days of pretending to code: 

"The computer only does what it's told to do. :turned: "

But I don't get how I'm telling it to disable backup.

@Albo1125
@LMS

I apologize for tagging you guys in this, I just figure that you won't see it and it'll be lost in the ever-growing forums, but this is a breakthrough (in my opinion)!

 

Below is the other code for the other two scenarios in the knife callout (for a total of three scenarios)

  Reveal hidden contents


                    if (r == 1)
                    {
                        Game.DisplayNotification("Pursuit");
                        //Add ped to pursuit so he runs
                        Functions.AddPedToPursuit(pursuit, myPed);

                        //Make victims flee
                        victim.Tasks.Wander();
                        victim.Dismiss();
                        myPed.Dismiss();
                        GameFiber.Yield();
                    }
                    else if (r == 2)
                    {
                        Game.DisplayNotification("Hands Up");
                        myPed.Tasks.FightAgainst(victim);

                        victim.Tasks.PutHandsUp(5000, myPed);

                        GameFiber.Sleep(5500);

                        victim.Tasks.Wander();
                        victim.Dismiss();

                        Functions.AddPedToPursuit(pursuit, myPed);

                        myPed.Dismiss();
                        GameFiber.Yield();
                    }

 

 

I use this code in my new person with a knife callout and I don't experience any issues with backup freezing.

Share this post


Link to post
Share on other sites
6 minutes ago, Albo1125 said:

I use this code in my new person with a knife callout and I don't experience any issues with backup freezing.

In the same manner, too?  That doesn't make sense why that would cause it then.  I know it does because when I had tested all 3 scenarios together I noticed that after that specific scenario the backup would stop working which lead me to try the tests of each scenario.

 

I'm going to rewrite the callout and see if that fixes it.  Thanks Albo!

Share this post


Link to post
Share on other sites
12 minutes ago, fiskey111 said:

In the same manner, too?  That doesn't make sense why that would cause it then.  I know it does because when I had tested all 3 scenarios together I noticed that after that specific scenario the backup would stop working which lead me to try the tests of each scenario.

 

I'm going to rewrite the callout and see if that fixes it.  Thanks Albo!

Yea I use it in the same way (make a suspect stab a fleeing victim, suspect gets added to pursuit).

As I said before I really do recommend splitting your callouts into separate class files to make it easier to troubleshoot. Good luck!

Share this post


Link to post
Share on other sites

One idea: In the knife callout, in the if statement you listed, you don't add the ped to the pursuit instance. Hence backup will not work for that pursuit (though I think it is intended). However, since that instance never gets a suspect assigned I could imagine it being in a kinda "zombie" status where it is waiting to start for the first time and hence bugging new pursuits. Try only creating a pursuit instance if you are actually using it and report back please.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×