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.

Can't control cop ped with combat

Featured Replies

I want to have a cop ped to consistently stay in combat with a ped, whether it's melee or shooting, but the cop keeps leaving combat, per the Rage log. Is this a proper implementation of LSPDFR to only allow cops to stay in combat if they are being shot at, even with SetAsBusy=true?

@LMS

  • Management Team

Yes, we do hook various combat tasks to manage behavior. The logic is rather complex and depends on what your situation is. Initially, we distinguish between ambient (non-persistent) and persistent cops. If they are persistent and have an internal flag set that allows them to shoot, they will be allowed to. This is usually used to allow cops to fight in pursuits.

 

For ambient/non-persistent cops (which the solution was really developed for as I wanted to reduce random aggression), it works like this:

If the target is ambient/non-persistent and is either currently shooting, aiming or has fired a weapon at an enemy ped within the last 500ms, the cop is allowed to return fire.

 

If the target is persistent:

If target is in a chase and the chase still allows for more ambient units with a high priority to join, we add the cop to the chase.

Else if target is either currently shooting, aiming or has fired a weapon at an enemy ped within the last 500ms, the cop is allowed to return fire.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

  • Author

Interesting. Is there any way to override this? I want to orchestrate a shooting scenario, outside a pursuit, but the cops won't continuously be in combat. The issue I dislike is they'll go into combat and quickly disengage and stand still until being shot at. I want to override this for a callout.

  • Author

They are. I essentially create a random ped and a cop. I use the Fight task for each ped. The random ped is actively shooting and seeking cover while the cop may shoot for one second then stand still, then start shooting again after 3 seconds and basically repeats this loop.

  • Author

Here's a section of the log

[5/14/2020 10:22:17 PM.446] LSPD First Response: [TRACE] Allowed non-ambient ped to shoot due to flag
[5/14/2020 10:22:18 PM.242] LSPD First Response: [TRACE] Combat target is shooting at us, returning fire
[5/14/2020 10:22:19 PM.266] LSPD First Response: [TRACE] Allowed non-ambient ped to shoot due to flag
[5/14/2020 10:22:20 PM.289] LSPD First Response: [TRACE] Combat target is shooting at us, returning fire
[5/14/2020 10:22:21 PM.362] LSPD First Response: [TRACE] Allowed non-ambient ped to shoot due to flag
[5/14/2020 10:22:22 PM.677] LSPD First Response: [TRACE] Combat target is shooting at us, returning fire
[5/14/2020 10:22:23 PM.807] LSPD First Response: [TRACE] Allowed non-ambient ped to shoot due to flag
[5/14/2020 10:22:25 PM.678] LSPD First Response: [TRACE] Combat target is shooting at us, returning fire
[5/14/2020 10:22:26 PM.739] LSPD First Response: [TRACE] Allowed non-ambient ped to shoot due to flag
[5/14/2020 10:22:28 PM.050] LSPD First Response: [TRACE] Combat target is shooting at us, returning fire
[5/14/2020 10:22:29 PM.092] LSPD First Response: [TRACE] Allowed non-ambient ped to shoot due to flag
[5/14/2020 10:22:30 PM.003] LSPD First Response: [TRACE] Allowed non-ambient ped to shoot due to flag

And I also constantly get this, which I believe is causing the officers to stand still most of the time

[5/14/2020 10:22:36 PM.444] LSPD First Response: [TRACE] James McTavy (S_M_Y_SHERIFF_01) entered combat with target: Gregory Salvagente (A_M_Y_STBLA_02)
[5/14/2020 10:22:36 PM.947] LSPD First Response: [TRACE] James McTavy (S_M_Y_SHERIFF_01) left combat.

I've never gotten the "not allowed" output.

Edited by OJdoesIt

  • Management Team

That log makes me wonder if it is actually LSPDFR interfering. The entered/left combat messages are purely diagnostical and do not actually start/end any kind of combat, they merely listen for a change in the flag. What surprises me is the delay between entering and leaving, our code would immediately abort any combat it deems "illegal". I presume if you test a similar code piece without LSPDFR loaded it works, though?

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

  • Management Team

I can confirm that I see the same issue. The root cause is an interesting one, though: While LSPDFR makes ambient cops less aggressive, in your case they should still attack since they take previous crimes (shooting at an officer is one) into account. However, the Christmas update (?) must have changed the memory offset which we use to retrieve the attacked entity and it was always null - hence no ped was aware of it being damaged and no crime was generated. You can tell since there are no "x was damaged by y" in the log, which used to show up. Good find!

 

That being said, I will add an override for cops to ignore any ambient settings and just always fight to the next API update.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

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.