[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: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
dizzy
Posts: 1019
Joined: Sun, 26. Sep 10, 06:00
x4

Post by dizzy » Tue, 9. Dec 14, 01:02

Good point. I think Xtended team hacked a number of built-in turret scripts (missile defence for sure which is what I'm using now, likely missile only and protect ship too) to trigger ECM when ready. There is a single ECM device and a single ECM counter for the entire ship. Good point about keeping one turret with a Missile Defence just for ECM purposes, I'll try that out and see how it works.

Sorry if this has been asked before but since you mentioned: when deciding what laser to set on turrets meant to be good anti-missile, what criteria should I use? Speed only? PAC would be the fastest, followed by PBE and so on, the PBE at least can do decent damage to M5/M4 while the PAC is mostly useless outside of anti-missile purposes.

But for turrets that can sport Alpha/Beta Flaks (which I usually set to Missile Defence) do I need a PAC/PBE besides just the Flak? I think the Flaks are good enough against missiles so I wouldn't sacrifice the second slot of that turret for another good anti-missile laser, I'd instead use an anti-fighter (HEPT & co) laser.

Thanks!

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

Post by Shimrod » Tue, 9. Dec 14, 02:20

A turret's lasers qualify for antimissile duty based on the following criteria.

Code: Select all

414   || $Laser = $CacheSensitive.Delay.Ascending [ $idx ] 
415   || gosub CheckWeapon : 
416   || if $AllowWeapon 
417   ||| * Antimissile: 
418   ||| * - By Delay Ascending 
419   ||| * - Speed gt 650 
420   ||| * - Range lt 5000 
421   ||| * - Delay lt 650 
422   ||| * - At least 1 DPSCache sample 
423   ||| * - At least 1 hull dmg 
424 @ ||| $Delay = [THIS] -> call script 'glen.turret.smart.cache.dps' : Option = 0 Laser = $Laser Sample = null 
425 @ ||| $Samples = [THIS] -> call script 'glen.turret.smart.cache.dps' : Option = 4 Laser = $Laser Sample = null 
426   ||| $Range = get range of laser $Laser 
427   ||| $Speed = get bullet speed of laser $Laser 
428   ||| $HullDmg = get hull damage of laser $Laser 
429   |||
430   ||| if $Samples AND $Delay <= 650 AND $Speed >= 650 AND $Range <= 5000 AND $HullDmg 
431   |||| if $Range > $Longest.AntiMissile 
432   ||||| $Longest.AntiMissile = $Range 
433   ||||| $Lasers.Transient [ 1 ] = $Laser 
434   |||| end 
435   |||| append $Laser to array $Transient.AntiMissile 
436   ||| end
Lasers with lowest refire delay are most preferred, if they have sufficient range. So IRE, PBE, MD likely most preferred, though I don't recall refire delays on XTC. Do be sure to run the training command when new lasers are available, so Smart can sample their refire delays.

If no lasers qualify for antimissile then the special antimissile mode doesn't trigger. Instead missiles are prioritized by that turret against all other targets, and the turret will only shoot the missile if it's highest priority. It won't use the multi-gun spliting feature in this case.

In my experience flak aren't great for anti missile as they don't fire rapidly enough to take out barrages.

In my case I tend to mod my game so that all lasers have 1 volume. This lets me ship every laser combination possible and provides better light shows during combat. I don't need to worry about tradeoffs or sacrificing jump energy and ammo space. I've yet to encounter a downside.

Smart traces out the sorted laser arrays at log level 6 (glen.turret.smart.cache.ship.local: Recache). Here you can see what lasers have been put into each category. Poking something in the DPS cache and restarting the turret script might trigger a recache, I don't recall exactly how to force one.

karabAs
Posts: 97
Joined: Sun, 7. Dec 03, 01:58
x3tc

Post by karabAs » Sun, 11. Jan 15, 15:38

@Shimrod:

Could you please make this excellent script fully compatible with Litcube's Universe?
It works but conflicts with LUV colour names (1259 - I did try to change this ID# in "t" file to 1260 and 1261, but no luck...).

Thanks!

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

Post by Shimrod » Sun, 11. Jan 15, 21:43

Smart reserves ship additional command code 1259 in the community library thread:

Code: Select all

<t id="1259">COMMAND_TYPE_SHIP_59</t> : Main Guns - Smart Turrets by Shimrod
http://forum.egosoft.com/viewtopic.php?t=216690

The right approach would be for the conflicting component to respect those reservations and use a non conflicting command code. 1227, 1253 and 1257 look free.

To make a local workaround, the references in the scripts also need updated to point to the renumbered command.

Code: Select all

190    set script command upgrade : command = [GLEN_SMART_MAINGUNS] upgrade = $RequiredWare script = 'glen.turret.smart.check'

200    global script map : set : key = [GLEN_SMART_MAINGUNS] , class = [Ship] , race = [Player] , script = 'glen.turret.smart.mainguns' , prio = 0 
(setup.glen.smart.turret)

Code: Select all

032    set script command : [GLEN_SMART_MAINGUNS]
(glen.turret.smart.mainguns)

karabAs
Posts: 97
Joined: Sun, 7. Dec 03, 01:58
x3tc

Post by karabAs » Sun, 11. Jan 15, 21:51

Yep, you right :roll:

Anyway, thanks for the tip, I'll try it out.


Edit: works like a charm. Much better now. Thank you :wink:

RayF
Posts: 454
Joined: Wed, 22. May 13, 12:30

Post by RayF » Mon, 23. Feb 15, 09:55

hey guys,

is there any turret command that will keep shields down during boarding ops with marines?
any trick?

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

Post by Shimrod » Mon, 23. Feb 15, 10:37

Yes, in the AP version of Smart set the turrets to Smart Capture. On boardable ships this will strip shields, on non boardable it'll try and make them bail.

RayF
Posts: 454
Joined: Wed, 22. May 13, 12:30

Post by RayF » Mon, 23. Feb 15, 13:09

many thanks shimrod,
however, I did that,

but the turrets pause for a long time and the shield goes up again and I lose connection (SOS in xrm)

is there some trick I can do to keep the shields at around 0% ?

my settings for turrets are Smart capture.
smart is disabled on main guns.

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

Post by Shimrod » Mon, 23. Feb 15, 13:54

I tested vanilla with a hyperion vs Xenon Atmospheric Lifter and Smart keeps the shield at 3%. IIRC shields must be below 10% for boarding.

I can't speak for xrm/sos, just be sure there are small enough lasers available so Smart can chip away at the shields. If only powerful guns are available it won't shoot them if the shot could penetrate to hull.

RayF
Posts: 454
Joined: Wed, 22. May 13, 12:30

Post by RayF » Mon, 23. Feb 15, 16:54

Shimrod wrote:I tested vanilla with a hyperion vs Xenon Atmospheric Lifter and Smart keeps the shield at 3%. IIRC shields must be below 10% for boarding.

I can't speak for xrm/sos, just be sure there are small enough lasers available so Smart can chip away at the shields. If only powerful guns are available it won't shoot them if the shot could penetrate to hull.


"If only powerful guns are available it won't shoot them if the shot could penetrate to hull"

that might have been the problem. Still missing guns from the ship since i am just beginning a new game..will try to buy some pacs/hepts..

SickArgon
Posts: 29
Joined: Sat, 18. May 13, 12:49
x3ap

Post by SickArgon » Tue, 24. Feb 15, 02:10

Shimrod wrote: ...
The right approach would be for the conflicting component to respect those reservations and use a non conflicting command code. 1227, 1253 and 1257 look free.

To make a local workaround, the references in the scripts also need updated to point to the renumbered command.

...
Yours is one excellent script dear Sir!
Used it all the time playing AP. Many thanks to you.

Now though in Litcube Universe there are some hickups.

Since I'm exactly zero in scripting, my only hope now is (he-he, I sound kind of like princess Lea here) that you post a working version.
Could you find it in yourself to do this? :wink:

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

Post by Shimrod » Tue, 24. Feb 15, 11:29

If the problem is LU using command IDs reserved by other scripts, one option would be to bring the issue to their attention.

If I play X again someday and try out LU I might reconsider but for now I've little incentive to expend my own free time working around what is apparently a 3rd party issue.

SickArgon
Posts: 29
Joined: Sat, 18. May 13, 12:49
x3ap

Post by SickArgon » Tue, 24. Feb 15, 13:55

Tnx for your skript anyway!

RayF
Posts: 454
Joined: Wed, 22. May 13, 12:30

Post by RayF » Tue, 24. Feb 15, 20:51

Shimrod,

one quick question if i may,

I have a wing of m6s with turret command at offense.
If i issue a wing command "shield attack..." what will happen?

will turrets follow the shield attack or will they continue firing until they blow the ship up?

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

Post by Shimrod » Tue, 24. Feb 15, 20:59

I'd expect that wing command to issue move/attack orders to the ships but I doubt it'd override the turret commands.

What you might want to do is go into the Wing Command Console, Combat -> Smart -> Broadcast Command -> Smart Capture / Scope Wing. This should replace all Smart Turret commands on the wing ships.

I don't know how subtle the wing's attack shields command would be, but I expect the main guns attacks won't coordinate will annihilate the target. Shield suppression is probably best left to turrets only via Smart Capture.

RayF
Posts: 454
Joined: Wed, 22. May 13, 12:30

Post by RayF » Tue, 24. Feb 15, 21:06

Will try that!!!
one more,
how about the main guns?
will this "Wing Command Console, Combat -> Smart -> Broadcast Command -> Smart Capture / Scope Wing" take care of the main guns ans set to capture?? (smart is enabled on main guns too in every ship)

thanks for the superfast reply!!!!!!

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

Post by Shimrod » Tue, 24. Feb 15, 21:13

Smart's main guns command only switches lasers, it doesn't fire them itself. The firing is done by the ship's command script (fly straight at them firing guns, fly away, repeat).

The ships commands are not part of Smart and won't coordinate their damage output with Smart Turrets commands. How well the ships will coordinate with each other I can't say, never looked at this wing shield attack script.

For info Smart uses a cache stored on the target ship used to record every shot fired by Smart along with an estimated bullet useful lifetime. This is used to estimate the amount of hull and shield damage 'in flight', and Smart Turrets on all attacking ships coordinate using the same cache and fine tune their damage output (selected laser, number of guns fired) to avoid impacting the hull.

I doubt stock scripts will do anything as sophisticated. They probably just stop firing when shields are 0%, ignoring how many bullets are in flight.

redagent
Posts: 41
Joined: Fri, 20. Feb 15, 05:29

Post by redagent » Wed, 25. Feb 15, 19:31

Shimrod, thank you very much for this script!!! Briliant work!

Just tested Smart 4.7.2 in X3:AP 3.1 - It is one of the best scripts I ever met. And I met and tested about 100 scripts in all X2-X3-games.
This one has no glicthes, no troubles, no questions, including all functions I could imagine for turrets use - Just put all other turret-scripts on their knees!

The only thing I dream for the complete X3 combat package - is a friendship of Smart turrets with Weapon loadout hotkey-function. At this moment I use Bombardier, but it can not save smart turrets in configurations (I know that its a bombardier's issue).
So when I need to use some individual type of weapon in particular turret - I switch to this config with hotkey and have to manualy choose Smart Turret Custom Order for my turrets.
At least it would be good if Smart turrets Custom command could be activated by one hotkey.

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

Post by Shimrod » Wed, 25. Feb 15, 21:08

Thanks, it certainly gives MARS a run for its money.

I haven't tried Bombardier before, sounds odd that it can't save turret loadouts with Smart, especially if laser switching is disabled on the active Smart command.

You can disable laser switching on all of the Smart configurations via Combat -> Smart -> Turret Command Profiles. This is probably the best option if manually switching weapon configs.

There is a hotkey for cycling between Smart commands. You could also customize all turret command profiles to do exactly the same thing, so the hotkey always produces a predictable configuration. However the hotkey only affects turrets with Smart already enabled on them.

Sounds like what you need is a set of hotkeys for applying Smart <cmd> to all turrets on the playership. Assuming disabling laser switching on all profiles doesn't resolve the bombardier problem.

Actually there's an argument to say that would be best done as a standalone script. A single setup script which tests for presence of MARS, Smart, vanilla scripts and registers hotkeys accordingly. Should be straightforward to code that.

However I'm unlikely to be doing any development on this in the near term, particularly not now that Homeworld Remastered has been released!

redagent
Posts: 41
Joined: Fri, 20. Feb 15, 05:29

Post by redagent » Thu, 26. Feb 15, 16:59

Shimrod wrote:I haven't tried Bombardier before, sounds odd that it can't save turret loadouts with Smart, especially if laser switching is disabled on the active Smart command.

Bombardier CAN save any LOADOUTS. And it CAN save turret COMMANDS only which it KNOWS or "none" commands. So it can save vanilla commands or the one modified - vudu.turret.attack.my.target (Link to russia/direct download), which I used for ages.

If you trying to save any other commands - you will have "none" commands, when load this profile. I have tested it with MARS and Smart Turrets. Thats why I need hotkey to activate Smart Turrets.

So I could load desired Bombardier profile, then turn on the Smart for all turrets with hotkey, and then cycle Smart commands if needed.
The point is to start with Custom command set to "No Switching Lasers" and then proceed to "switching lasers" Smart configurations if needed.

At present after swithing loadouts I have to make a lot of actions: "open ship command console LIST to turret control - enter - LIST to Smart commands - find Smart Custom (without switching lasers) - enter." Two key-pressing and two listing actions. Too much during the fight.
Shimrod wrote: You can disable laser switching on all of the Smart configurations via Combat -> Smart -> Turret Command Profiles. This is probably the best option if manually switching weapon configs.


Yes it could be a decision - but only if I save all bombardiers profiles with NONE command for ALL turrets. Then activate Smart Turrets to Custom or w/o switching lasers. After that I can switch to any loadout without loosing Smart in turrets.

Actually I like Smart switching - it is perfect. But sometimes I need specific loadout. Mostly for concentrated fire from capital big guns with turret set to command "My target only" and forecasting tracking of this target. It vastly helps to kill enemy capital ships faster.
Shimrod wrote:There is a hotkey for cycling between Smart commands. You could also customize all turret command profiles to do exactly the same thing, so the hotkey always produces a predictable configuration. However the hotkey only affects turrets with Smart already enabled on them.
That's why I need second hotkey to enable Smart turrets.
Or make Bombardier to be able to remember Smart in profiles.
Or ability to activate Smart Custom Command in all turrets whit "None" command pressing "Cycle" key if they are present on my ship. And next press makes them equal to other turrets with active Smart if they were on my ship.
Shimrod wrote:Sounds like what you need is a set of hotkeys for applying Smart <cmd> to all turrets on the playership. Assuming disabling laser switching on all profiles doesn't resolve the bombardier problem.


Yes indeed!!!
At least one key to enable Custom, and then I can switch them with "Cycle" hotkey.
Shimrod wrote:Actually there's an argument to say that would be best done as a standalone script. A single setup script which tests for presence of MARS, Smart, vanilla scripts and registers hotkeys accordingly. Should be straightforward to code that.


Do it! Please-please-please! It would be great!
Shimrod wrote:However I'm unlikely to be doing any development on this in the near term, particularly not now that Homeworld Remastered has been released!
Yeah! Homeworld is a Classic and Relic.

Well if you accidently will have time and mood to do it - at least you could make just one hotkey to activate Smart Custom in all turrets.
It would make Smart compatible with most of the other weapon loadout scripts.
Last edited by redagent on Thu, 19. Mar 15, 01:09, edited 4 times in total.

Post Reply

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