[Request] Police Area Default Behaviour

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Scoob
Posts: 10040
Joined: Thu, 27. Feb 03, 22:28
x4

[Request] Police Area Default Behaviour

Post by Scoob » Wed, 11. Nov 20, 16:02

Hey all,

I'm wondering if this is at all possbile as a Mod.

Basically, we have the somewhat ineffective "Police" default behaviour that will see a ship patrol, quite randomly, a Player-owned sector scanning random ships and perhaps revealing a Pirate. It's not very effective as they patrol such a wide area most pirates get through to the station they should be protecting.

What we need is a "Local" version of this command that will Police an area near a Player station irrespective of who owns the sector.

So many times now a single "Plunderer" Pirate ship has caused MILLIONS of credits worth of cargo to be ejected from my Stations, while the Station and Patrolling fleet do nothing.

A command that limits the area to be Policed would go a long way to ensuring that any SCA Pirates are spotted before they cause trouble.

Is this at all possible?

Cheers,

Scoob.

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1872
Joined: Mon, 23. Nov 15, 18:02

Re: [Request] Police Area Default Behaviour

Post by j.harshaw » Sat, 21. Nov 20, 04:13

couldn't sleep. here you go. hope it suits.

didn't try too hard to prevent them wandering out of radius, and they do so, particularly when they're chasing something they find interesting. should tend to go back and patrol around their defined area, though.

Disclaimer (always hated these things): did this in my own time. does not represent the company. it is still a mod, no "official mod" nonsense. no support, implied or otherwise. take as is, or don't, as you will.
Attachments
j.h_PoliceArea.zip
(2.13 KiB) Downloaded 389 times

Scoob
Posts: 10040
Joined: Thu, 27. Feb 03, 22:28
x4

Re: [Request] Police Area Default Behaviour

Post by Scoob » Sat, 21. Nov 20, 10:39

Wow, thanks j.harshaw - I'll give it a test over the weekend. Hope you managed to get some sleep...eventually!

Scoob.

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1872
Joined: Mon, 23. Nov 15, 18:02

Re: [Request] Police Area Default Behaviour

Post by j.harshaw » Sat, 21. Nov 20, 13:44

managed to, eventually. mod work alright?

Scoob
Posts: 10040
Joined: Thu, 27. Feb 03, 22:28
x4

Re: [Request] Police Area Default Behaviour

Post by Scoob » Sat, 21. Nov 20, 18:30

j.harshaw wrote:
Sat, 21. Nov 20, 13:44
managed to, eventually. mod work alright?
Cool. Not had chance to try yet, but should do a bit later this evening.

Scoob.

Polofix
Posts: 179
Joined: Thu, 6. Dec 18, 18:05

Re: [Request] Police Area Default Behaviour

Post by Polofix » Wed, 25. Nov 20, 13:00

j.harshaw wrote:
Sat, 21. Nov 20, 04:13
couldn't sleep. here you go. hope it suits.

didn't try too hard to prevent them wandering out of radius, and they do so, particularly when they're chasing something they find interesting. should tend to go back and patrol around their defined area, though.

Disclaimer (always hated these things): did this in my own time. does not represent the company. it is still a mod, no "official mod" nonsense. no support, implied or otherwise. take as is, or don't, as you will.
Hello,
thank you very much.

I think it is really great that an Egosoft programmer sits down at night in his private time to program a mod. And especially, that Egosoft gives its employees so much freedom to do that. Egosoft is great, even if there is criticism from time to time.
Because I don't have my own sector yet, I could not test the mod yet. But it is already installed. I think that what Scoob describes here is really a big and annoying problem.

Polofix
Posts: 179
Joined: Thu, 6. Dec 18, 18:05

Re: [Request] Police Area Default Behaviour

Post by Polofix » Wed, 25. Nov 20, 19:09

I have tested the mod. Unfortunately I cannot set the patrol area. The patrol always starts from the same place.
From there I can adjust the radius, but the patrol area cannot be changed.
Dragging with the mouse the police symbol to another place does not work.

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1872
Joined: Mon, 23. Nov 15, 18:02

Re: [Request] Police Area Default Behaviour

Post by j.harshaw » Wed, 25. Nov 20, 20:06

Right, sorry about that. Fixed it so that you can set or change the center of the area with the Position parameter of the order in the order queue menu. Left click on the parameter, should say, for example "Nopileos' Fortune Nopileos' Fortune VI", and click on the map to set a new area.

I've also removed the "Area to patrol" parameter to avoid confusion.

Don't know why dragging the order icon on the map doesn't change the area yet. Will see if I can track it down in my spare time.

Also changed the mod name for clarity. Please delete the old "j.h_PatrolArea" directory in your extensions directory if you got it earlier.

Updated mod is attached to my post above where the old download link was.

EDIT: pardon the delay. spotted a bug. fixed. updated mod attached to post above.

IXmus
Posts: 26
Joined: Tue, 30. May 06, 11:39
x4

Re: [Request] Police Area Default Behaviour

Post by IXmus » Wed, 25. Nov 20, 20:37

Hey!
I've tried to test on 4.0 but it not work, I can't choose the area to patrol.

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1872
Joined: Mon, 23. Nov 15, 18:02

