[FIX] - TS out of energy, cannot deliver to NULL (Updated 20.12.2005)

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

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

Panzertard
Posts: 89
Joined: Tue, 29. Nov 05, 23:13
x4

[FIX] - TS out of energy, cannot deliver to NULL (Updated 20.12.2005)

Post by Panzertard » Sat, 10. Dec 05, 12:40

There's many ways to fix this problem - however I think tried to stay within the intentions of the designers of the script "plugin.autotrade.fuel"

The problem when the UT (universe trader) cannot find fuel within 1 jump. It's questionable if they should search within 1 jump only - but I decided not to change this.

Instead - when the UT cannot find fuel it's supposed to order a fuel delivery. And it does. The exception happens when the "wanted amount" of fuel is larger than the amount allowed to be delivered.
The largest amount allowed to be delivered is hardcoded into the script - and is 500 units of cargo.
This code is within the file "plugin.autotrade.delivery.pck"

So I've added a little exception within the exception - saying that if the delivery is Energy Cells, go ahead with the delivery anyway - but deliver only 500 units.

-----------------------------

Update 20.12.2005
I've got a PM from CBJ giving me permission to allow the file to be downloaded.

DOWNLOAD: Download the file here

Instructions:
1. Download the file.
2. Make a copy (backup) of the file \scripts\plugin.autotrade.delivery.pck
You may need the original file during patching to 1.3 and such.
3. Extract the ZIP file
4. Place it in the "\scripts" directory - overwrite if the old if you made a copy if it.

Now comes the tricky part - which Im not 100% sure of:
5. Enable the script Editor.
6. Open the Script Editor - and use "Reinit script cache".

Now this part should be simple:
7. When a UT is out of fuel - just use "Start Universe Trader" and it will use the new version of the file. Even if it's out of fuel it will order a delivery of fuelcells and start up again.

Point 5 & 6 - Im not sure if you really need to enable the script editor for the new version of the file to be loaded. Can someone without the script editor enabled try this? Feedback please. :)

-----------------------------


OP - not needed if you downloaded the file.
If you want to see the change however, here's the original post:


Since the code is copyright protected I wont add a file for download - you need to edit this yourself. (Unless someone gives me permission to put a link to the new version here of course.)

Please use the instruction in the sticky how to enable the builtin Script Editor (SE).
You need to download X2 Modder to extract the PCK file.

1. Extract the "\scripts\plugin.autotrade.delivery.pck" into "\scripts\plugin.autotrade.delivery.xml" using X2 Modder.
2. Start X3 and enable the scripteditor.
3. Open and edit the "plugin.autotrade.delivery" script.
4. In the header change version number fom 2 to 3.
5. Go down to line 36 where it reads:

Code: Select all

036   $upgrade.volume = get volume of ware $upgrade
037   if ( $upgrade.volume * $amount ) > $maxamount
038     $exception = 36
039     goto label failure
040   end
6. Press insert and add code until it looks like this:

Code: Select all

036   $upgrade.volume = get volume of ware $upgrade
037   if ( $upgrade.volume * $amount ) > $maxamount
038   * -
039   * We need to make an exception if we are talking about fuel delivery
040   * lets reduce the amount wanted so we can 'properly' use the delivery
041   * -
042    if not $upgrade == Energy Cells
043     $exception = 36
044     goto label failure
045    end
046    $amount = $maxamount
047   end
7. Press ESC and Yes to save the file.
8. Exit X3 and rerun X2 Modder. Compress the file you modified. delete the XML file.
9. Start up X3 again.

Important - use the "Reinit Script Cache" when you get back to the SE menu.

The NEXT time you start up the UT again the fix will work.

All UT's will may at least once unless you re-use the "Start Universe Trader" - just tell them "Start Universe Trader" again - and the fixed script will be loaded for that UT.

Now you can sit back and relax, and watch a transport arrive at the station delivering 500 units of Energy Cells for your UT.

Cheers ;)

EDIT: Added the version number change in step 2.
Last edited by Panzertard on Tue, 27. Dec 05, 10:47, edited 8 times in total.
/Panzertard

ShoC
Posts: 595
Joined: Sun, 8. Feb 04, 16:06
x4

Post by ShoC » Sat, 10. Dec 05, 13:34

