[SCR] Missile Safety (v1.12)

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

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

[SCR] Missile Safety (v1.12)

Post by Gazz » Sat, 7. Mar 09, 13:25

English / Deutsch

Missile Safety
  • This script is compatible with TC and AP.
  • Especially when flying a fighter it is not uncommon that missiles that you launch are immediately destroyed by enemy fire - or by your own cockpit guns / turrets.
  • This script provides a missile safety so the warheads are armed after the missile is at least 200m clear of your ship.

    Note that this is not foolproof. A lucky shot can still detonate a missile even if the warhead isn't armed.
    (Firing at warheads is neither safe nor recommended by the manufacturer)
  • This only affects missiles that
    • are launched by the playership
    • have a target
    • are of the type that is selected as current missile in the cockpit
  • The missiles do not have to be launched manually as long as they meet the aforementioned conditions and are launched at the current cockpit target.
    Scripts like Missile Barrage or MEDUSA could make use of this.
  • This ignores missiles fired by huge ships (M1, M7M...) because these simply do not have the problem of missiles instantly being destroyed on launch.
    It is a fighter issue.
    And I wanted to exclude massive missile barrages. =)
  • This is an AL plugin. It can be turned on/off under Gameplay / AL Plugins.
  • In X3:AP, this script can be enabled for the AI as well.
    Copy the contents of the scripts\X3AP_Missile_Safety_AI folder into \scripts\.
    In the long run this is only going to work with Steam in Offline mode (or with updates disabled for AP) because it is necessary to overwrite vanilla files... which Steam would "fix" again.
  • For scripters:
    To use Missile Safety for any AI ship, insert one script call before the actual launch instruction.

    Code: Select all

    020 skip if not get global variable: name='GZ.MSL.SAFETY'
    
    021    @ = [THIS] -> call script 'al.plugin.gz.missile.safety' :  plugin ID=null  plugin event='launch'  Missile launched=$Missile  Target Old=$Target
    
    022   = [THIS] -> fire missile $Missile on $Target
[url=http://forum.egosoft.com/viewtopic.php?t=238904]How To Use AL Plugins[/url]

[ external image ] Download: ZIP


Installation
Copy the contents of the zip into the X3_TC folder
or in the case of X3:AP, into ... \Steam\SteamApps\common\x3 terran conflict\addon


Deinstallation
  • Turn off the AL plugin under Gameplay / AL Plugins.
  • Save.
  • Delete TC\scripts\al.plugin.gz.missile.safety.xml
Resources used:
Task ID 47050 and 57050 on the playership.
Last edited by Gazz on Tue, 27. Dec 11, 04:44, edited 14 times in total.
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.

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sat, 7. Mar 09, 13:25

* * reserved * *

argon_emperor
Posts: 1225
Joined: Mon, 12. Dec 05, 07:41
x4

Post by argon_emperor » Sat, 7. Mar 09, 13:57

Sounds good, will give it a spin tonight.

Lancefighter
Posts: 3144
Joined: Sun, 19. Dec 04, 02:41
x4

Post by Lancefighter » Sat, 7. Mar 09, 22:05

a question from a technical standpoint:

its an AL plugin...
I was under the impression those are only run every 1 minute at most, yet i assume it works on missiles as soon as they launch

So erm how does it actually work?

I tried to take a look at the file but it makes no sense in notepad2 or the ms xml editor...
(whats a good out of game editor type thing for x3tc files?)

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sun, 8. Mar 09, 00:00

Lancefighter wrote:its an AL plugin...
I was under the impression those are only run every 1 minute at most, yet i assume it works on missiles as soon as they launch

So erm how does it actually work?
Hahaha!
Since AL plugins already have a library structure this single script runs in 3 different ways in 3 different places/tasks.
Up to 2 of them run on the playership...
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.

Lancefighter
Posts: 3144
Joined: Sun, 19. Dec 04, 02:41
x4

Post by Lancefighter » Sun, 8. Mar 09, 00:03

erm.

Ill take your word that it will work then :?

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Sun, 8. Mar 09, 00:18

Lancefighter wrote:(whats a good out of game editor type thing for x3tc files?)
to view the best thing is firefox or ie as long as the script is in the same folder as the x2script.xsl found in your scripts folder ( i have a temp folder with that file in to view scripts while keeping them away from the game directory)


to edit, the script editor, unless i've missed something seriously major there is no stable standalone editor, alterations via the script editor are the only way i know of
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sun, 8. Mar 09, 00:33

Just follow the tasks...
At the Work: part it starts spawning into different places and it eventually runs on 3 different timers simultaneously.

Sure, I could have split it into 3 scripts but since AL plugins are already perfectly suited to act as their own library I just wrapped it all in one.

Since it's a very small project (1-2 pages of script per task) there was no danger of losing track of things. In fact I wrote it, turned it on, and it worked...
It's really very simple once you acquire the proper multiple schizophrenia.
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.

pelador
Posts: 1399
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by pelador » Sun, 8. Mar 09, 00:40

Exscriptor - works well as an external editor (so far I have found it to be relatively stable)

Fightin 501st
Posts: 8
Joined: Sat, 28. Feb 09, 13:20

Post by Fightin 501st » Sun, 8. Mar 09, 10:34

[angelic choir]alleuiaaaaaaaaa[/angelic choir]
A dog isn't a mans best friend;

A gun is.

INSTG8R
Posts: 166
Joined: Sun, 30. Jul 06, 09:04
x3tc

Post by INSTG8R » Sun, 8. Mar 09, 17:32

Fightin 501st wrote:[angelic choir]alleuiaaaaaaaaa[/angelic choir]
Amen to that!

Thanks so much Gazz for making this Script!!! :D 8)

