[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
hourheroyes
Posts: 346
Joined: Mon, 9. Apr 12, 05:14
x4

Post by hourheroyes » Mon, 24. Mar 14, 23:07

I hit the boarding pod issue last night--fortunately the target's shields were too high or I would've sent 20 good marines to their deaths

Barleyman
Posts: 127
Joined: Sun, 16. Apr 06, 00:52
x3

Post by Barleyman » Tue, 25. Mar 14, 10:28

That still leaves hammer torpedos and tomahawks. Right now they're dead easy to pop.

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

Post by Shimrod » Tue, 25. Mar 14, 14:12

It might be possible to implement missile strafing through script, but I think it's outside the scope of Smart and probably best linked to a ware upgrade like missile evasion software.

While excluding boarding pods I came across a mothballed copy of Smart with a fairly sophisticated countermissile system, am looking at resurrecting it:
- Countermissiles fired from ship and from missile turrets
- Any ship could intercept missiles incoming to all that races ships
- Calculates longer range intercept point based on speed and range of the countermissile vs speed and range of the incoming missile.

If we allow for longer range countermissiles, these could intercept barrages real far away, greatly reducing the risk of any reaching the player as there'd be plenty of time to launch more countermissiles. Though as it stands the code just uses the standard 'get best missile for target' script that pretty much just returns mosquitoes.

Barleyman
Posts: 127
Joined: Sun, 16. Apr 06, 00:52
x3

Post by Barleyman » Tue, 25. Mar 14, 17:04

Not firing boarding pods is good, what about missile turrets holding fire with capture status?

WRT strafing, I've observed difficulty turrets and main guns have hitting swarm missiles even with the gentle rolling movement. I have no idea if it would be easy to duplicate.

My shiny new Cobra also demonstrated vanilla missiles and torpedoes are fairly limp against smart turret NPC capitals.

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

Post by Shimrod » Tue, 25. Mar 14, 17:45

Yes I plan to have the missile turrets hold fire too, except for countermissile activity.

What you might be seeing with missing bullets missing or not destroying missiles is some combination of:
- Inaccuracy built into that laser
- Reduced size of hit box on the missile
- Missile hitpoints
- Spiral motion defeating the game's target leading logic, like when turrets shoot an undocking khaak cluster that is spiralling and end up shooting far wide.

All Smart does is tell the turret X to shoot at target Y, it doesn't have control over accuracy or target lead prediction.

I haven't had an M7M for a long time but I'll get plenty of exposure with testing the countermissile feature. With replicators on board I'll be happier to have them in my fleet. What tends to put me off is:
- collateral torpedo damage agroing neutral ships & killing my fighters
- missiles detonating on launch and destroying the M8 + killing my fighters
- friendly stations or ships being in between the missile boat and its target

Barleyman
Posts: 127
Joined: Sun, 16. Apr 06, 00:52
x3

Post by Barleyman » Tue, 25. Mar 14, 21:42

Shimrod wrote: - Spiral motion defeating the game's target leading logic, like when turrets shoot an undocking khaak cluster that is spiralling and end up shooting far wide.

All Smart does is tell the turret X to shoot at target Y, it doesn't have control over accuracy or target lead prediction.
That's the general idea for a new generation of corkscrewing missiles :fg:

I don't think a mod like that exists out there or if there is, I missed it. XRM boosts the missile speed towards similar end.

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

Post by Shimrod » Sun, 30. Mar 14, 20:20

I've pulled 4.7.0 until I can recover or remake the script changes.

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

Post by Shimrod » Wed, 2. Apr 14, 02:17

4.7.1 released.

4.7.1
- Launch countermissiles from missile turrets and the ship itself like mosquito defence. This feature can be disabled in the menu.
- Made missile turrets hold fire when in capturing mode
- Stopped missile turrets firing boarding pods
- Set a floor on main guns laser switching iteration time equal to the current laser refire delay, to help remedy higher than normal rate of fire caused by the laser switching when guns are being fired.
- Added support for Advanced Fight Scripts by publishing laser turret target
- As both vanilla and XRM halve the missile refire delay between missile turret volleys, do the same with Smart missile turrets for balance.
- Add a missile turret setting for using swarm class missiles on huge ships. Off by default.
- If it would take more than 250 missiles of the ships best available type to destroy a target then hold fire on the missile turret.

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

Post by Shimrod » Sat, 5. Apr 14, 21:32

Bugfix, a combination of factors including 4.7.1 changes would make missile turrets not activate after changing sectors until a threat had crossed within relatively short range.

4.7.2
- Fix a bug where Smart missile turrets might not engage targets after changing sector.

misioooo
Posts: 115
Joined: Sun, 17. Jun 07, 14:17
x3tc

Post by misioooo » Fri, 18. Apr 14, 14:47

So how exactly smart behaves when going OOS (for TC/XTC)? WIll they equip most powerfull guns and stay that way untill IS again?

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

Post by Shimrod » Fri, 18. Apr 14, 17:37

Yes, in the TC version it'll equip highest shield dmg per shot lasers when OOS.

Turret scripts get disabled by the game when ships are OOS but Smart has another script running on the ship which swaps lasers when OOS. This sleeps for 1-2 minutes between iterations so won't immediately react to equipment changes.

User avatar
Paddyy
Posts: 141
Joined: Sun, 12. Feb 06, 19:25
x3ap

Post by Paddyy » Fri, 2. May 14, 13:48

Stupid Question, but if I install Smart Turrents, do I still need Mars or does it replace almost every feature? (besides the drones)

I'm not sure yet what is probably better for me.

Both seem to be feature heavy scripts, so it is hard to compare them. At least for me.

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

Post by Shimrod » Fri, 2. May 14, 14:50

They're independent scripts and don't conflict with each other. You could install both and try a spell with each to see which suits you best.

Smart doesn't have the drones. They both share functionality of being laser switching turret scripts and can be enabled on enemy ships. Both switch in lasers when OOS and avoid station friendly fire.

Some of Smart's features (in AP) include:
- Works with missile and laser turrets
- Built in countermissile (mosquito defence) functionality
- Can fire lasers and countermissiles at missiles incoming to friendlies
- Has capturing modes that can be used to suppress shields for capturing, or to chip away at hull for bailing.
- Fires individual turret guns at incoming missiles to take down barrages faster (more effective in plain TC without the missile hitpoints)
- Doesn't require mod specific datafiles
- Avoids jumpgate friendly fire by turning the gate neutral

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

Post by dizzy » Tue, 9. Dec 14, 00:15

Speaking about being independent scripts, using Smart Turrets with XTended 2.2a, I assume that means I lose the ECM functionality of the Xtended hacked vanilla turret scripts?

Tough choice... lose ECM (which is absolute awesome as it can take down any number of missiles in range and recharges quickly and can be equipped on anything M6 and up) and stick with the silly vanilla turrets scripts of trying to hit M5s with a T. Cannon or start using Smart Turrets (get much better anti-fighter turret behaviour) but lose ECM and likely increase the chances of getting hit by missiles when many are incoming.

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

Post by Shimrod » Tue, 9. Dec 14, 00:26

There's no ECM support in Smart, however it can be quite efficient at taking down missiles particularly in TC with no missile hitpoints, as it simulates firing individual turret guns independently at separate missiles.

Smart's anti-missile prowess was a big deal at least until AP introduced missile hitpoints. If you have multi gun turrets like on M7/M2, with fast firing lasers available (ideally beams), its really awesome in TC.

Wouldn't an ECM make more sense as an additional ship command, or is that XTC simulates each turret running an independent ECM system? If all turrets share a single ECM timer, how about setting 1 turret to a standard turret command to enable ECM, while using Smart on the other turrets?

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: 96
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: 96
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:

Post Reply

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