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.

Giving peds in a pursuit a task

Featured Replies

Hi, I'm trying to put a ped in pursuit. The ped starts out on foot and I want him to get in the closest vehicle. Unfortunately, whenever I put him in the pursuit he just bee lines it away from the player. I've tried putting the code for the pursuit before and after the command to no avail.

purpursuit = Functions.CreatePursuit();
Functions.AddPedToPursuit(pursuit, suspect);
Vehicle v = suspect.GetNearbyVehicles(1)[0]; ;
    if(v.Exists())
         suspect.Tasks.EnterVehicle(v, -1);
    else
        Game.LogTrivialDebug("[FC] No vehicles detected :^)");

This is the code I'm currently using. Can anyone help? :~)

Hi, I'm trying to put a ped in pursuit. The ped starts out on foot and I want him to get in the closest vehicle. Unfortunately, whenever I put him in the pursuit he just bee lines it away from the player. I've tried putting the code for the pursuit before and after the command to no avail.

purpursuit = Functions.CreatePursuit();
Functions.AddPedToPursuit(pursuit, suspect);
Vehicle v = suspect.GetNearbyVehicles(1)[0]; ;
    if(v.Exists())
         suspect.Tasks.EnterVehicle(v, -1);
    else
        Game.LogTrivialDebug("[FC] No vehicles detected :^)");

This is the code I'm currently using. Can anyone help? :~)

Maybe your problem is this: for the task EnterVehicle() the ped has to be very close to the vehicle too work. You can try calling first the task FollowNavigationMeshToPosition(), wait for its completion and then call the task EnterVehicle(). If that doesn't work either most likely will be what Albo said.

  • Author

Maybe your problem is this: for the task EnterVehicle() the ped has to be very close to the vehicle too work. You can try calling first the task FollowNavigationMeshToPosition(), wait for its completion and then call the task EnterVehicle(). If that doesn't work either most likely will be what Albo said.

I'll try that, thank you very much :~)

I think LSPDFR overrides suspect behaviour when you add them to a pursuit and I agree it's pretty annoying. I'm hopeful this may change in 0.3 though :)

This might be the case but I think I saw a callout where they had the suspect doing things while in a pursuit. I'll play with it. Worst case scenario I just start the pursuit after he steals a vehicle.

Maybe your problem is this: for the task EnterVehicle() the ped has to be very close to the vehicle too work. You can try calling first the task FollowNavigationMeshToPosition(), wait for its completion and then call the task EnterVehicle(). If that doesn't work either most likely will be what Albo said.

I was going to mention this too. I couldn't remember if it was EnterVehicle() or CruiseWithVehicle() (or both?) that doesn't work when the ped isn't close enough (within 10 meters) to the vehicle. But now that I'm thinking it over again, I believe you are right. You have to make the ped move closer to the vehicle first.

Is there a special task/native to make the ped jack the vehicle if it's occupied, or does EnterVehicle() do that automatically when you pass in -1 as the seat index?

Just make sure you make the ped run to the car, not walk at a normal speed. He's running away from the police, after all. :tongue:

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

  • Author

I was going to mention this too. I couldn't remember if it was EnterVehicle() or CruiseWithVehicle() (or both?) that doesn't work when the ped isn't close enough (within 10 meters) to the vehicle. But now that I'm thinking it over again, I believe you are right. You have to make the ped move closer to the vehicle first.

Is there a special task/native to make the ped jack the vehicle if it's occupied, or does EnterVehicle() do that automatically when you pass in -1 as the seat index?

Just make sure you make the ped run to the car, not walk at a normal speed. He's running away from the police, after all. :tongue:

Ah I see, thank you! :~)

  • Author

Is there a special task/native to make the ped jack the vehicle if it's occupied, or does EnterVehicle() do that automatically when you pass in -1 as the seat index?

There is not that one I can find and EnterVehicle() does not do it automatically. Currently working on finding a way to make them steal an occupied car, I'm gonna see if telling them to attack the melee driver will work.

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

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.