[SCRIPT] Turret Command Suite: v2.03 beta (Updated=14/10/2007) XTM Ready :)

The place to discuss scripting and game modifications for X³: Reunion.

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

mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

[SCRIPT] Turret Command Suite: v2.03 beta (Updated=14/10/2007) XTM Ready :)

Post by mrcann »

==========================================================================================
Name: Turret Command Suite v2.03 beta
Updated: 14/10/2007
Author: mrcann
Description: Provides a Military grade version of Turret Commands as well as a set of Hotkeys to manage them
==========================================================================================

Download:


=======================================
Important Info
=======================================

If you are using version prior to v2.00, it is recommended to uninstall it before installing a new one!


This version of script was specifically optimized for the Xtended MOD
It should work in Vanilla X3, however weapon prioritization logic would not be precise. It may still look and work OK half of the time, but no guarantees are given. Sorry!
I will probably make another version of the script tuned for the Vanilla X3 when i have a time and if there is a demand for this :)


It also requires EMP to function
However EMP is included in the Xtended MOD already, so no need to worry


This current beta is pretty much finished feature-wise. If no complains arise, it would be promoted into a release (with a few more optimisations i could think of added)


=======================================
Military Grade Turrets (Milspec)
=======================================

The Milspec Turret Upgrade MK1 - MK2 is an upgrade that enables an advanced weapon switching and target prioritization on a ship, either its a Destroyer blistering with turrets or fighter with just a few turrets. A fighter should have a MK1 ware onboard, while a Capship would need to have both MK1 and MK2 wares.
The upgrade is available from all good Split Equipment docks for a reasonable price.

Upon installing the Milspec Turret Upgrade MK1 on your ship, new turret commands will become available:

- MIL: Turret Attack Target
This command orders ship to shoot only Player's target and nothing else. It is ideal to be used against Enemy Capships, where all your ship's laser energy is diverted into killing an Enemy Destroyer without wasting it firing at the Enemy Fighter Escort or other Destroyers that are not immediate priority to you.

- MIL: Turret Attack Enemies
This command would prioritize for closest targets, based on their threat level. Ie: the Enemy Destroyer would be targeted first, followed by an Enemy Carrier, and so forth, and only if some of your ship's turrets have nothing to do they will track nearest enemy ship in their view. It will not track enemy missiles however.
Basically, this command is useful to be run on your Capship when you are planning to kill anything that moves, provided you have the laser energy. But target preferences are given to enemy Capships first. Your Capship has enough shields not to fear enemy missiles, so they are ignored (besides shooting down enemy missiles would take valuable time your ship would otherwise use to fire PPCs at the enemy)

- MIL: Turret Fighter Defence
This command simply orders turrets to fire at the nearest enemy and at the same time locate and shoot down any enemy missile fired at you. It is useful for clearing out Enemy Fighter Escorts, either its run on your Capship or on your favorite M3

- MIL: Turret Protect Ship
This command is similar to Ego's "Protect Ship" command. It won't attack enemy ships unless they attack first.

All commands will make your ship analyse target and choose an appropriate weapon for turret aiming at it. Different weapons will be selected based on target's class, distance to target and state of target's shields (as you know weapons have different damage against Shield and Hull)

Since version 2.02 it also allows you to switch ship's primary weapon, the same way it happens with turrets. It will have to be activated in Ship Command Menu using the TCS: Primary Weapon Switcher command. Your fighters, M6s and M7s are now deadlier then ever! Just make sure you have enough units of weapons in cargo bay to mount them in turrets and on primary weapon!


=======================================
Outfitting Ships for use with Milspec Turrets
=======================================

You can load your favorite ship with every type of weapon it can mount. Just make sure you have as many units of weapon in cargo bay as there are weapon slots for this type of weapon on a ship.

