[SCR] Smart Turrets v4.7.2 (AP, 05-04-14), v2.6 (TC, 21-08-13)

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

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

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

If there's only 1 drone no turret will shoot more than 2 guns at it, however if there are loads of drones around the turret should use all available guns.

It might be that the lasers configured for the turret aren't qualifying for antimissile. Do the lasers you expect to qualify meet the stats I pasted earlier? Is the DPSCache delay listed for that laser <= 650?

Seems to be working ok at least on my ocelot.
garrry34
Posts: 911
Joined: Sun, 17. Jul 05, 14:43
x3tc

Post by garrry34 »

it sticks to only using 2 per turret and this is my beloved PALC, whether its a swarm of drones or missiles it only ever uses a max of 2 lasers a turret, I had a theory this was due to the turrets not being fill out but with your latest update the problem still persists, thank you for the update I was well chuffed...
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Does the DPS cache for PALC show the right delay (approximately 333ms on xrm)?

Modifying TLasers (e.g your training laser) number of entries causes a DPS cache reset when Smart loads. All entries will have no samples and no lasers will qualify for antimissile. If your save game is from a recent time when adding your training laser it may be that the cache has been reset and hasn't been trained up. This could be confirmed by looking in the cache.

Maybe modifying TLasers might have found a bug in Smart's game data modification detection logic and maybe the cache values relate to the wrong lasers or something. As you've been a long time user the cache data has been upgraded over multiple releases, its possible there might have been a bug in some version upgrade logic... A good clear out might be in order as follows.

Something to try:
1. Uninstall Smart via the menu
2. Save game to spare slot and reload
3. Reactivate Smart on your turrets and mainguns and run training.
4. Now spawn some drones and recheck.

Just to confirm, when you say using 2 per turret, is it that visually you see only 2 simultaneous PALC beams coming from the turret, or is it that in the ship gun list you observe the 2 guns?

Are the lasers shooting the same target or splitting between different ones, when multiple targets are available? Focusing on the same target when many are available tends to suggest the PALC is not being selected as an antimissile laser, splitting between targets tends to confirm antimissile is in effect but there's indeed a problem with the algorithm in the script version running on those turrets making it not use all the guns (not happening for me with 2.0 on ocelot).

For example in my case with the ocelot rear turret with 3 guns, I see 3 PALC beams simultaneously firing at 3 separate targets. With Fill Turrets disabled, the ship guns will only show 1 laser installed of an arbitrary type in that turret. With the setting enabled, it'll show 3 lasers of an arbitrary type.

We can take a look into logging if this doesn't narrow it down...
garrry34
Posts: 911
Joined: Sun, 17. Jul 05, 14:43
x3tc

Post by garrry34 »

its a brand new game as I upgraded XRM to the latest version, I have tested it with another ship and it works fine, seems to be just the angelwing, at this point my theory is that it is something to do with the fact I have the laser count per turret set to 3 when it should only be 2, remember back when you asked about the 16 broadside...

...I'll do a test or 2 on the model and post you with an update...
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
garrry34
Posts: 911
Joined: Sun, 17. Jul 05, 14:43
x3tc

Post by garrry34 »

yes that was the problem increasing the laser count was the problem...
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Edit: Only read your reply after posting this. But the diagnostic info still may come in handy nevertheless.

You can get some relevant diagnostic info out of Smart as follows:

1. Clear Smart on all turrets and main guns.
2. Go to the laser settings -> disallowed lasers menu and push Apply (will trigger laser cache update traces in 4.)
3. Go to the global settings, set logging level to 6 or greater, enable debug mode and Apply
4. Enable Smart on one turret (one with a problem)
5. Wait a few moments then go back into global settings and disable debug mode (you don't want to leave that on as it'll harm performance)

This will generate a log09050.txt file in your Documents\Egosoft\X3TC folder containing some useful info:

1. The qualifying antimissile lasers for that turret available in cargobay, e.g.:

Code: Select all

[10187 6    Ship.Local  ]  Lasers.AntiMissile.ByDelay.Ascending: F=ARRAY ( Phased Array Laser Cannon ), U=ARRAY ( Phased Array Laser Cannon )
2. How many guns Smart's global ship cache thinks the turret has

