[S] Race Patrols v1.43 22/01/09 ; Military logic + less CPU load

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

Post Reply
User avatar
Posts: 537
Joined: Sun, 6. Feb 05, 14:04

[S] Race Patrols v1.43 22/01/09 ; Military logic + less CPU load

Post by ttl » Sun, 16. Nov 08, 13:59

http://www.geocities.com/ttlaurila/race ... etospk.pdf
(Rename the file to racepatrols_143.renametospk.pdf)

The above includes the scripts but NOT the mod files. With only the scripts, you will not get rid of existing militaries, but the new patrols will appear. In order to include this as it was designed, download ONE of the options below:

This removes virtually all (non-company) militaries, including the ones associated with Military Outposts. Thus races won't invade one another (argon<->paranid , boron<->split) with this one:
http://www.geocities.com/ttlaurila/nopa ... etorar.pdf

This removes most militaries and most of civilians:
http://www.geocities.com/ttlaurila/nopa ... etorar.pdf

This removes militaries only, leaving civilians untouched:
http://www.geocities.com/ttlaurila/nopa ... etorar.pdf

New link:

Note that it is perfectly OK to run the script without making any changes in Jobs by one of the above mods. In this case you will not replace existing militaries, but just throw more military presence in, and you will get more CPU load (perhaps significantly so), not less.

This script + mod is designed to replace the standard military ships you see bumbling around with small patrols, that call for backup when needed. The result is better game perfomance due to massive decrease in the number of ships in the universe. And also, at least in my opinion, more believable military presence, that makes the game universe appear more alive.

The heart and soul of the script is to represent race military strength by a number, where reserves are called only when needed, and then sent back. The script creates patrols to all race (Argon, Boron, Split, Paranid, Teladi) sectors, and the patrols fly betwen stations hunting for enemies. If in trouble the patrol can call for a heavier assault wing, which can call a yet heavier one, and so on.

The militaries will only fight to the death in core sectors, however, and will fall back after losing some frigates and destroyers in a sector. They will keep periodically assaulting the sector to re-take it, however. This allows for invasion -type events (which I hope we will soon have scripts for) to call for player participation.

Total military strength of each race is finite, but huge, and gets periodic reinforcements. Thus it is possible to defeat a race, unlike with the "whack-a-mole" approach of the Jobs -file, where a destroyed ship soon pops up someplace else.


The mod contains a Jobs file with most of the standard military patrols, as well as civilians, removed. The script runs fine without the mod, but will then just throw some smart military on top of the dumb.

To install the script :
1. Make sure you have Cycrows Plugin Manager installed
2. DL the .spk , rename it, and run it.

To install the mod as fake patch :
1. Copy the .cat and .dat to your main X3TC directory.
2. Rename the files as 06.cat and 06.dat (or one higher than the highest number there already is). Note that Crycrows Plugin Manager always uses the highest mod number, so if you have it installed, you must first make its .cat and .dat one bigger, and make this mod second biggest number.
3. If loading an old game, this will cause most of the military fleet leadships to lose their names, not be destroyed.
4. In the scripts there is one called " aa.kill.name ". Run this manually from the script editor. Give it null as first argument (=run as global script), and any one of the nameless ships as second. It will then work in the background removing the nameless ships within one hour or so.

Detailed instructions for 4. :
1 )Activate the script editor
2) go to script editor under personal/advanced/scrpt editor
3) choose "script editor" (the upmost on the menu)
4) find aa.kill.name (should be at/near the top, thus the aa)
5) press r to run it
6) choose null to first question
7) press enter
8) choose "select ship" for second question
9) find a nameless ship in your universe and select it

Version 1.43 out 22/01/09
-made backup calling less trigger happy
-called assaults "prepare" (i.e. wait) at gate a while before commencing their run. Bigger lead ships wait longer.

Version 1.42 out 17/12/08
-Added the text file to the spk bundle :oops:
-Improved message sending logic (appeared like it could have problems OoS since it had a wait, and then calling ship can die before assault call is complete)
-Assault M6s pack Typhoons

Version 1.41 out 15/12/08


-Patrols ships will not get removed if they are of different race than sector owner (capped and turned neutral) or owned by the player.

-Missile ships (M8 & M7M) no longer used by assaults, since they don't work proper.

-Player gets a distress request to assist when destroyer size forces are called to a sector, if he/she holds police license for race in question.

Version 1.4 out 4/12/08


-Added safety check that should destroy patrol ships if they get yanked out of the sector they are created in, by some other scripts. The logic doesn't support this, and might cause issues, upto hanging the game, appearently.