Is there no way you can E-mail me the file over?
I know ill only mess it up ^^

ShoC0019@hotmail.com

P.s sorry if im breaking any rules posting my e-mail up not sure if its against the rules
they have had almost 1000 years to terraform Aldrin, why are they all still sitting around a giant rock?

Catra wrote:
because you cant terraform a rock.

Panzertard
Posts: 89
Joined: Tue, 29. Nov 05, 23:13
x4

Post by Panzertard » Sat, 10. Dec 05, 16:43

Sorry - I dont dare sharing the file until someone with knowledge / a moderator tells us if this is possible. Sorry.
/Panzertard

ShoC
Posts: 595
Joined: Sun, 8. Feb 04, 16:06
x4

Post by ShoC » Sat, 10. Dec 05, 18:13

Understandable :)

p.s why dont you PM a moderator
they have had almost 1000 years to terraform Aldrin, why are they all still sitting around a giant rock?

Catra wrote:
because you cant terraform a rock.

Zzyn
Posts: 75
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Sat, 10. Dec 05, 19:07

You have one further potential problem. :-)

I just solved this in my addition to the MK3 trader that limits its trading to sectors where you have Satilites. (its neat, I want to post it soon, almost ready)

Anyway: The ships that do the delivery aren't all large ebough to deliver the amount you may be requesting...

If you want specifics to how I solved this problem, just let me know.

-Zzyn

User avatar
Stevio
Posts: 1983
Joined: Sat, 4. Jun 05, 10:36
x3tc

Post by Stevio » Sat, 10. Dec 05, 19:41

how does the fuel[energy cells] get to the UT is it NPC mercury or something
My Scripts
Image
So say we all!

Zzyn
Posts: 75
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Sun, 11. Dec 05, 00:00

It goes based on the origination of the ware..

The orig code has:
116 $upgrade.ship.type = Pirate Falcon
117 skip if not $upgrade.race == Argon
118 $upgrade.ship.type = Mercury
119 skip if not $upgrade.race == Boron
120 $upgrade.ship.type = Shark
121 skip if not $upgrade.race == Split
122 $upgrade.ship.type = Unknown Object
123 skip if not $upgrade.race == Paranid
124 $upgrade.ship.type = Perseus
125 skip if not $upgrade.race == Teladi
126 $upgrade.ship.type = Vulture
127 skip if not $upgrade.race == Pirates
128 $upgrade.ship.type = Harrier
A harrier?!?

Anyway, I updated in my new MK to make it use ships that will be big enough to refuel you. Considering the code considers 20% of your space to be the fuel space, that can easily pwn a harrier.

My updated code is:
118 $upgrade.ship.type = Mercury
119 skip if not $upgrade.race == Argon
120 $upgrade.ship.type = Mercury
121 skip if not $upgrade.race == Boron
122 $upgrade.ship.type = Dolphin
123 skip if not $upgrade.race == Split
124 $upgrade.ship.type = Caiman
125 skip if not $upgrade.race == Paranid
126 $upgrade.ship.type = Demeter
127 skip if not $upgrade.race == Teladi
128 $upgrade.ship.type = Vulture
129 skip if not $upgrade.race == Pirates
130 $upgrade.ship.type = Pirate Ship
Thus, guaranteeing he can bring it.. I upped the cost too to 12.5%, rather than 10% to accommodate.

Cheers,
Zzyn

Panzertard
Posts: 89
Joined: Tue, 29. Nov 05, 23:13
x4

Post by Panzertard » Sun, 11. Dec 05, 01:23

Zzyn - good point - however I just sought a solution to the annoying player log spam from the UT because they run dry all the time.
When you release your mod we'll be able to use it - or Egosoft releases 1.3 (if they fixes it there).

Keep up the good work though :)
/Panzertard

Panzertard
Posts: 89
Joined: Tue, 29. Nov 05, 23:13
x4

Post by Panzertard » Tue, 20. Dec 05, 16:29

Update 20.12.2005
I've got a PM from CBJ giving me permission to allow the file to be downloaded.

DOWNLOAD: Download the file here

Instructions:
1. Download the file.
2. Make a copy (backup) of the file \scripts\plugin.autotrade.delivery.pck
You may need the original file during patching to 1.3 and such.
3. Extract the ZIP file
4. Place it in the "\scripts" directory - overwrite if the old if you made a copy if it.