Code: Select all

[10157 6    Turret      ]  IsMissileTurret=null, $MaxGunsInTurrets=3
Compare Smart's guns in turret number with the one in brackets in the game ship info compatible laser page for that turret and see if they differ. If they differ it might mean that Smart's init code hasn't detected the game data change and rebuilt its cache.
garrry34
Posts: 911
Joined: Sun, 17. Jul 05, 14:43
x3tc

Post by garrry34 »

yeah the numbers don't match up, I'll swap her back to the 2 per turret as the test proved it worked perfectly...

...Do you want a copy of that log file?
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Thanks. The log confirms the problem as described: 9 guns available in the turret, 2 guns only being shot during antimissile.

You say this is completely fixed by editing your ships data?

I have a theory that fits the tracing and seems a good fit for what you said about gun numbers:

Smart shoots the first 2 guns, then loads a laser into gun 3. It loops through the missiles invoking 'is $Missile in firing range of turret $TurretId' and gets [FALSE] back in all cases, which is why the log data shows antimissile exists after only 2 shots.

That might conceivably happen if gun 3 was somehow bugged and not registering that there's a gun installed in it.
garrry34
Posts: 911
Joined: Sun, 17. Jul 05, 14:43
x3tc

Post by garrry34 »

see in the dummy and component files, the turrets only have 2 point in which to install lasers but when you asked for an increase I increased from 2 up to 4 as your requested, so on my ship I jumped to 3 from 2 thinking whats the harm, as technically the turret worked perfectly as a collective. In short yes it definitely fixed the problem by dropping down to two, I do have the option of swapping in a 3 gun turret but they are so much more bigger than the 2 gun turret and I don't want my ship looking like turrets with a ship attached...
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
abinas
Posts: 32
Joined: Sun, 28. Aug 11, 00:07

Post by abinas »

Is there a way to stop my forward firing cannon from hopping over to one of the side mounts?

I am using a Pirate Brigantine and when I get into a fight nearly all of my weapons stop working along with the mount hopping cannon.

am I doing something wrong? I tried turning on the fill turret thing but it had no effect on guns shutting off :cry:
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

It sounds like something is wrong certainly but I need to understand the problem better before I could conclude anything.

First off I'd suggest never enabling the fill turret option unless you have enough lasers of every type in the cargobay to fill every turret with.

The Smart turret script will switch lasers in and out as needed in each turret depending on what they're shooting at. Do you maybe only have a limited amount of lasers of that type (IBL, PPC) and the side turrets use them all up so there's nothing available for the front turret?

For example say you have an XRM Brigantine with 4 IBL you like to use on the front and 8 PPC on each side. Smart might decide to use those 4 IBL on the side turret and since the front turret doesn't support PPC it can't swap anything instead.

To solve that you need to make sure there's enough IBL to service all the turrets that are likely to want it. Most likely a side + front turret will want to shoot it at once so that'd be 12 of them. Even better get 20 IBL and there'll be plenty for all.

Or as a last resort you could disable Smart on the front, mount the 4 IBL and use standard 'attack my target' or similar instead, saving on cargo space and ringfencing the IBL away from Smart.
garrry34
Posts: 911
Joined: Sun, 17. Jul 05, 14:43
x3tc

Post by garrry34 »

Shimrod I was thinking of a possible feature to add to smart at a later point, kind of like mars has station defense, maybe only for in wings, could you impliment a friend fire safety, where if a friendly ship within the wing is between the turret and its target it will not fire?
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
abinas
Posts: 32
Joined: Sun, 28. Aug 11, 00:07

Post by abinas »

My ship is fully loaded, the loadout is

4 front gauss
8 right Photon pulse
8 left Photon pulse
6 back flack
8 upper flack
8 lower flack

no missiles at the moment, sorry for not including my loadout in previous post.

I will try using non smart script on front guns and see how that works :)
abinas
Posts: 32
Joined: Sun, 28. Aug 11, 00:07