For example: your total number of weapon slots is 44, out of which you can mount only 28 APACs and only 18 BPACs. So carry 28 APACs and 18 BPACs in cargo bay.
Why carry weaker version of the same weapon, ie BPAC and APAC, AHEPT and BHEPT? - because APAC/AHEPT are faster, so it has a better chance of hitting agile fighters at a distance (though smaller range)

Also make sure you carry weapons with fast-moving projectiles such as IREs - PACs - PBEs or Kyons, as these will be used when trying to shoot down an enemy missile. (Prioritized by weapon range of course)

To sum it up:
  • - against Capships your ship will try to use PPCs (or anything with the hardest punch), as target is large, slow moving and therefore hard to miss

    - against Corvettes it will use powerful weapons and antifighter weapons, since its a relatively large target and it will have a hard time dodging your fire

    - against Fighters it will try to use reasonably fast and reasonably powerful anti fighter weapons (depending on distance to target)

    - against Missiles it will try to use fastest weapon you have to shoot them down, doesn't matter if weapon is weak
For example i enjoy flying a Yaki Sennin armed with:
  • APAC 6
    BPAC 6
    AHEPT 6
    BHEPT 4
    APSG 6
    BPSG 4
    APBE 6
    AKYON 6
    BKYON 4
The turret is set to "Turret Fighter Defence". The TCS: Primary Weapon Switcher is activated in Ship Command Menu
It ususally starts by drilling enemies with APBEs, then switches to AKYONs (which are more powerful against hull then PBEs) when target's shields are down.
Ship's primary weapon usually swithes between BKYON-APBE-BHEPT-etc depending on target's parameters. Just point and shoot! :)


A Xenon LX has:
  • AIRE 10 (used to shoot down enemy missiles, as its the fastest weapon this ship can mount)
    BPAC 10
    AHEPT 10
    BHEPT 2
    BPBE 8
A Terran Thor has:
  • AIRE 12 (again, used against enemy missiles, as its the fastest weapon this ship can mount in its turret [also, could probably get by only using 4 units of AIRE, since if trying to shoot down enemy missile with your primary weapon it will switch to BPBEs, as its a lot faster, however following the rule of having enough units of weapon to be able to mount it on every turret, i made it 12 units])
    BPAC 12
    BPBE 8
    AEMP 12
A Thor can mount many weapons, however its cargo bay is not that big. So as a compromize AHEPTs weren't included.
Ship's primary weapon usually switches between BPAC-BPBE-AEMP, depending on the situation.


A Pirate Reaver has:
  • AIRE 28
    BIRE 18
    APAC 28
    BPAC 24
    AHEPT 24
    BHEPT 14
    APSG 24
    BPSG 8
    BPPC 6
    (note no APPC there, though it can mount them - because PPC weapons are usually prioritized by their power and range)
    AFFA 14
    BFFA 6
    APBE 24
    BPBE 6
    AKYON 10
    BKYON 6
=======================================
Using Milspec Turrets OOS
=======================================

If ship goes OOS while Milspec Turret or Primary Weapon Switcher commands are used, the weapons of the strongest possible type are chosen on a turret or on primary weapon.
I.e. if its a Destroyer, it will choose a PPC on a turret slot (given it exists in cargo bay of course).

Please note, that if you manually change weapon on a turret slot on an OOS ship, it will not auto-switch back until it goes back to In Sector mode, so be careful not to forget to change weapons back to the strongest type when you are done experimenting!


=======================================
Turret Command Hotkeys
=======================================

There are also additional hotkeys included in this package to help you out:

Hotkeys to set all turrets to perform one of these commands:
  • standard Ego turrent commands that don't provide weapon switching:

    Turret Attack Target
    Turret Attack Enemies
    Turret Missile Defence
  • turret commands that provide weapon switching and intelligent target tracking:

    MIL: Turret Attack Target
    MIL: Turret Attack Enemies
    MIL: Turret Fighter Defence
  • misc. turrent commands:

    Turrets Off
    Turret State Restore