Now comes the tricky part - which Im not 100% sure of:
5. Enable the script Editor.
6. Open the Script Editor - and use "Reinit script cache".

Now this part should be simple:
7. When a UT is out of fuel - just use "Start Universe Trader" and it will use the new version of the file. Even if it's out of fuel it will order a delivery of fuelcells and start up again.

Point 5 & 6 - Im not sure if you really need to enable the script editor for the new version of the file to be loaded. Can someone without the script editor enabled try this? Feedback please. :)
Last edited by Panzertard on Wed, 21. Dec 05, 03:32, edited 1 time in total.
/Panzertard

User avatar
Stevio
Posts: 1983
Joined: Sat, 4. Jun 05, 10:36
x3tc

Post by Stevio » Tue, 20. Dec 05, 19:33

i have been waiting to here if you have heard anything on being able to release this script.

i almost died from insanity

"ive run out of fuel"

pops up every 10 mins

p.s your pic is very disturbing

cheers

stevio
Last edited by Stevio on Tue, 20. Dec 05, 23:09, edited 1 time in total.
My Scripts
Image
So say we all!

X-it
Posts: 1217
Joined: Wed, 6. Nov 02, 21:31
x3

Post by X-it » Tue, 20. Dec 05, 20:38

Lebowske,

This looks excellent! Thank you very much.

Dungeoncrawler
Posts: 1074
Joined: Sun, 7. Dec 03, 06:32
x3tc

Post by Dungeoncrawler » Mon, 26. Dec 05, 11:12

Just installed your file. Seems to be working, thank you. I do have one question...my ship had docked to a station with some products it had bought, but gave the energy error before it was able to complete the sale. Will I need to manually sale these items?

DC

Panzertard
Posts: 89
Joined: Tue, 29. Nov 05, 23:13
x4

Post by Panzertard » Mon, 26. Dec 05, 19:01

Not sure if I understand you quite ... but this is what I think you're asking:

The script wont fix any "wares selling" problems. It will only fix the "UT not being able to order Energycells if their not within 1 sector range".
So if your UT is being outpaced by some other traded you will have to resolve the problem yourself. That's just fair - otherwise everything would be too automatically.

So yes, you have to resolve that problem - everytime.
/Panzertard

Dungeoncrawler
Posts: 1074
Joined: Sun, 7. Dec 03, 06:32
x3tc

Post by Dungeoncrawler » Tue, 27. Dec 05, 04:35

Lebowske wrote:Not sure if I understand you quite ... but this is what I think you're asking:

The script wont fix any "wares selling" problems. It will only fix the "UT not being able to order Energycells if their not within 1 sector range".
So if your UT is being outpaced by some other traded you will have to resolve the problem yourself. That's just fair - otherwise everything would be too automatically.

So yes, you have to resolve that problem - everytime.

Srry for the confusion :) . Not exactly what I was asking, but was able to solve it myself. My problem was that my TP ship was docked at a station, with its cargo bay full. After I installed your script, and activated UT, I wanted to know if it would sale the stock my TP already had in its cargo-bay from a previous buy before I recieved the e-cell error. The answer is no, you have to manually sale anything kept in your cargo-bay after you reactivate UT.

Also, you had stated that you did not know for sure if you had to use the script editor to restart the scripts after installing your script. The answer seems to be yes. I installed your file into my script folder, sent my UT'er off, and in about 30 minutes I got the same docked at station with no e-cell message from my UT's captain. I will activate with script editor and see what happens. Thank you for your time and effort in what I am sure will help out allot of people in the X3 universe.


Regards,

DC

Panzertard
Posts: 89
Joined: Tue, 29. Nov 05, 23:13
x4

Post by Panzertard » Tue, 27. Dec 05, 10:28

Ah yes, you're UT's will continue to use the "old" script until they run out of fuel at least one time each. The new script is only used when you re-issue the "Start Univers Trader". It's still possible to re-issue the command without using the script editor - however - Im not sure if you reallye have to enable the script editor for the new script to work. Please try again - and see if the one's you have re-issued the command to will run out of fuel.

Cheers :)
/Panzertard

Locked

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