Post by abinas »

Ok I tried several near suicidal test attacks and your suggestion of setting front cannon to non smart setting worked perfectly, all turrets remained active and none hopped their mounts. thank you :)
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Glad that helped. I'm wondering there's a way to handle this in the script. Some options spring to mind:

1. Perhaps an ability to disable laser switching on a per turret basis via the Smart menu. That way it can still offer an improvement over vanilla scripts in terms of targetting.

2. Ability to ban lasers from selection on a per turret basis. Allows retaining switching while ringfencing lasers for other turrets.

3. When selecting a laser multiply how many are available to the turret to find actual best DPS. This would avoid a case were 4 IBL are swapped in instead of 8 PPC.

Option 1 is attractive in that there's a broader market for folks who don't want laser switching, and a global setting counterpart could be added once the code is in place. Downside, as with option 2, is that this requires manual intervention.

Option 3 should avoid this situation automatically (8 PPC > 4 IBL), but it may be expensive performance wise. For example instead of popping the best dps laser off the top of a cached list, it'd need to walk the list and calculate the DPS multiple for each gun. Additionally since 'get true amount of ware' is bugged the only way to count lasers is to try and install as many as possible then examine what's in the turret slots!

Not sure really. Option 3 is attractive as it makes it more intelligent, however it won't solve the general case where you simply want to ringfence lasers. Some combination of all the options seems prudent. Also if the 4 IBL were (for argument sake) of longer range than the 8 PPC, they'd still end up being used in the side turret till enemies came in range of the PPC.

I'll have to mull it over as its a lot of work, and I want to avoid introducing complexity in the interface. Does anyone else have similar problems with low laser availability?
DarthVain
Posts: 845
Joined: Mon, 2. Jun 03, 11:53
x3tc

Re: [SCR] Smart Turrets v2.0 (11-Sept-11)

Post by DarthVain »

Shimrod wrote:

Code: Select all

Textfile                 : 9050
Combat Commands          : 353  (COMMAND_TYPE_FIGHT_53)
Wing Combat Commands     : 353  (COMMAND_WING_TYPE_FIGHT_53)
Ship Additional Commands : 1259 (COMMAND_TYPE_SHIP_59)
Station Commands         : 1146 (COMMAND_TYPE_STATION_46)
Turret Commands          : 952  (COMMAND_TYPE_TURRET_52)
Turret Commands          : 953  (COMMAND_TYPE_TURRET_53)
Turret Commands          : 954  (COMMAND_TYPE_TURRET_54)
Task IDs                 : 9050-9070
Logfile                  : 9050
Just wondering if Combat Commands and Wing Combat Commands are meant to have the same code 353
Another one bites the dust!!

DarthVain
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Yes. Wing and ship commands are in distinct page elements in the XML and generally share the same IDs.
http://forum.egosoft.com/viewtopic.php? ... 97#2695497
http://forum.egosoft.com/viewtopic.php? ... 96#2576596
abinas
Posts: 32
Joined: Sun, 28. Aug 11, 00:07

Post by abinas »

Is there a simple way to disable the turret switching ? I am flying a tern and keep getting killed because it wont leave my guns in place. I tried doing the earlier fix of turning some guns to non smart setting but it isn't working on this ship. please don't take this as a gripe I am just curious if it is possible :)

Another thing I would love to see is a cease fire fire setting in the smart menus so the turrets can be stopped quickly, those pilots take sooo long telling me that they are going to eject rather than just doing it (kinda like carving arrrgghhh in the stone) and it has cost me a lot of prizes :wink:
HotSake
Posts: 472
Joined: Sun, 3. Jan 10, 22:15
x3tc

Post by HotSake »

How is the weapon switching getting you killed? Are Smart turrets grabbing the guns you want and "wasting" them on low priority targets? What exactly is the problem behavior(s)?
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

Why, when you're looking for a script that mainly does it's job through laser switching... then obviously the first thing you want to do is to disable that feature. =P

X may be designed for ships to switch weapons (AI ships do just that), this script may be designed to do it... and the question will still come up every week or two. *shrug*
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.

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