ADAMS - ITT (for TC and XTC - V10)

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

(----____JEFF____----)
Posts: 266
Joined: Sat, 20. May 06, 14:55

ADAMS - ITT (for TC and XTC - V10)

Post by (----____JEFF____----) » Wed, 25. Aug 10, 19:45

  • Advanced Defense and Management Systems - Improved Turret Tactics
    (ADAMS - ITT)
Intro:
  • Always found it hard to choose between "Missile Defense" and "Protect me"? Or perhaps "Attack all" would be a better option if it would shoot down missiles? Well this script will solve those problems.
    Advanced Defense and Management Systems proudly present their first product, Improved Turret Tactics (ITT).
    This system is an upgrade to the existing turret commands to upgrade existing features and add new ones.
    There is no need to install any new software in your ships, the existing software will automatically be upgraded to the new standard.

    You can watch this video to see ADAMS - ITT in action:
    http://adf.ly/1zXfG - Sponsored link
    http://www.youtube.com/watch?v=dYKqUhT4jx8 - Direct link
What it is:
  • It's a AL plugin that replaces the default turret commands with new ADAMS - ITT commands. Any ship in sector (the sector the player is in) that uses any of the default turret commands will be updated to ADAMS - ITT. That includes all your ships as well as AI ships of other races. It doesn't do OOS ships because turret commands don't have any impact on the outcome of a fight OOS and they can't be changed anyway.
Usage:
  • To use ADAMS - ITT on your own ships you don't have to do anything, except using the default turret commands. So if you want to use ADAMS - ITT Missile Defense just run it like you normally do, the default Missile Defense. There is only one thing you should know and that is that the busier a sector is the longer it can take to replace the default command with ADAMS's version of it. So it's a good idea give all turrets their commands and then jump to the sector you want to go to (as all ships are updated when you enter a sector).
General features added:
  • Three of the default turret commands are updated with the current version (1). These are: Protect, Missile Defense and Kill all enemies.
    All three commands will shoot down missiles aimed at you or any other ships that belong to you. They target enemies the same way (you or your other ships).
    Additionally they all have "Attack Forecasting". That means that the turrets will look at ships nearby (15Km range) and scan them to see who or what they target and if their intentions are to attack or not. This should give you an advantage when facing those nasty Pirate surprise attacks ;)

    Now you might wonder if this doesn't make all commands very similar. Well the difference is in the priorities. Missile defense is still the best to use against missiles because it gives them priority over all other possible targets. The other two will only shoot down missiles if there's not much else to target.
    Kill enemies now has more priority for ships that actually attack you or your other ships, but it will still attack enemies that didn't fire a single shot at you.
    Protect is a bit more conservative than Kill enemies, but it will bite back if someone has evil intentions ;) It won't attack any enemy, just the ones that target/attack you or any of your other ships. This makes it a good option if you don't want to pick fights with Pirates, unless they attack you of course.

    About the rate of fire there is also a remark, I've made some changes in the fire loop to allow the turrets to have a faster rate of fire (RoF). They can't fire any faster then the player can, I just tried to get the RoF to a bit more realistic speeds (as the previous RoF was just horribly slow compared to what some guns can do, compared to the stock scripts it already was a massive improvement though). Besides the improved RoF this also reduces the number of checks that need to be made during the firing sequence.
    And while I was there I also implemented a burst firing system for shooting down missiles (there isn't any advantage in doing it for other targets as they won't die with one burst, missiles will). The burst system allows the turret to effectively handle 2 or more missiles at a time (it basically switches between the 2 closest missiles it can fire at, I can increase that, but it would put more strain on the checks and this is already very effective with high velocity weapons as the first missile gets shot down before the next switch).

    The specific features are described in the following part, notice that it also includes the original features (that are the features in the vanilla commands). The features are listed in the order of priority the script gives them, so each feature has priority over the features below it but doesn't have priority over the features above it. Red ones are removed features and green ones are added features. White ones where already there and are left in. (these are new features compared to the default scripts, not to older versions or other scripts)