adecoy
Posts: 208
Joined: Wed, 24. Jan 07, 06:26
x3tc

Post by adecoy » Mon, 27. Apr 09, 20:18

thanks for this! no longer will i be afraid to use missiles! :thumb_up:

User avatar
Predator02
Posts: 483
Joined: Sat, 28. Jul 07, 00:05
x4

Post by Predator02 » Mon, 27. Apr 09, 23:39

This is a wonderful script, especially with heavy explosive torpedoes.

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sat, 16. May 09, 17:38

Version 1.05 released.

Prepared script to be used by AI ships.

They will not actually make use of it until the script call is tied into the fight scripts.
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.

aka1nas
Posts: 1414
Joined: Thu, 7. Jul 05, 05:17
x4

Post by aka1nas » Mon, 18. May 09, 00:28

Gazz wrote:Version 1.05 released.

Prepared script to be used by AI ships.

They will not actually make use of it until the script call is tied into the fight scripts.
Woohooo! Can't wait until it's ready! Is that going to be a part of your OOS redux?

User avatar
TSM
Not a Moderator
Posts: 2947
Joined: Thu, 1. Jul 04, 12:31
x4

Post by TSM » Mon, 19. Oct 09, 21:34

Gazz excellent job as usual,only realised how much I needed this when I fired a hurricane and it blew up right next to me and forced change of underwear :wink:
FAQ's Egosoft Interactive FAQ
Egosoft Wiki

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Tue, 20. Oct 09, 11:24

I'm not going to rename it to Underwear Safety, though.


aka1nas wrote:Woohooo! Can't wait until it's ready! Is that going to be a part of your OOS redux?
There is no direct connection but for the OOS Rebalance I had to rewrite the stock ES scripts anyway so I placed the hooks for this one while I was there.
If MS is installed as well, AI ships (including yours) should then make use of it.
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.

aka1nas
Posts: 1414
Joined: Thu, 7. Jul 05, 05:17
x4

Post by aka1nas » Wed, 21. Oct 09, 02:16

Crap, it's been working on AI ships all this time(I've been running both scripts for a while now)?! I'll have to go and watch them, I didn't notice. :oops:

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Wed, 21. Oct 09, 12:26

If AI ships don't spontaneously combust for no apparent reason then it's probably working.
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.

aka1nas
Posts: 1414
Joined: Thu, 7. Jul 05, 05:17
x4

Post by aka1nas » Thu, 22. Oct 09, 04:26

Gazz wrote:If AI ships don't spontaneously combust for no apparent reason then it's probably working.
A good point. I've been running CODEA pretty heavily as well, which takes over the missile launching for it's fighters, so my ships tend not to even fire missiles when enemies are very close.

Post Reply

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