[MOD] Station Push wares v0.02 9 August 2016

The place to discuss scripting and game modifications for X Rebirth.

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

Post Reply
jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

[MOD] Station Push wares v0.02 9 August 2016

Post by jth » Sun, 17. Apr 16, 14:28

09 August 2016

v0.02 is up on Steam, and Nexus

http://www.nexusmods.com/xrebirth/mods/490

Changes in v0.02

Improved find/prefer own stations for existing cargo irrespective of price

Allowing a ship to sell wares that are resources to its home station will help when you use one station to centrally produce large amounts of one ware, such as Chemical Compounds. The other changes are aimed at emptying out the cargo as quickly as possible to get it back in use but without messing about with tiny trades.

This mod does the following

This reproduces the effect from previous games, like X3TC, where wares were fed directly into other connected stations by using manager trading ships more effectively.

Player stations will actively push goods to other player owned stations to keep all your stations producing and maximise production of the most complex (expensive) wares.

When this mod is first enabled it should generate a flurry of extra trades which will hog the cargo ships while it shifts stock to your other stations. After a while it should have sorted things out and the volume of these trades should reduce giving the cargo ships back to the vanilla rules.

The extra trades that this creates are in addition to the vanilla ones and have a priority mid way between construction vessels and the vanilla trading

It is aimed at players with lots of stations but will still do a couple of useful things with only the plot URV station

Also has a bonus feature which returns ships to their home station when idle (if in home sector) to reduce clutter

Its save game compatible. Although it does generates additional standard trades which are in the save game until they complete. Disabling the mod should still allow these additional trades to complete as they are processd by other vanilla scripts (may take 10 -15 mins).

Things that you should be aware of

The way that funds flow with the extra player to player transactions is the same as in the vanilla game. The vanilla game doesn't appear to charge for transactions between a ship that is commanded by a station and that station but does charge if the ship trades with another station that is not its commander. This can cause you grief with individual manager account balances bouncing up and down.

There are two ways round this that I am aware of

My Free player to player trades which doesn't charge for player to player trades and works by doing custom trades between player assets at 0 Cr.

UniTrader's UTAdvent02 Manager Account Sharing to allow all your stations to share one balance

The Station Push Wares mod

Vanilla trading requires that a station is selling at under average price which means greater than 50% stock and that the buying price is greater than the selling price

This tends to cause a lot of stock to build up at the lower levels of the pyramid before anything is shipped upwards and a lot of supply glitches

The vanilla rules are setup for maximum financial gain which means maximum size transactions, this tends to cause a glut of a particular ware on one station and a shortage of the same ware on another

So for player manager controlled trading ships change the rules to

Code: Select all

When trying to find a buy offer for wares in our ships cargo first
    *Add*. Find/prefer own stations and CV's for existing cargo irrespective of price
Allows the selling of wares that are resources to its home station
Weeds out trades that are less than 5% of the destinations capacity for the ware to allow the vanilla rule to be reached and the remainder of the cargo to be sold to anyone
Checks all existing cargo in one go and trades the ware with the highest relativeprice (priority)

Code: Select all

When checking if we can sell products from our station somewhere
    *Change*. Allow player stations to sell wares at 10% stock
	*Add*. Allow player stations to buy player wares irrespective of price
Buying is prioritised by relativeprice to fulfill the most urgent orders first and even out stock levels
Min trade 10pc of prod capacity (allows vanilla trading rules to be reached and is much more efficient in the use of the ships)
Limit max trade amount per transaction to 25pc of prod capacity. relativeprice should drop when a station gets its 25% and hopefully the next station will have a higher priority the next time around

Ships also have/had a tendency to go off buying stuff when they should have been selling it up the pyramid

Code: Select all

When checking if we can buy resources for our station somewhere	
	*Change*. Prevent player stations from buying wares above 10% stock if they have a station that produces the ware
Trading ships stop next to where they did their last trade if there in no more work from them which clutters the place up

Code: Select all

When can't find anything good at the moment... wait a while, then check again
   *Add*. Return ship to home station when idle if in home sector
The combination of these five changes is much more aggressive at shifting wares to your other stations and keeping them producing

There is a circular trading rule that prevents any station from buying and selling to itself which means that it should work fine with warehouses but otherwise doesn't treat them any differently from manufacturing stations

Will still Allow player stations to sell wares at 10% stock and Return ship to home station when idle if in home sector even if you only have one station

Should be multi-lingual as far as the Extensions menu is concerned

Installation

To install it extract and copy the "station_push_wares" folder to the "Steam\steamapps\common\X Rebirth\extensions" folder (create the extensions folder if you don't have it already) or subscribe to it from Steam and restart the game.

Compatibility with other mods

This mod patches Egosoft's trade.findtraderun.xml

If another mod replaces trade.findtraderun.xml then this mods code will not be run and will not be compatible with it.

If another mod patches trade.findtraderun.xml then it may or may not be compatible depending on what it changes

Tradestation Network by Marvin Martian also Allows players stations to sell goods at lower stock in this case 30%. The exact value you get will depend on which mod patches first.

Galaxy Station Range by Yorrick Vander allows the station trading range to be set to Galaxy. The two mods seem to work well together and Station Push wares can be used with it to supply a player station in another Galaxy.

Known issues and Gotchas

This mod does not magically create wares, so for maximum effect, you still need to have enough production capacity of all of the required wares. Although it should do some good with just two stations provided that one of them consumes wares that the other produces.

This mod creates extra trades for player stations but still allows trades with player station via the vanilla rules if the price is right. The vanilla rules have no limits on trade amounts. The interaction of these two sets of rules can mean that trade amounts are difficult to predict.

Station trading operational range is enforced and is worth checking if a player station doesn't want to trade with another one.

If neither station or ship has any Cargolifters then the trading ship will still pick up the ware, fly to its destination and dock BUT the trade will fail with "reasoncode 65536 (0x10000 - 0000000000000010000000000000000b)!". The vanilla code does this too.

Diagnosing issues or getting more info on what the mod is doing (trade_findtraderun_debug)

[26/07/2016 CHANGED this section ]
To enable full debuging of all trade transactions (initiated by this mod and the vanilla code) install the optional trade_findtraderun_debug mini mod from Nexus

http://www.nexusmods.com/xrebirth/download/2204

Its also visible as an Optional file under Station Push wares Files

http://www.nexusmods.com/xrebirth/mods/490

Start X Rebirth in debug logging mode by adding -debug all -logfile debug.log to the end of the command line

Hope you like the mod :-)