Command specific features:
  • Protect command:
    • - Attacks any ship that has opened fire on you
      - Attacks any ship that has targeted you (for attack)
      - Attacks any ship that has targeted your ships (for attack)
      - Shoots down missiles aimed at you
      - Shoots down missiles aimed at your other ships
      - Shoots down missiles aimed at neutral ships (other races you're friendly with)
      - Shoots down missiles aimed at your stations (new in ADAMS ITT)
      - Shoots down missiles aimed at neutral stations (new in ADAMS ITT)

      - Attacks your current target
      - Retargets if the current target is destroyed, not an enemy or out of range
    Missile defense command:
    • - Shoots down missiles aimed at you
      - Shoots down missiles aimed at your other ships
      - Shoots down missiles aimed at neutral ships (other races you're friendly with)
      - Shoots down missiles aimed at your stations (new in ADAMS ITT)
      - Shoots down missiles aimed at neutral stations (new in ADAMS ITT)

      - Attacks any ship that has opened fire on you
      - Attacks your current target
      - If the main command is an attack command, Attack any enemy
      - Attacks any ship that has targeted you (for attack)
      - Attacks any ship that has targeted your ships (for attack)

      - Retargets if the current target is destroyed, not a enemy, out of range or if another missile is aiming at you
      - Has a specialized burst fire system to effectively shoot down missiles (new in ADAMS ITT)
    Kill enemies command:
    • - Attacks your current target
      - Attacks any ship that has opened fire on you
      - Attacks any ship that has targeted you (for attack)
      - Attacks any ship that has targeted your ships (for attack)
      - Shoots down missiles aimed at you
      - Shoots down missiles aimed at your other ships
      - Shoots down missiles aimed at ships of other races you're friendly with (allies)
      - Shoots down missiles aimed at your stations (new in ADAMS ITT)
      - Shoots down missiles aimed at neutral stations (new in ADAMS ITT)

      - Attacks any enemy that gets in range
      - Retargets if the current target is destroyed, not a enemy or out of range
    All 3 commands:
    • - Ignore missiles fired (at other targets) that are of the same race as they are (new in ADAMS ITT)
Download: Installation:
  • Very easy, just run the .spk and it will be installed. In game you'll get a message in your log telling you it has installed and which version it is.

    XTC specific notes: After installing the files you need to turn off the Xtended turret scripts in the AL options. Ships should still be ECM enabled after that, it's just enabled through ADAMS and not through XTC's scripts. After doing that you might need to save and restart the game and fly to another sector before the ADAMS scripts take over. I haven't done much testing, I just implemented it how it's also implemented in XTC so technically it should work but without testing I can't tell for sure. So please report any issues you encounter. Also ECM is only enabled on the missile defense command, just like it also is in XTC, the non-missile defense commands of ADAMS will still shoot at missiles however they won't use ECM.
Updating:
  • Should be as easy as installing, just run the .spk and in game you'll get a message which will tell you to what version you updated. In order to complete the update you have to jump to another sector (you can immediately jump back if you want).
Removal:
  • Is also very easy, just remove the files. The script automatically removes itself when a ship goes OOS, so after removal all ships in sector might still run some code, but once they've been OOS they'll be back to normal again.
Compatibility:
  • I have tested it and I have not experienced any conflicts or other strange stuff, but if you notice anything strange that could be related to this script, please let me know so I can take a look at it and (probably) fix it. That means it's compatible with all scripts and mods I tested it with and most likely everything else that's out there as well ;) (back in the days of original development that is)

    I didn't do a lot of testing in TC yet, I know the script works as I've seen it do its thing and it's listed in the commands, but I don't know how it plays with missile turrets, it should be fine as it runs the default scripts for those but please report if you find any troubles (with missile turrets or any other troubles).

    Code: Select all

    Command slots:
    <t id="958">COMMAND_TYPE_TURRET_58</t> - ADAMS - ITT by Jeff: Protect All
    <t id="959">COMMAND_TYPE_TURRET_59</t> - ADAMS - ITT by Jeff: Missile Defense
    <t id="960">COMMAND_TYPE_TURRET_60</t> - ADAMS - ITT by Jeff: Attack All
    
    Text file:
    7999
Credits:
  • Cycrow, Gazz and UniTrader for answering my questions and advising me about scripting on the Egosoft forums, as well as Egosoft it self for making the game ;) And Whimsy for his excellent Exscript editor, it's a real blessing to just type the commands and copy blocks of code instead of single lines ;)
Last edited by (----____JEFF____----) on Fri, 26. Oct 12, 23:54, edited 19 times in total.

User avatar
Topcross
Posts: 180
Joined: Sat, 15. Aug 09, 03:30

Post by Topcross » Wed, 25. Aug 10, 20:20

Seems nice, going to try this out when I got the time.

One question though, will this still work when you have MARS installed?
I assume it should because MARS adds in its own commands and this changes the vanilla commands.

(----____JEFF____----)
Posts: 266
Joined: Sat, 20. May 06, 14:55

Post by (----____JEFF____----) » Wed, 25. Aug 10, 21:45

Jup it should work fine with MARS, or any other turret scripts out there for that matter ;) As long as you use the default turret commands ADAMS will replace them, but if you use other commands it won't do anything to them.

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Thu, 26. Aug 10, 00:02

