Jump to content

Making ped stay in the area


PawelSad12

Recommended Posts

Basically the goal is to make the suspects stay in the area filled with potential covers to make it more difficult for police forces to put them down. The problem is that once in combat they run all over the place and end up out in the open, easy to kill... Is it possible to limit their actions in combat?

 

I tried to force them to "TakeCoverAt" the specific positions every time they find themselves more than 100 feet from their spawn points but I came up short. 

Edited by PawelSad12
Link to comment
Share on other sites

If you've engaged them in a pursuit then they will use the custom AI to escape the police.

If you specifically want them to stay put then you need to assign a task to them and make it persistent i.e no other tasks can override it.

Live Streaming daily from 8pm GMT (UK) at https://twitch.tv/OfficialLukeD - I play a variety of things 😄

Join my official discord server for support, general chat and my stream schedule! https://discord.gg/Mddj7PQ

Link to comment
Share on other sites

8 hours ago, LukeD said:

If you've engaged them in a pursuit then they will use the custom AI to escape the police.

If you specifically want them to stay put then you need to assign a task to them and make it persistent i.e no other tasks can override it.

 

Thank you.

They're not in the pursuit. I've followed your other advise but the game has crashed and I can't really say why. Could you have a quick look?

 

            GameFiber.StartNew(delegate
            {
                //meansnothing is set to true by now
                Guard1.Tasks.TakeCoverAt(Spawn1, Spawn2, 200000, MEANSNOTHING);
                Guard2.Tasks.TakeCoverAt(Spawn1, Spawn2, 200000, MEANSNOTHING);
                GameFiber.Sleep(9000); //time for finding cover
                Game.SetRelationshipBetweenRelationshipGroups("MYENEMY", "COP", Relationship.Hate);

                while (true)
                {
                    GameFiber.Yield();
                    if (Guard1.IsAlive)
                    {
                        break;
                    }
                }

                NativeFunction.Natives.TASK.STAY.IN.COVER(Guard1);
                NativeFunction.Natives.TASK.STAY.IN.COVER(Guard2);
            });
[4/25/2020 1:28:20 AM.145] LSPD First Response: Exception type: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
[4/25/2020 1:28:20 AM.145] LSPD First Response: Exception message: 'object' does not contain a definition for 'TASK'
[4/25/2020 1:28:20 AM.145] LSPD First Response: ------------------------------
[4/25/2020 1:28:20 AM.145] LSPD First Response: Inner exceptions:
[4/25/2020 1:28:20 AM.145] LSPD First Response: ------------------------------
[4/25/2020 1:28:20 AM.145] LSPD First Response: Stack trace:
[4/25/2020 1:28:20 AM.145] LSPD First Response: at CallSite.Target(Closure , CallSite , Object )
[4/25/2020 1:28:20 AM.145] at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
[4/25/2020 1:28:20 AM.145] at CopKillers.CopKillers.Tryout.<Process>b__8_0()
[4/25/2020 1:28:20 AM.145] at Rage.GameFiber.Main()
[4/25/2020 1:28:20 AM.145] LSPD First Response: ==============================
[4/25/2020 1:28:20 AM.145] LSPD First Response: 
[4/25/2020 1:28:20 AM.147] LSPD First Response: [FATAL] Forced termination
[4/25/2020 1:28:20 AM.149] LSPD First Response: [TRACE] Released 0 entities from DefaultContentManager
[4/25/2020 1:28:21 AM.708] LSPD First Response: [INFO] LSPDFR has shut down

The moment I get rid of the loop the code works but without it its kinda useless. I'm thinking missing reference? Do you happen to know if I need one for "GameFiber.StartNew(delegate);" ?

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