Turret State Restore - restores user-defined Turret Commands that were there before any of the Turret Command hotkeys were pressed.
Every time you give a turret an order by using menu (not through the hotkey) it will save all current Turret Command Selections.

Known Issue:
Unfortunately the algorithm is not perfect - if you use hotkey to set Turret Commands and then jump to another sector, your user-defined Turret Command Selection will be overwritten by commands initiated by the hotkey.


And as a bonus, a few more hotkeys were included:
  • - Target nearest Capship hotkey will save you precious seconds when you jump out and notice lots of enemy Capships in close proximity. Hit "Target nearest Capship" and then hit "MIL: Turret Attack Target" hotkey to start your Destroyer acting, then you can use external view to look around for better situation analysis.

    - Target nearest Enemy hotkey will target nearest enemy ship that is in range of your ship's primary weapons. If no such target found it will just target nearest enemy ship. It is useful when you are flying a fighter.

    - Target nearest Missile hotkey will target nearest missile aiming at you. Its useful when you are in a ship that doesn't have turrets (like Khaak M3), so you'll have to shot them down yourself.

    - Area Effect Weapon Switch hotkey will globally (for all your ships) Enable/Disable the use of Area Effect weapons (PSG/ID) by your turrets. When Area Effect weapons are going to be disabled the onboard computer will say: "PSG Weapon Systems Not Working", and if enabled the Betty will say: "PSG Weapon Systems Working". This hotkey is useful to preserve valuable container drops or if you don't want to accidentally piss off races while hunting an enemy in crowded areas.

    - Capture Mode hotkey. In Capture Mode the ship will strip enemy of its shields and will keep it alive for as long as possible, using only weakest weapons onboard to infict minimum damage to its hull (usually BRI weapons will be used). In case you forget to turn it off, it will automatically switch itself off when you change ships. This command is only available on Player-controlled ships.
=======================================
Installation
=======================================

SPK: - run the turret_command_suite_<version_number>_install.spk


=======================================
Uninstallation
=======================================

SPK: - use the Remove Script Files command in Script Installer to uninstall current script package, then install the turret_command_suite_<version_number>_remove.spk and start X3. Wait a bit until the uninstallation script finishes and you get a logbook message. Then quit X3, go back to the Script Installer and use the Remove Script Files to remove the uninstallation SPK.
The reason for having to run a special uninstallation SPK is because the Script Installer has a bug that makes it produce unpredictable results when including uninstall files in the original spk :-\ Sorry about that!

ZIP: - launch this file: uninstall.mrcann.tcs.xml


=======================================
Technical Info
=======================================

t file reference\text page used:

Code: Select all

 8445 - Turret Command Suite by mrcann
commands used:

Code: Select all

 <t id="930">COMMAND_TYPE_TURRET_34</t>  : MIL: Turret Attack Enemies, Turret Command Suite by mrcann 
 <t id="931">COMMAND_TYPE_TURRET_35</t>  : MIL: Turret Protect Ship, Turret Command Suite by mrcann
 <t id="932">COMMAND_TYPE_TURRET_36</t>  : MIL: Turret Attack Target, Turret Command Suite by mrcann
 <t id="933">COMMAND_TYPE_TURRET_37</t>  : MIL: Turret Fighter Defence, Turret Command Suite by mrcann
 <t id="1244">COMMAND_TYPE_SHIP_44</t>   : TCS: Primary Weapon Switcher, Turret Command Suite by mrcann
task slots used:

Code: Select all

309-316 ........ Turret Command Suite by mrcann
EMP wares used:

Code: Select all

28;0;0;0;0;176;11003;0;438508;1;1;0;438508;0;0;0;SS_WARE_SW_CUSTOM16_5;
28;0;0;0;0;174;10983;0;61428;1;1;0;61428;0;0;0;SS_WARE_SW_CUSTOM14_5;