Well, MARS also contains the Missile Defense Mk2 script, which substitutes several stock turret scripts. Especially the regular (and AI) missile defense, which is plagued by several bugs.

When 2 scripts argue about which one gets to overwrite the stock command, it's random which one is going to win.

But since you probably did fix the worst bugs in the MD section, it shouldn't be any worse.
It's not that hard to test. Fire 100 Hammers at an M2 and see if it survives. =)

Overwriting the stock commands is usually bad form but since mine didn't alter the rules of the scripts much, it seemed justified.

And you don't need an ALP for this at all (unless you want an off-switch). Just assign your script to the same command that AI ships use and it won't need any CPU time just to search for ships and start the script.
They'd do it automatically.


BTW: Yellow makes the first post pretty hard to read with a regular SubSilver layout.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

(----____JEFF____----)
Posts: 266
Joined: Sat, 20. May 06, 14:55

Post by (----____JEFF____----) » Thu, 26. Aug 10, 10:45

Overwriting the stock commands is usually bad form but since mine didn't alter the rules of the scripts much, it seemed justified.

And you don't need an ALP for this at all (unless you want an off-switch). Just assign your script to the same command that AI ships use and it won't need any CPU time just to search for ships and start the script.
They'd do it automatically.
Aren't these two statements contradicting each other? Or is there some other way besides an ALP to run my script on all ships, afaik that requires modifying stock scripts, but I could be wrong (at least back with X3R I decided to go for an ALP so users wouldn't have to worry about installing or removing, and back then you or someone else also said it's bad practice to overwrite stock scripts).

Well I don't know how or what you replaced in the stock turret commands, but if it has the same name as the default ones ADAMS will try to replace it (it looks for '!turret.missiledefense.std' on the stack of a ship, it also looks for '!turret.protect.std' and '!turret.killenemies.std'). So as long as your scripts carry those names ADAMS will try to replace them, if they don't it'll leave them alone.
btw, it's not completely random, it just depends on who's script finds the ship first and runs it's code on it ^^

Anyway I've been testing and Hammers don't seem to stand much of a chance, but flail barrages on the other hand are just too fast and too erratic to shoot down (at least in my tests so far). Can MARS cope with flail barrages with only its turrets?

btw, do you mind telling what bugs it has ^^ so far I've only noticed that it fires a lot less then my script does, but if there's anything else I should know that'd be nice :)

SubSilver layout? It's dark grey over here ^^ I'll have a look to see what layouts are there and if I can find a better suited color ;) Edit: Are there actually any different layouts or not? And if there are where would I find those?

Edit: ah I found the topic of your missile defense MK2 and there you describe most (if not all) of the issues of the stock missile defense ;) I'll have a look at your script to see how it works any how our scripts might conflict. I don't know if you gave people the option the turn missile defense MK2 off/not install it? because that might be the only way to prevent issues (giving people the option to use your or my script).

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Thu, 26. Aug 10, 16:07

(----____JEFF____----) wrote:Aren't these two statements contradicting each other? Or is there some other way besides an ALP to run my script on all ships, afaik that requires modifying stock scripts, but I could be wrong
The AI starts a COMMAND to start a turret script, not a literal script.
So it's sufficient to bend that pointer to a different script...
Once you wrap your head around it it will be terribly obvious.

Look at the MDMk2 setup script. That's all you need.
No ES scripts are overwritten.

Well I don't know how or what you replaced in the stock turret commands, but if it has the same name as the default ones ADAMS will try to replace it
Nope, different names, but the main script that actually does something is always the same.

Can MARS cope with flail barrages with only its turrets?
No script can (without cheating) because the target lead calculations are too far off.
It should get a sizeable chunk of them because it calculates the most likely candidates and doesn't waste bullets or tracking time on those it can't possibly hit ("in range" or not...) but the distance at which it can hit a given swarm missile is no greater than with any other script.

I don't even have real data about a Mk2 stress test because I just fixed the bugs and called it good. It was never supposed to get any smarter than that but instead provide a minimum of working missile defense with a minimum of CPU load.
It does that.

If you feel like it, you can run a contest on which one is the better catcher but I won't upgrade mine in any case. =P
Maybe I still have the MARS test script where I had 3 M7M (same distance but different directions) simultaneously go full auto on all turrets and fire 400 hammers at one M2.
The M2 had a 40 % chance to survive in this series of tests.
I don't think it would survive at all with just the Mk2 script but how many it gets before that would still be a result...

Any defense can be overwhelmed. If not, then it probably cheats. =P