- Biggest response fleets no longer have fighters with them, just destoyers, to keep max number of ships in hand.

- Response now limited to 15+ destroyers (plus escorts) max. per (core) sector.

- Ships now carry more equipment, and fire more missiles. Missile frigates and bombers now carry their proper missiles, but apparently their default logic doesn't fire them properly.

- Some waits added to the backup calling logic, to hopefully counter lockup possibilities.

version 1.3 out 27/11/08

Manually run the script * aa.update.Patrols * if updating from an earlier version. Run it as global script (=give null as answer to the question). This replaces old patrols, which no longer work under the new logic.


- Names now contain race, and stay the same, locals code info.

- When calling for help, the ships understand to fall back to the arriving heavier fleet, and attack together, instead of perform a suicide run.

- Patrol beacons self-destruct after some time, the presence of one means an assault has happened within last 20mins.

- Patrols now look both for ships they consider hostile, as well as ships that are hostile to them. This *should* make them react right to invasions.


version 1.2 out 24/11/08.

.spk -package name incorrect in version 1.1, this 1.2 will not correctly overwrite. Please remove old version from the installer yourself.

Changes mostly to logic, put in as many checks as possible to not make complex operations on ships that might not be existent anymore. Hopefully this will decrease chances of a conflict with some other script.

Gameplay changes :

- Core sectors now have more patrols, as well as will get the heaviest possible military response when attacked.

- Increased max. strength of militaries somewhat.


Removing the mods and script files will leave some fluff flying around in your universe, because the pre-existing patrols and assaults aren't destoyed (you removed the scripts that would do this). It should be of little consequence, but turning the plugin "off" in the AL plugins menu, will run an uninstall script that, within a max of 2 game days, will remove all traces of what the scirpt created.

The mod files can simply be deleted.


The jobs mod is extremely simple. In order to create your own, to have control over your universe, unpack Jobs.pck to a txt file, and edit. I would recommend this, but for those who do not wish to mod, the readymade mods are there as suggestions. You will find entries, where the name and the script they run are the key. Any lines (or block, depending on your text editor) with attackenemies or patrol -scripts are military patrol leaders. After removing these, you can leave the lines of followers (attacksame and wing.protect scripts) intact. If anyone knows what do the entries with the defencebase script do, I would appreaciate the info.


This is one of the free traders:

130;Mineral Transporter (Teladi);

This is an M6 that leads a military wing:

515;Military M6;

This is an M6 that is part of a standard military patrol, and will ony show up to accompany a leader Job (thus needs not be removed).

1231;Military Patrol (Argon) Followers (M6/M6M)(Lead);
Last edited by ttl on Fri, 6. Nov 09, 21:35, edited 31 times in total.

Posts: 1132
Joined: Sun, 19. Oct 08, 18:46

Post by ThisIsHarsh » Sun, 16. Nov 08, 14:16

Awesome! Wanna grab this asap, but I have a couple of issues/comments...

I really don't want the civilians to be removed, could you release a separate version with only the patrol ships toned down?

Doesn't the stock game already do something similar with the 'Recon' ships? Have you done anything to modify that behaviour?

How about an spk version of the mod? The plugin manager can handle mods as well as scripts... it's just neater is all.

EDIT: Tried to edit the jobs myself in the new X3 editor and it told me 'unsupported version 14', so really really want you to do a version without removing civ ships.
Last edited by ThisIsHarsh on Sun, 16. Nov 08, 14:26, edited 1 time in total.

User avatar
Posts: 537
Joined: Sun, 6. Feb 05, 14:04

Post by ttl » Sun, 16. Nov 08, 14:25

Actually, I do not know what the "recon" ships do. I have left them intact, however. Also police, custom and border patrols are still there, since they scan for contrabands. As well as any patrol that seemed somehow "special" to me in the jobs. Better to at least start conservatively with the slashing.

Also should note that company militaries are not touched.

The problem with the mod is, that there are so many things you can remove or not from the Jobs. I would recommend you take the Jobs file, and edit it yourself, to see what you want to keep and not. You could consider the one in the pack as merely a suggestion. The scripts work regardless of what you do with Jobs.

That said, I will post a version of Jobs with civilians intact soon.

Posts: 1132
Joined: Sun, 19. Oct 08, 18:46

Post by ThisIsHarsh » Sun, 16. Nov 08, 14:38

On second thought, you left in the civilian specialist ships like 'Hosital Ship' and 'Maintenance Vessel' etc, which is enough civilian traffic for me.

