[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: Scripting / Modding Moderators, Moderators for English X Forum

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

[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


[ external image ]Download: 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: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

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

*** reserved ***

greypanther
Posts: 7307
Joined: Wed, 24. Nov 10, 20:54
x3ap

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: 2893
Joined: Sat, 29. Oct 11, 20:19
x3tc

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: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

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: 7307
Joined: Wed, 24. Nov 10, 20:54
x3ap

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

Vayde
Posts: 849
Joined: Fri, 6. Feb 04, 21:02
x3tc

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: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

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: 147
Joined: Fri, 26. Dec 03, 18:41
x4

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: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

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: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

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: 105
Joined: Wed, 6. Nov 02, 20: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: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

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: 105
Joined: Wed, 6. Nov 02, 20: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: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

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.

Hammerit
Posts: 17
Joined: Fri, 8. Oct 04, 09:14
x3tc

Post by Hammerit » Mon, 21. May 12, 16:26

Thanks for taking the time to fix issues Egosoft clearly never really bothered to address :).

Almost as infuriating as exploding while undocking manually is the fact that certain hired TLs sometimes go boom while undocking from certain stations (they actually headbutt the station :wall:).

Sure fire reproduction at least in my game (vanilla - latest version):
1. Hire the Orca in sector "Queen´s Retribution"
2. Command it to dock with the Shipyard
3. Wait till it's docked
4. Command it to fly to sector "Queen´s Harbour" (making it turn 180°)
-> Boom

Might be that the Boron are direct descendants from japanese bomber pilots, but it's not very nice of the game to have the player loose a few millions worth of stations in the cargohold of a TL that for no reason whatsoever steers right into a frickin Shipyard.

When this happened the first time I wondered where the Orca had gone as it never showed in "Queen´s Harbour". So I backtracked to the Shipyard only to find some loot floating below it. It was fully loaded with all the stations I wanted to plant in the neighboring sectors :(.

Would be cool if you could fix that too :).
Reading this point earned you +10 notoriety.

dracotonisamond
Posts: 8
Joined: Sat, 14. Jul 12, 08:48
x4

Post by dracotonisamond » Sat, 14. Jul 12, 08:53

not sure if its a conflict between another script but after i installed this hoping it would fix my PHQ's hatred for my aran when ever i undock from my PHQ( not sure if it happens with other stations) my ships are set to full throttle and tunnel through what ever is in front of them.

is this intentional, bug, or conflict?

Edit: ive added a return null in the script, but my ship still goes wizzing forward when i undock...

can be quite harrowing trying to maneuver my kestral scout ship away from a ship docked right in front of me at the last second...

is there any way to cleanly uninstall this script without hanging it?

Vayde
Posts: 849
Joined: Fri, 6. Feb 04, 21:02
x3tc

Post by Vayde » Sat, 14. Jul 12, 18:39

That's normal behaviour for the script dracotonisamond, collisions are turned off for 10 secs. For most ships this is enough to get them clear of the station superstructure however with the Aran being so slow and also a huge ship, 10 secs might not be enough.
Still life in the old dog yet...

xiriod
Posts: 1131
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by xiriod » Sun, 26. Aug 12, 03:20

I had to remove this script for various reasons, or rather I want to, but when I do the game hangs whenever I try to undock from stations. Freezes. If I remove it while I am in space game freezes next time I go through a gate.

Is there any way we could have an uninstall script as well? :wink:

EDIT: Seemed all I needed to do was this:

Code: Select all

global secondary signal map: remove signal={SIGNAL_CHANGESECTOR} race={Player} class={Moveable Ship} name='safe.undock'
return null
It works again now, I can play, but was that enough as removal goes?

Ferenczy66
Posts: 142
Joined: Sat, 14. May 11, 07:09
x3tc

Post by Ferenczy66 » Wed, 26. Dec 12, 16:38

dracotonisamond wrote: is there any way to cleanly uninstall this script without hanging it?
Same question...

Post Reply

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