SubSilver layout? It's dark grey over here ^^ I'll have a look to see what layouts are there and if I can find a better suited color ;)
It's a PHP forum and SubSilver is one of the selectable schemes. Somewhere in the forum profile.
It's really only white and yellow that are difficult to read on any kind of light background.

I find black on white far easier for reading large amounts of text. Call me old fashioned...

I don't know if you gave people the option the turn missile defense MK2 off/not install it?
Delete or rename the setup script. Script uninstalled.
Life can be so simple. =)

The Mk2 script also supplies a live zero signal so other scripts can check if it has been loaded/installed right now.
This prevents false positives when detecting old bits and pieces like global variables.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

(----____JEFF____----)
Posts: 266
Joined: Sat, 20. May 06, 14:55

Post by (----____JEFF____----) » Thu, 26. Aug 10, 21:15

Ok I found the layouts, just a single line dropdown menu, completely overlooked it before xD Anyway this blue should be easily readable on both the X2 layout (black/dark-grey) and the subSilver one ;)

Maybe I'll do that Gazz, revert my script from AL back to a pointer system ;) Though for testing I like how easy it is to turn off atm ^^ Though building in a switch to turn it on and off shouldn't be too much work.

I'd sure like to give that test script a try ^^ Just to see if the missile defense network in ADAMS actually has as big an impact as I hope it does ^^ Maybe I'll substitute the M2 with a smaller ship + a few fighters, that's the environment ADAMS likes more then single ship combat ;)
Anyway good to hear that it's not my script's fault it can't hit those flail missiles, though I wonder how AoE weapons and Kyons fare against flails, I guess they'll work pretty good but I'll have to test that ^^

Anyway I've had a look at your MK2 script and though I find it a bit complicated to read (with all the gosub's xD) I did get some ideas for optimizations ;) and because I've looked at my code again I found room for some small optimizations and found some small bugs (or better, parts that didn't quite work as I wanted them to ^^).