jth



************ Original first Post - Player station subordinates to only sell wares ****************

The title is a bit of a mouthfull :)

I would like to get bottom up manufacturing going properly. The idea is that I have Basic raw material factories (Solar and food) that have ships and they sell goods to stations higher up the triangle. Then the higher ones sell to the ones above them and so on.

The bottom layer of energy and water works fine because there is either no primary resources or the ware fits in a different storage type than the product. The food layer can be problematical and the next layer above that is even more of a problem as most things use storage containers.

Its possible to do some things with station placement and trading range to help but it still tends to leave a few holes.

The big problem occurs when the product uses the same type of storage as the resources. Then there is a nasty habit of the station subordinate ship going off to buy resources when it should be shipping products to the next layer of my production empire and of course everything grinds to a halt :(

One possible solution would be to prevent station manager commanded ships from buying resources.

I haven't done any ai script modding yet

I have had a quick look around and identified the trade.station.player ai script as the one that might do the work.

What I was thinking is that if I empty the $resources list then any player station subordinate ships will simply not have any resources to buy.

So if I changed line 38

Code: Select all

        <set_value name="$resources" exact="this.station.resources.list" />
to

Code: Select all

        <set_value name="$resources" exact="[]" />
it might do what I want

Am I looking in the right place and is the approach valid or not ?

Has anyone else addressed the problem already ?

Regards

jth
Last edited by jth on Fri, 2. Sep 16, 13:22, edited 39 times in total.

User avatar
Marvin Martian
Posts: 3547
Joined: Sun, 8. Apr 12, 09:40
x4

Post by Marvin Martian » Sun, 17. Apr 16, 14:44

at Tradestation Network i simply use a chance="0" at the find_buy_offer in trade.findtraderun to do this

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Sun, 17. Apr 16, 17:12

Marvin Martian wrote:at Tradestation Network i simply use a chance="0" at the find_buy_offer in trade.findtraderun to do this
Thanks for the reply

I have downloaded the Tradestation Network mod and had a look at the code from trade.findtraderun

Its very interesting I have learnt several things :)

I had no idea that you could patch a new parameter into an existing command and I didn't know that the chance parameter existed

I got the magnifying glass out on the picture from your mod and found my way to the options :)

I don't really see much point in me re-inventing the wheel ...

Regards

jth

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Mon, 18. Jul 16, 13:42

Changed my mind on this one :-)

I have been playing with the idea of getting X Rebirth to behave more like X3TC and to push wares up

After several months effort I have decided that I ought to share this one after all as Station push wares

Regards

jth

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Tue, 9. Aug 16, 17:05

- [09.08.2016 - V0.02 Public Beta]
Improved find/prefer own stations for existing cargo irrespective of price
  • Moved before equivalent vanilla code to sell to player assets before NPC's
    By moving the location of this code it no longer prevents the selling of wares that are resources to its home station
    No longer excludes player CV's when checking where to sell existing cargo (vanilla code did this work before)
    Weeds out trades that are less than 5% of the destinations capacity for the ware, allows the vanilla rule to be reached and the cargo to be sold to anyone
    Now checks all existing cargo in one go and trades the ware with the highest relativeprice (priority)
Removed optional trade debug patch code and moved it into a separate mod (trade_findtraderun_debug) to allow debugging while still using the Steam version of this mod

Adjusted content of readme.txt to agree better with the description that is up on Steam, Nexus and the Egosoft forum thread

jth

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Mon, 13. Feb 17, 00:19

Hi mate,

Thanks by your mods!

Is this one compatible with Yat2?
I guess that Yat2 is a more universal trade mod and this one is aimed to supply player's CVs and player's stations only, right?
So perhaps these mods are complementary to each other and can run at same time?

Thanks by any advice!

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Mon, 13. Feb 17, 00:48

there shouldnt be any interference.. this Mod basically changes the way Ships working for stations search for Trades, and YAT adds an own Set of Scripts which does universe Trading. Not sure if it includes the script changed with this mod at some point, but even if it shouldnt matter much..


EDIT: corrected mistake
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Mon, 13. Feb 17, 18:18

I think that YAT is turned on ship by ship, so if a ship is being controlled by YAT then its not available for the station manger vanilla rules that this mod tweaks. Basically by replacing the scripts that the selected ship uses YAT wins on that ship and my changes are skipped on that ship. So there should be no direct conflict.

If you leave at least one ship under the station managers control via the vanilla scripts then Station Push wares should also work for that station.

Mix and match ship by ship "should" be possible :-) I hope :-)

jth

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Mon, 13. Feb 17, 21:39

Thanks by the infos Uni & jth.

I will then try both and come here late with my observations.

Cheers!

Post Reply

Return to “X Rebirth - Scripts and Modding”