=======================================
Requirements
=======================================
X3 v2.0.2
Xtended MOD. Should work without XTM, however prioritization would not be precise.
X - Plugin Manager, if you are installing the SPK version
EMP (built in XTM)


=======================================
Compatibility
=======================================

This script is not compatible with the "Capital Ship Crews by Cycrow", due to sharing the same command slot in Ship Command Menu

This version of script was specifically optimized for the Xtended MOD.
It should work in Vanilla X3, however weapon prioritization logic would not be precise. It may still look and work OK half of the time, but no guarantees are given. Sorry!
The script has no issues with the current version of the Xtended MOD, which is v0.7.3 at the time of writing this.


=======================================
Version History
=======================================

v2.03 beta
  • - Added an upgrade module that automatically restarts TCS processes (turret commands and primary weapon switcher command in ship menu) on all your owned ships upon version upgrade

    - Added a Milspec Turret Upgrade MK1 ware that is priced cheaply and should be installed on your fighters. In addition to MK1, you will still require to have the MK2 version on your Capships!

    - Major performance optimizations. "Turret Fighter Defence" and general Weapon switching are now consuming considerably less resources. It is especially useful if run on fighters. As a trade-off, all on-board weapons are recognized and available to be used when your ships are either going to the In Sector mode from OOS mode, or had their Milspec Turret Commands started. So don't expect your ship to immediately start using new weapons trasferred to ship's cargo bay without restarting Turret Commands first!

    - "Target Closest Enemy" hotkey is now optimized to target nearest enemy ship that is in range of your ship's primary weapons. If no such target found it will just target nearest enemy ship. It is useful when you are flying a fighter.

    - A Capture Mode hotkey added. In Capture Mode the ship will strip enemy of its shields and will keep it alive for as long as possible, using only weakest weapons onboard to infict minimum damage to its hull (usually BRI weapons will be used). In case you forget to turn it off, it will automatically switch itself off when you change ships. This command is only available on Player-controlled ships.
v2.02 beta
  • - Added ability to switch ship's primary weapon, the same way it happens with turrets. It will have to be activated in Ship Command Menu using the TCS: Primary Weapon Switcher command. Your fighters, M6s and M7s are now deadlier then ever! Just make sure you have enough units of weapons in cargo bay to mount them in turrets and on primary weapon!

    - Major revise of the "Turret Fighter Defence" command's code. It should track enemy missiles much better now.

    - Fixed bug/feature/unexpected cheat (depends on how you look at it :)) that would occure in certain situations and enables crazy-low refire delays on weapons (thanks to x0ne for finding it). Now the refire delays are back to normal, but at the same time script's responsiveness is still sharp

    - Fixed bug when you could not activate Milspec Turret Commands on your other ships, while yourself being in a ship that does not have the Milspec Turret Upgrade MK2 ware in cargo bay
v2.01 beta
  • - Area Effect weapons such as PSG and ID, as well as CIG and Heavy Missile Gun (HMG) were added

    - A hotkey for quick Area Effect weapon on/off switching was added. It is useful to preserve container drops or if you don't want to accidentally piss off races while hunting an enemy in crowded areas

    - Turret Attack Enemies command logic was improved to prioritize targets better

    - A lot of other improvements to targeting logic!
v2.00 beta
  • - My own weapon switching logic was introduced

    - Targeting logic was changed to introduce "Turret Fighter Defence" command; "Turret Attack Enemies" command now prioritizes for large targets based on threat they possess; "Turret Attack Target" command orders ship to shoot only player's target and nothing else.

    - 2 new hotkeys added: "Target nearest Missile" and "Target nearest Enemy"
