Jump to content

Alternative solution when lspdfr blocking some ped tasks?


ziipzaaapM16A4

Recommended Posts

Hello,

 

i'm using ambient spawned unit or RequestBackup(noRespondTask = true) unit to let them respond to emergencys. 

Now when they arrive the should AimAt() or AimAndAproach().
But both doesn't work. I tested using SetCopAsBusy(true). No difference!

Onetime LSPDFR crashed due to another Plugin and right after the crash all officers ( with SetCopAsBusy(true) and without ) were just Aiming for the right Timedurration. 

That gave me the hint that lspdfr is not even only in combat controlling cops but also when having NoTask.

 

Is there a way to get these officers executing their tasks?

 

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

Link to comment
Share on other sites

  • Management Team

Does aiming at their coordinates instead of the entity work?

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

Link to comment
Share on other sites

no. but in another aicallout i use only the entity and it works there sometimes.
if you become out of ideas i guess its just me.

 

btw a video of how it looks currently

https://streamable.com/sx7flx

 

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

Link to comment
Share on other sites

  • Management Team

The reason why I'm asking is that the combat control might prevent the cops from engaging, but for aiming at a coordinate that should not kick in. You can still try using SetCopIgnoreAmbientCombatControl to disable that.

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

Link to comment
Share on other sites

I use now a IfNoTaskRepeater to reexecute the task in combination with the position instead entity.

Works so far.

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

Link to comment
Share on other sites

i worked a little on it.
works really good.

 


fO.LogTrivialDebug_withAiC($"DEBUG: Aproach and Aim");
int task = 0; //0 = aproaching, 1 = aiming, 2 = shooting;
fO.LogVerboseDebug_withAiC($"DEBUG: get Task 0 -------- 0 = aproaching & aiming, 1 = aiming, 2 = shooting, 3 = lasttimeaproach, 4 = aimOnce");
foreach (var officer in fO.UnitOfficers()) 
{
	officer.Inventory.GiveNewWeapon(new WeaponAsset("WEAPON_PISTOL"), 30, true);
	GameFiber.StartNew(delegate
	{
		var thisOfficer = officer;
		float innerRange = 10f;
		while (task == 0)
		{
			if (officer)
			{
				if (thisOfficer.Tasks.CurrentTaskStatus != Rage.TaskStatus.InProgress && thisOfficer.Tasks.CurrentTaskStatus != Rage.TaskStatus.Preparing)
				{
					try {
						if (thisOfficer.Position.DistanceTo(fO.Suspects()[0].Position) > innerRange + 2f)
						{
							thisOfficer.Tasks.GoToWhileAiming(fO.Suspects()[0].Position, fO.Suspects()[0].Position, innerRange, 2f, false, FiringPattern.SingleShot);
						} else
						{
							thisOfficer.Tasks.AimWeaponAt(fO.Suspects()[0].Position, 15000);
						}
					} catch { }
				}
			}
			GameFiber.Yield();
		}
		thisOfficer.Tasks.Clear();
		while (task == 1)
		{
			if (officer)
			{
				if (thisOfficer.Tasks.CurrentTaskStatus != Rage.TaskStatus.InProgress && thisOfficer.Tasks.CurrentTaskStatus != Rage.TaskStatus.Preparing)
					try { thisOfficer.Tasks.AimWeaponAt(fO.Suspects()[0].Position, 15000); } catch { }
			}
			GameFiber.Yield();
		}
		thisOfficer.Tasks.Clear();
		while (task == 2)
		{
			if (officer)
			{
				if (thisOfficer.Tasks.CurrentTaskStatus != Rage.TaskStatus.InProgress && thisOfficer.Tasks.CurrentTaskStatus != Rage.TaskStatus.Preparing && !LSPDFR_Functions.IsPedGettingArrested(fO.Suspects()[0]) && !LSPDFR_Functions.IsPedArrested(fO.Suspects()[0]))
				{
					try {
						LSPDFR_Functions.SetCopIgnoreAmbientCombatControl(officer, true);
						thisOfficer.Tasks.FightAgainst(fO.Suspects()[0]); 
					} catch { }
				}
			}
			GameFiber.Yield();
		}
		thisOfficer.Tasks.Clear();
		while (task == 3)
		{
			if (officer)
			{
				if (thisOfficer.Tasks.CurrentTaskStatus != Rage.TaskStatus.InProgress && thisOfficer.Tasks.CurrentTaskStatus != Rage.TaskStatus.Preparing)
				{
					try
					{
						if (thisOfficer.Position.DistanceTo(fO.Suspects()[0].Position) > 3f + 2f)
						{
							thisOfficer.Tasks.GoToWhileAiming(fO.Suspects()[0].Position, fO.Suspects()[0].Position, 3f, 2f, false, FiringPattern.SingleShot).WaitForCompletion();
							officer.Inventory.GiveNewWeapon(new WeaponAsset("WEAPON_UNARMED"), 1, true);
						}
					}
					catch { }
				}
			}
			GameFiber.Yield();
		}
		thisOfficer.Tasks.Clear();
		bool once = false;
		while (task == 5 && !once)
		{
			if (officer)
			{
				try { thisOfficer.Tasks.AimWeaponAt(fO.Suspects()[0].Position, 80000); } catch { }
			}
			once = true;
		}

	});
	LSPDFR_Functions.SetCopIgnoreAmbientCombatControl(officer, false);

 

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

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