[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

Huillam
Posts: 432
Joined: Fri, 16. Dec 11, 11:24
x4

Post by Huillam »

You won't believe it (or maybe you will) but it works a lot better that way. :D
Thank you very much to both of you.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

No worries. Seems like it needs a config menu option and possibly a hotkey for toggling it.

[Throttling]
0 - Off
1 - Turrets Only (default?)
2 - Main guns and Turrets

The design goal with throttling is to balance DPS with the ship's power generator regen capability, so that ships in drawn out battles could output constant DPS without running out of steam. In playtesting NPC vs NPC battles of M6 and up this appeared to me to work in Smart's favour and improve longer term success.

However I have found that in a fighter I prefer to do an attack run and completely unload, then fly away and let the power regenerate. The throttling limits the attack run's damage output in this case, so defaulting to throttling turrets only seems reasonable.
-XeNoN-
Posts: 373
Joined: Tue, 6. Mar 12, 12:04
x4

Post by -XeNoN- »

Shimrod@
Since i played TC and AP always with modified tag, im in urge to complete all achievemtns, so does this change the game to Modified? And is it possible to get achievemnts with modified tag? Srry if this was asked before xD.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Yes copying the Smart scripts into the game's scripts folder will make any game that's subsequently loaded or started, modified.

Smart is an unsigned script so the game won't load it unless the game is modified. Smart therefore includes a !init script to force the game to be modified.

I don't know about the achievements. Seems unlikely to be enabled. Presumably egosoft would block statistic upload from modified games to avoid contaminating their data pool.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I've uploaded a TC version to 2.5.

2.5
- Added a throttling setting to control whether Smart will reduce number of mounted lasers when laser energy is low. By default throttling will only be applied to turrets not main guns.
- Avoid rapidly firing lasers when the mode cycling hotkey is spammed.
- Included an init script to automatically make games modified. Vanilla unmodified games would otherwise require script editor activation to load Smart.

The changes will eventually get ported to the AP version.
adrianx
Posts: 106
Joined: Sun, 24. Apr 11, 18:45
x3tc

Still on XRM and TC

Post by adrianx »

In other words, I want to avoid expending effort testing the TC version of Smart on vanilla and XRM. So do let me know if anyone is stuck on TC (and I sympathize with the Steam requirement), and relies on the TC version of Smart with vanilla/XRM. Bearing mind there is also MARS.
I can't remember whether I came across your script a few months ago while playing TC, vanilla, then XRM, then XTC 2, on Windows. Once Steam for linux came out I stopped playing X but jumped back to it when X3R was released. After a few weeks of that it was back to TC again.

I'm currently playing TC with XRM although presumably will switch to XTC in a few weeks and obviously not expecting you to spend your valuable time testing, but any hints about differences between XRM and XTC as far as Smart turrets is concerned that may need tweeking would be useful to know.

The biggest problem at the moment is x1tp is unavailable (mysql error) so actually trying the script is a bit difficult ;-).

Anybody with a (temporary even) alternative link to the 2.5 version would be appreciated.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Its unlikely the TC version would become incompatible with XRM. The difference is in the math used to select an appropriate laser to shoot targets with.

Last I played XRM it has had fast and agile fighters, but which die quickly to fast firing lasers available to capships.

XTC has relatively slow fighters which are hard to kill. Fast firing antifighter weapons suck vs anything bigger than M5, and flak is nerfed and restricted to a small set of turret guns. PPC can often hit M3 and even M4.

Until I rebalanced the model Smart on XTC was picking faster lasers to shoot the fighters and would take forever to kill them, failing badly when surrounded by fighters. It might be that Smart on TC/XRM suffers the opposite from the rebalance, that it tries to use slow lasers to shoot fighters. Or maybe, since the math remains proportional to speed of target, the new model will still work well on XRM. I don't get much free time and decided it's a scenario I don't plan to test, though it'd be useful to know whether it's still performing ok.

x1tp has gone silent recently, I had to host OK Traders elsewhere as x1tp isn't accepting new file uploads, although I've been able to upload new versions ok. Haven't heard back from SS_T. Looks like I'd better rehost my downloads. Might get that done this evening.