v1.01
  • - Code was optimised so it should run smoother.

    - Docked ships will now select best weapon loadout if went OOS.

    - Fixed a slight chance of ship not selecting best weapon loadout if going OOS in fly-mode.

    - Fixed bug that prevented ship from auto-switching weapons on a turret if not a single weapon was installed in any of the turret slots (ie a freshly bought\made ship would not auto-switch until you install at least one weapon per turret manually)

    - Changed the way weapons are selected when no enemy is in sight - before, all weapon slots but one were stripped of weapons; now they are populated with weapons of maxium (or nearly best) possible type. (Thanks to Red Spot for the idea)

    - SPK in the original release v1.00 did not include 2 of the 4 uninstall files due to the bug in the Script Packager that produces unpredictable results when including uninstall files. It is advised to upgrade to v1.01 and only then uninstall package from the Script Installer. ZIP version is unaffected.
v1.00 - Initial release.




Happy Hunting!
Last edited by mrcann on Sat, 13. Oct 07, 21:40, edited 18 times in total.
Puruco
Posts: 527
Joined: Tue, 6. Dec 05, 00:09
x3

Post by Puruco »

Hi mrcann: I try yesterday nigth to download the script about 6 times and filefront don't let me. Do you have other place to upload it? Anyway I will try again tonigth?
mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

Post by mrcann »

Puruco wrote:Hi mrcann: I try yesterday nigth to download the script about 6 times and filefront don't let me. Do you have other place to upload it? Anyway I will try again tonigth?
Sorry mate, i thought filefront was the most trouble-free file hosting service there is, obviously not :( Let me think where else i can put it up :)

*** Update ***
How about RapidShare?

http://rapidshare.com/files/33124311/tu ... _v1.00.spk
http://rapidshare.com/files/33124668/tu ... _v1.00.zip

Cheers.
User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Re: [SCRIPT] Turret Command Suite: NPC Turrets, Turret Command Hotkeys. v1.00

Post by Red Spot »

[quote="mrcann]
Note2, when ship goes OOS while docked, it will not auto-switch weapons to the strongest type (reason is that script is on 15 seconds pause when docked and the fact that turret scripts freeze when OOS)
[/quote]


Little tip; make turrets "default" to installing the biggest possible weapon after every cycle, it'll work much smoother and causes less .. er .. say "switch-problems" ...



G
mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

Post by mrcann »

Little tip; make turrets "default" to installing the biggest possible weapon after every cycle, it'll work much smoother and causes less .. er .. say "switch-problems" ...
I hope i understood you correctly: But it already performs weapon switching in the beginning of the 15 seconds pause while docked. Its just while ship is docked there is good a reason to preserve resources by placing script on pause.

Cheers
User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Post by Red Spot »

mrcann wrote:I hope i understood you correctly: But it already performs weapon switching in the beginning of the 15 seconds pause while docked. Its just while ship is docked there is good a reason to preserve resources by placing script on pause.

Cheers
I was more refering to defaulting it to installing max. weapons after each cycle trough the script, so after each time it fired/tracked (did anything else than *nothing*)
this means you only once need to revert to max. weapons in your entire script

about the "pause"
yes and no, there is good reason to put an interrupt there where the ship would be docked, but no there is no reason to make is so big, a 1 sec interrupt works much better and wont cost you a thing in resources (at least nothing you'll ever notice)

what you will notice is the chance that a ship undocks right after it starts it 15 sec interrupt and so for ~15s is defenceless ...
with a say 2 sec interrupt your guaranteed to have a ship that reacts the moment it undocks ...
timing is probably the most critical thing in scripts like these, dont be afraid to use a bit more than normal but very small interrupts, they can be your biggest friend or your biggest nightmare ...

hope you dont mind .. er .. me sharing whats on my mind ..;)



G
mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

Post by mrcann »

Ah, i get it now! I don't think that can be influenced directly, as everything revolves about the

Code: Select all

[THIS] -> select and switch lasers for target "target\null" in turret $turretid: scan for friends [TRUE]
command, and it wants to make all turret slots but one (sets it to max weapon) empty of weapons if no target is given.

However, it might be possible if i decrease the pause while docked - that way script has a chance to run before it gets frozen (no idea how much time script has before it freezes though but trial and error should help :) ). Btw, standard turret commands have 60-80 seconds wait while docked :o , but the NPC ones by Ego have 10-15s - i just left the original values when added modifications (except changed standard turret commands to 15 seconds also to match the NPC ones).