Re: [Request] Police Area Default Behaviour

Post by j.harshaw » Wed, 25. Nov 20, 20:44

did you get the latest update? last one had a bug.

Polofix
Posts: 179
Joined: Thu, 6. Dec 18, 18:05

Re: [Request] Police Area Default Behaviour

Post by Polofix » Wed, 25. Nov 20, 21:50

Great, works perfectly.The only thing that is a bit confusing is that the target line with the icon does not point to my selected area. So the line that appears when I select the patrol area. The line points somewhere. But this is only cosmetics, not so important. Of course it would be nice if you could move the patrol icon with the mouse. That would be perfect. But the way it is it works.

Thanks a lot and again x4 is a little better.

I had already downloaded and tested the first updated version and then the second updated version was already there. :lol:

IXmus
Posts: 26
Joined: Tue, 30. May 06, 11:39
x4

Re: [Request] Police Area Default Behaviour

Post by IXmus » Thu, 26. Nov 20, 04:12

j.harshaw wrote:
Wed, 25. Nov 20, 20:44
did you get the latest update? last one had a bug.
I downloaded a file from the second post.

Polofix
Posts: 179
Joined: Thu, 6. Dec 18, 18:05

Re: [Request] Police Area Default Behaviour

Post by Polofix » Thu, 26. Nov 20, 15:31

IXmus wrote:
Thu, 26. Nov 20, 04:12
j.harshaw wrote:
Wed, 25. Nov 20, 20:44
did you get the latest update? last one had a bug.
I downloaded a file from the second post.
Download again to be on the safe side. The last version works.

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1872
Joined: Mon, 23. Nov 15, 18:02

Re: [Request] Police Area Default Behaviour

Post by j.harshaw » Thu, 26. Nov 20, 16:15

should probably label the zips with the version. will do so next time.

IXmus
Posts: 26
Joined: Tue, 30. May 06, 11:39
x4

Re: [Request] Police Area Default Behaviour

Post by IXmus » Sat, 28. Nov 20, 10:47

It's a good idea, but unfortunately, the script doesn't work yet, the ships are flying 100+ km away from the patrol point, and just don't have time to do anything while the pirates are doing their job.

IXmus
Posts: 26
Joined: Tue, 30. May 06, 11:39
x4

Re: [Request] Police Area Default Behaviour

Post by IXmus » Tue, 1. Dec 20, 09:36

I think I found a solution, I just reduced patrol area to 2-4km and my ships stopped flying away from the station.

Thanks.

julian_stargazer
Posts: 12
Joined: Tue, 17. Nov 20, 16:47
x4

Re: [Request] Police Area Default Behaviour

Post by julian_stargazer » Sun, 21. Mar 21, 20:28

IXmus wrote:
Tue, 1. Dec 20, 09:36
I think I found a solution, I just reduced patrol area to 2-4km and my ships stopped flying away from the station.

Thanks.
Hello IXmus,

how did you achieve this?

did you edit the "min" and "max" values from the file "aiscripts/order.move.recon.police.xml" :

Code: Select all

		<param name="radius" type="length" default="if this.ship.isplayerowned then 20km else null" text="{1041, 10093}" comment="Radius">
			<input_param name="min" value="0m"/>
			<input_param name="max" value="350km"/>
			<input_param name="step" value="1km"/>
		</param>
Thanks for clarifying

Polofix
Posts: 179
Joined: Thu, 6. Dec 18, 18:05

Re: [Request] Police Area Default Behaviour

Post by Polofix » Wed, 24. May 23, 12:55

Sorry to bring up this old thread.
I have been using j.harshaw's script for quite some time. But now I have the following situation. I wanted to set the scan radius of the police ship around a station. Only stupidly this station is below the ecliptic. Unfortunately I can't move the scanner area with the mouse, so it is not possible to set a scanner area whose center is below or above the ecliptic.

@j.harshaw could you maybe look at this again? Otherwise the script is really good.
It should only be possible to move the scanner area with the mouse, so that you can also adjust the Y-axis.

Scoob
Posts: 10040
Joined: Thu, 27. Feb 03, 22:28
x4

Re: [Request] Police Area Default Behaviour

Post by Scoob » Wed, 24. May 23, 15:14

I confess, I forgot about this after reverting to vanilla to test v6.0, for some reason it's not made it back into my mod list.

I don't think I ever previously thought about the lack of vertical movement, as I always place my stations at the default "0" position vertically.

I know J.Harshaw was kind enough to do this as a favour, but perhaps it warrants releasing as a full mod, if not able to become a standard game feature.

Edit: I just read through this thread again and it looks like I went radio silence after my post above saying I hoped to have time to test it later. I guess I didn't get time to test for a while, and then neglected to post again. Sorry about that J.Harshaw, I do really appreciate you creating this.

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1872
Joined: Mon, 23. Nov 15, 18:02

Re: [Request] Police Area Default Behaviour

Post by j.harshaw » Wed, 24. May 23, 18:12

Tracked it down. Making the order icon draggable would require modding the UI which I'll have to call out of scope for this mod. Sorry.

Post Reply

Return to “X4: Foundations - Scripts and Modding”