Update: now re-hosted
adrianx
Posts: 106
Joined: Sun, 24. Apr 11, 18:45
x3tc

Post by adrianx »

Apologies for the late reply - thank you for the detailed reply and the new download link.

Its been fun flying around in a griffon with a wing of skate prototypes and, in addtion, a heavy centaur prototype as wingman just sitting and watching the turrent switches during combat with the different colours "bullet trails", espcially the HCP with its large range of weapons.

Very useful script including the main turrent command although I'm not sure if this is necessary for NP ships or whether main turrents count as (possibly additional) front turrents when the player isn't in control ?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

The main guns command only adds laser switching and won't act as a turret. On ships under computer control main guns are fired as part of the main ship command running on task 0, not by Smart.

The Smart NPC option only applies to turrets, doesn't enable the main guns command on NPCs. I don't think there's a practical limitation why it couldn't though but it'd be a non-trivial addition, and testing is difficult because much depends on what lasers NPC ships might spawn with in different mods.

For a good light show I typically use the x3 editor to modify every laser ware so they occupy a volume of 1. Almost every ship can then support it's full range of lasers, maximizing eye candy, ungimping Tyr, leaving room for fuel. Never found a downside other than less scope for testing laser starvation scenarios.
adrianx
Posts: 106
Joined: Sun, 24. Apr 11, 18:45
x3tc

Post by adrianx »

Thanks for that.

Its interesting to try to note the differences between MARS and Smart turrets. I can't say I've noticed anything obvious about which handles weapon switching "better", obviously MARS has goblins in addition which are fun to distract bigger craft sometimes.

One difference which is most excellent is Smart's "Attack my target", something MARS doesn't have (unless there was some way of doing this which I never figured out); nothing more frustrating attacking a pack of Xenon with a K in the lead and your turrents suddenly deciding to attack smaller craft while you're desperately trying to get rid of the biggest threat ! Oh, the ability to switch turret commands with a hotkey is most useful.

One strange problem I've encountered - some ships (OK traders at least) won't allow me to set Smart turrent commands; show "Unknown command !" instead - the right extentions are installed on each ship so its most bizarre. I can't reproduce this on a new game with the same mods/scripts but, as mentioned, some ships can use smart turrent commands, and some can't.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I think the most significant differences feature-wise between Smart and MARS on AP are:
- Smart doesn't require mod-specific datafiles
- Smart has a capping mode for forcing ships to bail or suppressing shield.
- MARS has goblins.

'Unknown command!' would appear if the 9050-L044.xml file is missing or currupt, or if the game's language is set other than English, since Smart doesn't include localized or English-on resource files for other locales

Scripts must all share a limited set of custom command IDs, reserved in a post on this forum cooperatively to avoid conflicts. Whether or not any localized text appears for a custom command, is as far as I know entirely automatic and based on the presence of an XML file for the game's language, containing appropriate corresponding entries.

For example if we want 'Smart Offense' to show up on English (language ID 44) when any script assigns custom command 952, per the reservation:

Code: Select all

<t id="952">COMMAND_TYPE_TURRET_52</t> : Offense Mode - Smart Turrets by Shimrod
A text file must then contain the following:

Code: Select all

<language id="44">
...
<page id="2008" title="Cmd ID">
 <t id="952">GLEN_SMART_TURRET_OFFENSE</t>
...
<page id="2010" title="Cmd Name">
 <t id="952">\33GSmart\33X Offense</t>
...
<page id="2011" title="Cmd Shortname">
 <t id="952">\33GSmart\33X.\33RO\33X</t>
...
<page id="2022" title="Cmd Desc">
 <t id="952">This command assigns \33GSmart\33X Offense turret 
So if the 9050-L044.xml file is present, if no other script is trying to muscle in on Smart's command IDs, if the game language is English, and if Smart's command IDs do not show up - then I really don't have a clue what the problem might be :)
adrianx
Posts: 106
Joined: Sun, 24. Apr 11, 18:45
x3tc

Post by adrianx »