Thanks for the input!


*** Update ***
My bad, there is not such thing as delay before script is frozen :) When ship is in space it has a weapon swapping task running in background that is set to terminate itself after some time (if no targets are present). During the time its running its switching weapons continuously and when the ship goes OOS it selects best weapon loadout for the OOS.

So the way to have docked ships selecting best weapon for the OOS would be to have a similar, "low-resource" task launched continuously.

Might implement it on a weekend :)
User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Post by Red Spot »

as a target give the ship itself, see the results ...(might wanna have said that earlier ... :roll: )

anyway you dont really get what I'm aiming at, when you make sure the max. weapons are installed after each time you make a possible change in them than there is no need at all for a docked/oos weapon-switch as they *should* already be using them (only when the player switches them it might not, this would also allow the player to swap weapons manually without the turrets installing the weapons back before you get a chance to make a change as they only switch weapons on tracking/firing and once after that to swap back to max. ...)

this makes me also partially understand your worries about the interrupt while docked, as I get the impression you have some code there other that an interrupt ...
dont, make sure the turret is set as should and once docked it only keeps looping an interrupt
there is very little diff. between the next pieces of code when it comes to use of resources

while true
wait 1 ms
end

while true
wait 99999999 ms
end

so if you keep the check for being docked above anything else (perhaps under a check for any weapons at all) you could actually get away with a 1ms interrupt ...



G
mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

Post by mrcann »

Used your advice on giving ship itself as a target - worked a treat! :thumb_up: :thumb_up: :thumb_up: Thank you very much! This makes it all much, much easier indeed. Interesting how it behaves though - i was guessing that if a ship itself is at distance 0 then why not switch to the closest range weapons like Flaks. Or may be it is a negative distance, since aiming at a ship itself would be like aiming from inside? lol

*** Update ***

A bit unpredictable results while In Sector if HEPTs exist in cargo bay:
- it chooses AHEPT over BHEPT in both turrets for LX
- it chooses BHEPT over APPC in left\right turrets for Mammoth

When the ships are going OOS, it switches them correctly:
- APPC in all turrets for Mammoth
- BHEPT in both turrets for LX

Hyperion, gets BHEPT in front turrets, as intended, In Sector and OOS modes.

K, had GPPC selected in all turrets in both modes

Looks like it also takes size of target into consideration. Thats why, the LX - smallest class, has AHEPTs chosen in both turrets as it targets itself. Hyperion is a "bigship", hence always BHEPT. K, a "hugeship", requires GPPC.

So the question still remains if a low-res task should still be launched while docked that starts with a pause, performs switching, quits. So it sets correct weapon loadout for the OOS for ships of class "ship"
Last edited by mrcann on Fri, 25. May 07, 16:01, edited 1 time in total.
User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Post by Red Spot »