And yeah I'm certain I remember Cycrow saying the Recon ships scout for enemies, then call for reinforcements from the nearest military base - I think even with some intelligence in the number of reinforcements called for depending on threat level. Also the reinforcement ships are handled similar to yours in that they are called up out of thin air, but there is a limited number of them and it replenishes over time. IIRC, anyway.

But I much prefer your idea of using the existing patrol ships to call reinforcements. Makes much more sense to me.

Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 5039
Joined: Mon, 15. Dec 03, 19:53

Post by BlackRain » Sun, 16. Nov 08, 14:47

The civilian one leaves all civilians untouched right? I like my civilians

User avatar
Posts: 537
Joined: Sun, 6. Feb 05, 14:04

Post by ttl » Sun, 16. Nov 08, 14:54

yes, Blackrain, no civilians touched in the other version.

Posts: 1132
Joined: Sun, 19. Oct 08, 18:46

Post by ThisIsHarsh » Sun, 16. Nov 08, 15:00

Just looked through the Recon ship scripts, which led me to !lib.fight.defencebase.start. That's one ugly script to try and read, but it does seem to have some limited intelligent threat assessment and response level decisions. It uses ships from those that the base owns. Assumedly the owned ships are replenished (but up to a finite amount) in engine code.

Would be great if you could mod away the Recon ships, and instead have your script use the defence base ships...

Posts: 1132
Joined: Sun, 19. Oct 08, 18:46

Post by ThisIsHarsh » Sun, 16. Nov 08, 15:30

A couple of hints:

- Script command "jump out of existence", would look nicer than just plain destroy.

- You can get a random ship using the script command 'order ship in next shipyard' - no need to have a massive if-else if-end if block.

User avatar
Posts: 537
Joined: Sun, 6. Feb 05, 14:04

Post by ttl » Sun, 16. Nov 08, 17:52

Yea, the coding can be a bit rough, and it's a port from X3R, so some finer commands have probably been added. Thanks for the tips.

I'll fine-tune this, and perhaps extend if it gains some popularity.

Posts: 4655
Joined: Sun, 3. Sep 06, 02:31

Post by A5PECT » Sun, 16. Nov 08, 20:34

Sounds great, I'll try it out tonight.
Admitting you have a problem is the first step in figuring out how to make it worse.

Posts: 1155
Joined: Tue, 8. Apr 08, 10:45

Post by OOZ662 » Sun, 16. Nov 08, 22:31

Well, I installed this entire package and a couple other small scripts at the same time and had a complete freeze (game stops, sound loops, Windows continues to function) a few hours in. (I lost a PNR! Image)

From the symptoms, it seems like the game got stuck waiting for something. I dunno if it was this package, but I figured I'd post in case it occurs to anyone else.

Posts: 57
Joined: Tue, 27. Feb 07, 18:36

Post by ManiakNL » Sun, 16. Nov 08, 22:53

This line "Total military strength of each race is finite, but huge"

So when i destroy a frigate will the race starting to build a new one or ??

Basicly what i take out of this line is when i kill a ship from time to time eventualy it will vanquish the entire race militairy capability's ?

User avatar
Posts: 537
Joined: Sun, 6. Feb 05, 14:04

Post by ttl » Mon, 17. Nov 08, 02:38

ManiakNL: Each race has reserves amounting to the equivalent of few dozen destroyers. Each ship type is valued roughly as per-credit-price. Periodically this reserve "credits" number gets increased. So you can take a race down, if you kill them faster than they can respawn. The respawn rate is a destroyers worth every few hours or so.

OOZ: Still having the issue? It could be an infinite loop in a script. If anyone else notices this might cause that, please tell me asap, and I'll hit debugging mode. Works fine for me, though, so you might want to check with the other scripts you installed?

Posts: 1155
Joined: Tue, 8. Apr 08, 10:45

Post by OOZ662 » Mon, 17. Nov 08, 03:38

I was just coming to fire up the game again.

For reference, the other two scripts installed at the same time were Gazz's modified Collect All Wares in Sector script and JumperBR's Marine Trainer. I still haven't actually used either of them.

Posts: 26
Joined: Tue, 23. Sep 08, 18:40

Post by Methel » Mon, 17. Nov 08, 04:27

Think I might have the same problem as OOZ.
My game now locks up whenever a drone is destroyed. I have to tab out and kill the x3 process.

Now for the scary part, I think I've uninstalled your script. (by manager and deleting the cad and dat files) but this still happens.

Could it be the kill command still running and somehow locking up when a goblin (mars drone) is destroyed?

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”