Thanks for the explanation. I'm wondering whether " Factory Complex Constructor [4.02]" is using the same id :-

Code: Select all

adrian@mort:~/Games/X3 Terran Conflict - no steam update/mods$ grep -r 'id="952"' ../t
../t/8845-L044.xml: <t id="952">\033GFCC\033X Movement step increased to: \033R%s\033X Metres %s</t>
../t/8845-L049.xml: <t id="952">\033BFCC\033X-Bewegungsschritt erhöht auf: \033R%s\033X Meter %s</t>
FCC uses a ton of hotkeys, one of them is the above mentioned "movement step increase" but do hotkeys
also have to be associated with commands ?

At any rate, I've only just installed FCC so suspect something else.

Its not a major problem currently and running on Linux makes figuring out issues somewhat harder (X-Studio runs under wine but the window is tiny so its difficult to read code - looking forward to Rebirth using a straight-forward script format).
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

That doesn't conflict. The textfile system organizes the text entries under numbered sections it refers to as pages. Text IDs only need to be unique within the same page ID. In this case the FCC IDs dwell within FCC's reserved page 8845 rather than pages used for command text:

Code: Select all

8845: Dusty, Factory Complex Constructor
9050: Shimrod, Smart Turrets
However the game loads command text using well known page and and text IDs. These are pages 2008 (symbolic name shown in scripts), 2010 (display name), 2011 (abbreviated display name), 2012 (command description when pressing 'i'). You can see both Smart and FCC textfiles have nodes for these sections, and also the text IDs within don't conflict.

Hotkeys are a different kettle of fish. They're linked to a script rather than a command.

Code: Select all

$Text = read text: page=$PageId id=4000
$Tmp = register hotkey $Text to call script 'glen.turret.smart.hk.cycle'
From what I recall reading of Rebirth's script system it's going to expose mission-director style declarations rather than offering a scripting language, so it's not something I'm particularly excited about. I'm hoping it'll just be a v1 limitation, as the scriptability is a big part of what has held my attention with X for so long.

If they do expose a scripting language, I'll be happy as long as they add parameterized functions with local variable scope. I'm having to approximate function call semantics using lib scripts with generic parameters and case blocks at the top deciding which function to call.
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

what is the actual difference between smart offense and defense? :?:
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

The main use is to avoid shooting passing red traders.

The ship scans for enemies using the ship as their attack or command target, and puts them on an attackers list it remembers. Defense mode attacks anything on the attackers list as well as missiles.
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

Shimrod wrote:The main use is to avoid shooting passing red traders.

The ship scans for enemies using the ship as their attack or command target, and puts them on an attackers list it remembers. Defense mode attacks anything on the attackers list as well as missiles.
uh what? that's somewhat vague... so defense mode is actually better than offense? :?:
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

In defense mode you could fly into a swarm of red pirates attacking a TS and the turrets won't shoot the pirates. They'll similarly ignore a formation of red ships flying away from a gate on assassination missions.

The turrets will only target things attacking the ship or targetting it (read that as approaching with suspicious intent), hence defence mode.
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

hi shimrod, you must see my video, on around 2:44 mark I experienced bug, 'smarted' right turrets didn't fire the weapons even though it's in range, notice after I changed direction, it worked against other enemy.

http://www.youtube.com/watch?v=Rtsobb3jwLQ

actually I'm not sure if that's a bug or just CPU overload as I'm running a heavily modded game including XRM, IE2, phanon, pirate guild, and yaki armada :mrgreen:
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I notice there's a PAC forge 2.15km away. The 'Avoid Station Friendly Fire' setting makes a turret not fire if that turret could potentially shoot at a station in its firing arc. Try disabling that setting.

Unfortunately there's no visual cue for when a turret isn't shooting due to station avoidance.
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Re: [SCR] Smart Turrets v4.5 (AP), v2.5 (TC) (23-05-13)

Post by nap_rz »

several questions about smart config options

1. what does target stations mean?
2. all options under missile turrets, any explanation on that?
3. NPC missile interception and anti missile target limit, what exactly does that do?

thanks.

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