do note that if you pull that on the playership itself it wont always install the biggest possible weapons but only reasonably big weapons (I've just seen and used it as a "capture-feature" ...)

I guess you havent realisted this or perhaps simply dont know about it, but dig up a topic called "RS.turret defence" there might be some other interesting words of advise in the topic ...
(iirc its still in the "unsupported" part of the script/mod topic)



G
mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

Post by mrcann »

do note that if you pull that on the playership itself it wont always install the biggest possible weapons but only reasonably big weapons (I've just seen and used it as a "capture-feature" ...)
yep, i've just updated my previous post with my findings :)
Looks like a low-res switching task is still needed to get the weapons set properly for the OOS while docked.

Thanks for the info, ill do a search on it.

Cheers, Alex[/quote]
Puruco
Posts: 527
Joined: Tue, 6. Dec 05, 00:09
x3

Post by Puruco »

mrcann wrote:
Puruco wrote:Hi mrcann: I try yesterday nigth to download the script about 6 times and filefront don't let me. Do you have other place to upload it? Anyway I will try again tonigth?
Sorry mate, i thought filefront was the most trouble-free file hosting service there is, obviously not :( Let me think where else i can put it up :)

*** Update ***
How about RapidShare?

http://rapidshare.com/files/33124311/tu ... _v1.00.spk
http://rapidshare.com/files/33124668/tu ... _v1.00.zip

Cheers.

Thanks mrcann can dl with rapidshare. Just for your info try again, just for testing, with filefront and don't let me. Suggestion: Xai have other people scripts in his site. Maybe if you talk to him and with his permision he let you have upload yours. just another alternative.
User avatar
Lucike
Posts: 12969
Joined: Sun, 9. May 04, 21:26
x4

Post by Lucike »

That's funny. I had the same idea. ;)

Perhaps you want to look into my script.

Download -> http://www.lucike.info/x3_reunion/scrip ... _V3100.zip
German Topic -> http://forum.egosoft.com/viewtopic.php?t=168182

Greets
Lucike
Image
mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

Post by mrcann »

LOL! Very similar! :)

Code: Select all

020      $TurretC1 = [THIS] -> is script 'plugin.mefos.turret.command1' on stack of task=$TurretID
021      $TurretC2 = [THIS] -> is script 'plugin.mefos.turret.command2' on stack of task=$TurretID
022      $TurretC3 = [THIS] -> is script 'plugin.mefos.turret.command3' on stack of task=$TurretID
023      $TurretC4 = [THIS] -> is script 'plugin.mefos.turret.command4' on stack of task=$TurretID
024      if $TurretC1 OR $TurretC2 OR $TurretC3 OR $TurretC4
i wanted to do exactly the same, but then thought that since my switching task is on 10ms wait, this way could be resource hungry. instead used an "Abort" array retreived from local var in hope that would squeeze the performance a bit (just heard somewhere that arrays operations take virtually no resources).

Code: Select all

013     $swaptask.abort = [THIS] -> get local variable: name='mrcann.turret.swaptask.abort'
.....
022      $abort = $swaptask.abort[$turretid]
023      skip if not $abort
024       continue
Even turret command slots are the same :) I shall change mine's to 34-35-36-37 then.
mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

Post by mrcann »

New version is available.
Cheers
Michael_r_513
Posts: 4
Joined: Thu, 17. May 07, 10:16

Post by Michael_r_513 »

Excellent work mrcann! I have seen features of this script here and there in other turret scripts but you have manged to combine the best features from them all into one easy to use script. Keep up the good work!
mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

Post by mrcann »

Thanks mate, i hoped i was on the right track with this. Looks like i am :)

Cheers, Alex
Fistantantilis
Posts: 58
Joined: Sat, 7. Feb 04, 19:01
x3tc

Post by Fistantantilis »

Brilliant!
User avatar
ezra-r
Posts: 3423
Joined: Fri, 14. Oct 05, 21:04
x4

Post by ezra-r »

didnt know about this one untill someone mentioned it in the xtm forums. Awesome job, now my favourite for turret switching.
asynd
Posts: 11
Joined: Thu, 4. Jan 07, 08:26
x3

Post by asynd »

very nice, I tried to do this awhile back but was unable to get it to work the way i intended.

When using your hotkeys to call the npc turret scripts I wasnt able to get it to work. So I modified the hotkey script for one of the turret commands. Now when ever I target one of my ships or any npc ship and hit the hotkey, the turret command will called ^^

Code: Select all

$Target = get player tracking aim
if $Target -> exists
@ = $Target -> call script "mrcann.turret.hotkey.att.enm.npc" :
end
return null

Return to “X³: Reunion - Scripts and Modding”