Edit: wow I thought adams was good but after the latest changes it's phenomenal (or I just found the test that brings the best forward ^^). The test I ran started out with 3 minotaurs on my side blasting away with Hammers (they were using stock scripts, so no ridiculous fire rates from them), against 1 pirate centaur and 5 eclipses. The first test I did without adams, the centaur got smoked before it fired a single shot (it ran attack all on its turrets) and the eclipses were easily taken care of after focusing on each individual (they ran missile defense so were a bit harder to shoot down, but once the first one went down the other 4 were dead rather fast as well).
Next I ran the same test with adams turned on, same turret commands. The centaur totally steamrolled the minotaurs! The only damage it got was when the eclipses fell behind a bit and a missile got through, but remember its not running missile defense, if it sees anything else then a missile it'll target that.
After that I spawned 3 more minotaurs and finally one managed to destroy the centaur (though it was a hammer almost at point blank range, if the centaur actively flew around it probably would've survived longer), but the 4 fighters that were left pretty much destroyed the minotaurs (1 fighter got lost due to it flying pretty much into a hammer launch pod xD) 1 minotaur was left in the end, but it ran out of missiles and the 4 eclipses were still happily sitting around (with no hull or shield damage at all).

So in short, with ADAMS, don't leave your M7Ms unattended because you might get a nasty surprise when you check up on it again ^^
Though I should test it with flails as well for a more realistic result. Maybe a test with khaak ships, to see how kyons fare against flails.

Edit 2: Well I ran a test with a khaak destroyer and 5 eclipses vs 3 minotaurs spamming flails. The destroyer ran missile defense in both cases.
The default scripts failed utterly, though the destroyer held out quite long that was probably mostly due to the little amount of damage each individual missile does. It didn't manage to even scratch one of my minotaurs.

After that I did the same test with ADAMS enabled and the results were quite different indeed. It seems kyons make great anti flail weapons as a lot of them got shot down before reaching their target. Eventually the destroyer managed to destroy 2 minotaurs and that's where I ended the test as an invincible nova joined the fray (where the hell did it come from?!), but even with this partial test you can see ADAMS can do very well with the right equipment ^^
The eclipses are not worth mentioning, all got destroyed in a blink of an eye in both cases.

(----____JEFF____----)
Posts: 266
Joined: Sat, 20. May 06, 14:55

Post by (----____JEFF____----) » Sat, 4. Sep 10, 15:29

Ok guys I've updated ADAMS ;) Though you probably won't notice much of a difference, from a performance perspective it should be a lot better now.
For updating on a game with ADAMS already installed you shouldn't have to do anything special. Just install the files and the game should tell you it's updated to a new version.

As for compatibility, it should run fine with Gazz's missile defense MK2 (well it disables it so if you don't want that don't install this script). If for some reason it doesn't (you can check by giving turrets one of the commands ADAMS replaces and if it doesn't show any ADAMS command after giving it probably something went wrong xD) you can try turning off and on the plugin from the AL menu, then test again. Since I don't have Gazz's missile defense installed here I don't know 100% sure it's compatible, but I did look at his script and turning my plugin off and on should overwrite his.

btw, you have to jump to a new sector to update non player controlled ships. So while turning the plugin on and off is sufficient for player ships for any others you need to jump to another sector (it's the jump that matters not where to) or save and reload if you don't want to jump for whatever reason. So for most players they probably don't have to do anything special except continue playing (I mean you'll jump sooner or later and any new ships entering the sector are up to date, so waiting a while would also update most ships).

I'm planning on updating the other default turret commands as well, not with new features but just to improve them (for example 'missiles only' to use just the missile shoot down capabilities of ADAMS ITT), though personally I don't know why you would even consider any other commands as the current commands cover pretty much everything.

(----____JEFF____----)
Posts: 266
Joined: Sat, 20. May 06, 14:55

Post by (----____JEFF____----) » Wed, 8. Sep 10, 00:06

*yeeey* another update (hopefully the last one for a while), squashed some bugs that slipped in with all the optimizing and increased the rate of fire + burst fire against missiles in missile defense mode.

User avatar
Greetmir
Posts: 43
Joined: Sat, 28. Aug 10, 17:11

Wow this looks good !

Post by Greetmir » Fri, 15. Oct 10, 01:29

I am gonna try this for SURE! Say maybe my Panther with turrets ...

6F ISR (Newly un-nerfed in CMODv4.1)
2R ISR (Newly un-nerfed in CMODv4.1)
4B PRG (with lovely 4 km reach and high speed)
2L ISR (Newly un-nerfed in CMODv4.1)
4U PRG (with lovely 4 km reach and high speed)
4D PRG (with lovely 4 km reach and high speed)

Maybe I will even chuck in all the mosquitoes it can carry and fire up MDM TOO !

What an anti-missile boat THAT would be !!!

It is something to do with my spare billion credits.

ROFL

There is NO such thing as overkill !

me
59 is just a number.

User avatar
TrixX
Posts: 2020
Joined: Wed, 18. Aug 10, 14:28

Post by TrixX » Fri, 15. Oct 10, 02:11

Jeff can you stick version numbers on the file, it gets a little hard working out which one it is when you have 6 of the same name file ;)
"If you’re not prepared to be wrong, you’ll never come up with anything original."
Sir Ken Robinson

rusky
Posts: 357
Joined: Sun, 4. Jan 09, 18:17

Post by rusky » Sun, 17. Oct 10, 23:39

Having an issue, for some reason, my Missile Defence turrets sometimes fire at my own missiles :o
They appear hostile on radar, so i guess that's why, but it's the very missile i just launched.

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Mon, 18. Oct 10, 15:31

Well, technically there is a chance for your own missiles to be harmful to you but the missile defense script was probably just bored.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

qwizzie
Posts: 533
Joined: Thu, 1. Jun 06, 12:17

Post by qwizzie » Sat, 30. Oct 10, 20:21

the missile defence script is extremely bored with mine then coz its shoots down every single missile i fire at an enemy contact with missile defence on.
i first thought it had something to do with the mods and/or scripts i was using but i recently re-installed to x3 tc 3.0 with only the transcent II mod and three scripts (ADAMS ITT latest version, Marine Repairs and Ship Hijacker) and exactly the same thing happened.

There is something ''fishy'' with the missile defence script.

Jeff, can you pls look into it?

Mad_CatMk2
Posts: 517
Joined: Sun, 22. Feb 09, 21:13

Post by Mad_CatMk2 » Tue, 2. Nov 10, 01:19

qwizzie wrote:the missile defence script is extremely bored with mine then coz its shoots down every single missile i fire at an enemy contact with missile defence on.
i first thought it had something to do with the mods and/or scripts i was using but i recently re-installed to x3 tc 3.0 with only the transcent II mod and three scripts (ADAMS ITT latest version, Marine Repairs and Ship Hijacker) and exactly the same thing happened.

There is something ''fishy'' with the missile defence script.

Jeff, can you pls look into it?
I think when you launch a missile towards a friendly unit ITT treats it as as hostile missile and shoots it down. I stumbled upon this when I was launching missiles towards friendly Teladi ships yesterday...

Shall test this a bit more myself though.
I fly an OWP. What about you?

Post Reply

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