[SCR] Safe undocking / jumping (v1.00, 08.04.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: 12423
Joined: Fri, 13. Jan 06, 17:39

[SCR] Safe undocking / jumping (v1.00, 08.04.12)

Post by Gazz » Sun, 8. Apr 12, 17:45

English / Deutsch (no text - works in every language)


Safe undocking / jumping . . . Written for AP. Not tested with TC.

Ever since Reunion came out, there have been certain ships that would explode when the player manually undocked them from certain stations.
This only got worse with TC and AP, since more and bigger ships and stations entered service.

I fixed it.


What this script does:

If the playership manually undocks from anything or enters a new sector by any means, it's collision detection is disabled.

Collisions are reenabled if any of these conditions is true:
  • autopilot is enabled
  • ship's speed is reduced
  • ship's course is changed (10° dead zone for the benefit of joystick users)
  • ship is clear of the closest ship, station, gate, and asteroid.
    (these 4 objects are searched for once, at the moment of launch)
  • the player changes ships
  • the player goes to a different sector or docks somewhere
  • 60 seconds expire
There are no watcher scripts constantly running in the background.

Not only does this fix the typical issue of undocking a Khaak Corvette from a Kyoto or many stations, it also avoids other stupid situations.
If you emerge from a gate in a TM and immediately launch in a fighter, you are usually catapulted straight into the gate superstructure. This can no longer happen since gates are one of the 4 types of checked navigational hazards.
If you emerge from a gate and find yourself inside another ship, don't panic and don't touch anything. Strafe (that is not a course change) or accelerate away.


The inspiration for this script was this. I just didn't agree with the way they did it. =P


ImageDownload: ZIP

Installation: extract the ZIP into the "X3 Terran Conflict" folder. The correct folder structure is already included.


Resources used: none
Last edited by Gazz on Sun, 8. Apr 12, 18:12, edited 4 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: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Sun, 8. Apr 12, 17:46

*** reserved ***

greypanther
Posts: 1114
Joined: Wed, 24. Nov 10, 21:54

Post by greypanther » Sun, 8. Apr 12, 19:53

Does that mean I can download it the same way and try it with TC? Or wouldn't you recomend it? :)
Pray that there's intelligent life somewhere up in space
'Cause there's bugger all down here on Earth

Jumee
Posts: 2204
Joined: Sat, 29. Oct 11, 20:19

Re: [SCR] Safe undocking / jumping (v1.00, 08.04.12)

Post by Jumee » Sun, 8. Apr 12, 19:56

Gazz wrote:I fixed it.
and I salute you! :thumb_up: :D

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Sun, 8. Apr 12, 20:54

greypanther wrote:Does that mean I can download it the same way and try it with TC? Or wouldn't you recomend it? :)
Oh, it would work.
The only thing I'm not sure about is if all the find instructions (for gates etc.) will return the correct result. The rest is pretty standard fare so at least most of it should work.

If you uncomment the "Debug" line at the top of the script, you get a running documentary of what the script does (in a log file), including what it has successfully detected.
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.

greypanther
Posts: 1114
Joined: Wed, 24. Nov 10, 21:54

Post by greypanther » Sun, 8. Apr 12, 22:03

Thank you, then I will give it a try I think. I have decided TC next with mods. I will play AP when Argonaught completes his conversion of his menagerie shipyaed. I presume nothing catastrophic will happen, but will come and rant at you if it does! :wink:
Pray that there's intelligent life somewhere up in space
'Cause there's bugger all down here on Earth

User avatar
Vayde
Posts: 843
Joined: Fri, 6. Feb 04, 22:02

Post by Vayde » Mon, 9. Apr 12, 11:30

Nice work, simple and elegant.

As an aside could this also be ran on ships owned by the player when player is in sector. So when I do go back to terran sectors my Spingblossoms don't explode when undocking?
Still life in the old dog yet...

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Mon, 9. Apr 12, 14:58

Ships under AI control have their collision detection turned off by the engine.
That's why you can easily dock your oversized ship in a Kyoto since docking is usually done via autopilot = AI control.

Merely "switching to" a ship on your carrier launches you under manual control. Boom.
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.

feygan
Posts: 145
Joined: Fri, 26. Dec 03, 19:41

Post by feygan » Mon, 9. Apr 12, 16:41

How does this work alongside the advanced navigation script? I know that has a collision switch for when ships exit from a warp gate, do the two conflict?

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Mon, 9. Apr 12, 18:29

No idea. I never used that script.
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: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Fri, 13. Apr 12, 13:30

Vayde wrote:When in an m5 and undocking from lets say Terracorp HQ, should I drop a few feet from the docking clamp then accelerate to top speed and fly through the station superstructure instead of following the normal exit lane lights?

I almost shit a brick the first time it happened :)
The real problem is that often there is no proper alignment when launching manually.

The script simply employs a WHATEVER, GET ME OUTTA HERE strategy, getting you clear of any object you launch from, regardless of any physical collision woes.
If the game allows a ship to dock at [object], the ship should also be able to safely launch from [object]. KISS.

To do that in a pretty, graphically correct way, you'd have to alter the engine and most likely a lot of models. Not my problem field. =)
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
Charon_A
Posts: 103
Joined: Wed, 6. Nov 02, 21:31

Post by Charon_A » Sun, 13. May 12, 19:53

Gazz, first of all thanks for the script!
But the issue with flying through the station structure afetr undocking is indeed unnerving :)
So I decided to remove the script - alas, that part is not that easy. Having deleted "setup.gz.safe.undocking.xml" I can't make a jump to any sector - game hangs with the black screen before rendering the sector I am jumping into. Tried several ships. I am using Albion Prelude, latest patch. Any ideas how to properly remove the script without hanging the game? Thanks!
Be careful about reading health books. You may die of a misprint.
---Mark Twain---

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Mon, 14. May 12, 18:05

The easiest way would be to edit the script and copy / paste a "return null" to the first line of the script.
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
Charon_A
Posts: 103
Joined: Wed, 6. Nov 02, 21:31

Post by Charon_A » Thu, 17. May 12, 15:57

Gazz wrote:The easiest way would be to edit the script and copy / paste a "return null" to the first line of the script.
Thanks Gazz! Your suggestion worked.
For those who might wonder where exactly to insert "return null" if you edit script directly - it should go between these lines:

Code: Select all

<![CDATA[
  return null
  *$Debug = 781
Be careful about reading health books. You may die of a misprint.
---Mark Twain---

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Sun, 20. May 12, 21:35

Well, the reason was that the script was still being called ingame but the call went to lala land because the script was gone.
Lala land is undefined in the scripting engine so that's not going to work.
Having the script called properly... but not doing anything whatsoever... is a lot safer.
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.

Post Reply

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