[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, 22:13
x4

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

Post by Panzertard » Sat, 10. Dec 05, 11: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, 09:47, edited 8 times in total.
/Panzertard

ShoC
Posts: 693
Joined: Sun, 8. Feb 04, 15:06
x4

Post by ShoC » Sat, 10. Dec 05, 12: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, 22:13
x4

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

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

ShoC
Posts: 693
Joined: Sun, 8. Feb 04, 15:06
x4

Post by ShoC » Sat, 10. Dec 05, 17: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: 77
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Sat, 10. Dec 05, 18: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: 2271
Joined: Sat, 4. Jun 05, 10:36
x3tc

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

how does the fuel[energy cells] get to the UT is it NPC mercury or something

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

Post by Zzyn » Sat, 10. Dec 05, 23: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, 22:13
x4

Post by Panzertard » Sun, 11. Dec 05, 00: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, 22:13
x4

Post by Panzertard » Tue, 20. Dec 05, 15: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, 02:32, edited 1 time in total.
/Panzertard

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

Post by Stevio » Tue, 20. Dec 05, 18: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, 22:09, edited 1 time in total.

X-it
Posts: 1311
Joined: Wed, 6. Nov 02, 20:31
x3

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

Lebowske,

This looks excellent! Thank you very much.

Dungeoncrawler
Posts: 1093
Joined: Sun, 7. Dec 03, 05:32
x3tc

Post by Dungeoncrawler » Mon, 26. Dec 05, 10: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, 22:13
x4

Post by Panzertard » Mon, 26. Dec 05, 18: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: 1093
Joined: Sun, 7. Dec 03, 05:32
x3tc

Post by Dungeoncrawler » Tue, 27. Dec 05, 03: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, 22:13
x4

Post by Panzertard » Tue, 27. Dec 05, 09: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

X-it
Posts: 1311
Joined: Wed, 6. Nov 02, 20:31
x3

Post by X-it » Tue, 27. Dec 05, 10:19

Lebowske,

Just installed this on my new 1.3 game as I've just started training my first ST.

Anyway, when overwriting the file, I noticed that the old file was dated Nov. 29. Was that a new version from 1.3, or a version from a previous patch? If it's a new file, have you checked for any new features? You probably have, but I just had to ask... :P

Thanks again for a nice fix!

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

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

Thanks X-it. Sorry, I've just installed 1.3 myself. I have to review the new file in 1.3 if they have updated some of the content. I'll have a look at it a bit later tonight. ;)
/Panzertard

TinkerBell
Posts: 145
Joined: Sun, 20. Jun 04, 18:13
x3tc

Post by TinkerBell » Tue, 27. Dec 05, 14:23

plugin.autotrade.delivery has been updated to always use Mercuries in 1.3.

Code: Select all

117   $upgrade.ship.type = Mercury
118   skip if not $upgrade.race == Argon
119    $upgrade.ship.type = Mercury
120   skip if not $upgrade.race == Boron
121    $upgrade.ship.type = Mercury
122   skip if not $upgrade.race == Split
123    $upgrade.ship.type = Mercury
124   skip if not $upgrade.race == Paranid
125    $upgrade.ship.type = Mercury
126   skip if not $upgrade.race == Teladi
127    $upgrade.ship.type = Mercury
128   skip if not $upgrade.race == Pirates
129    $upgrade.ship.type = Mercury
So I don't think you fix is needed any more? :? ?

UPDATE: There's still problems. Change plugin.autotrade.delivery to

Code: Select all

008 $maxamount = 2700
Last edited by TinkerBell on Sun, 1. Jan 06, 12:35, edited 1 time in total.

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Wed, 28. Dec 05, 13:07

Just to clarify, this fix only fixes the UTs by making sure that 500 cells are delivered when requested?

User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek » Thu, 29. Dec 05, 02:40

Hey guys, we've opened a new script testing / signing forum open to lvl3 users and above. Tommorrow we're going to try to upload a newer version of Mk3 that contains some of the fixes you wonderfully diligent people have discovered. (thx)
If anyone wants to download a new version and test it for us on an unsigned basis, that would be wonderful.
(unsigned means you'll have to have the script editor enabled in order to use the scripts, they are betas, not release versions)
If anyone has problems accessing the lvl 3 forum or needs to know how to become lvl3 you can do so by visiting your profile and entering some additional info. Once you're lvl3, you should be able to see and post in the new script testing forum. Make certain to read the rules CAREFULLY before posting. The rules are different in testing forums.
Cheers.
"Nature's first green is gold" . . . stay golden.

Locked

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