[MOD] Mules and Warehouses v4.0

The place to discuss scripting and game modifications for X4: Foundations.

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

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 02:33

You can add any ware you don't make, like food and meds, to your warehouse.
To do that, use a Mule with :
as Source station a NPC station that sell the ware(s) you want to buy, and ONLY that.
as Target your warehouse.
Then activate Make Target Warehouse.

If you remove the Mule after the first trip, the buy/sell offers on the warehouse will still be there.
There is no way anyone can know that. you may add this to your "how to".
This is actually a function anyone needs who has no self sustaining factory yet.

Additionally this is not possible with ores and gases, because no station sells ores and Gases, so how to tell the warehouse to buy ores and gases?

I do not run out of questions yet, but i really want to make this system work in this savegame :-)

Edit:
Wow strange... i assinged it to a AI Medical Factory and targeted my warehouse, include food and meds, seller priority.
What does the mule do? Collecting hull parts from the warehouse and selling it to another station which is NOT the AI medical factory... now that is weird...
Last edited by Ramokthan on Sun, 16. Jun 19, 02:40, edited 1 time in total.

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Sun, 16. Jun 19, 02:40

Ramokthan wrote:
Sun, 16. Jun 19, 02:33
There is no way anyone can know that. you may add this to your "how to".
I said that Mules work the same between Player stations and NPC stations.
I see now that it wasn't obvious you could add wares you don't make to a warehouse.

I'll try to edit that description, but it is so long already ! :oops:
Also on Steam I hit the character limit on the description a lot of features ago...

You cannot in any way trade in gases and minerals. No trade ships can carry them, and the functions I use cannot 'add' them to a warehouse anyway.
You can only mine them with ships, and sell them to your stations or other. Mules can't help with that at all.

Edit :
Ramokthan wrote:
Sun, 16. Jun 19, 02:33
Wow strange... i assinged it to a AI Medical Factory and targeted my warehouse, include food and meds, seller priority.
What does the mule do? Collecting hull parts from the warehouse and selling it to another station which is NOT the AI medical factory... now that is weird...
First, you did create the trade offers on the warehouse, right ? :D
Then, if the volumes of wares on sale are under 80% of the cargo capacity of this ship, the mule will wait for more and default to trade in-cluster between your stations.

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 02:51

Êven if i activate the "Allow low volumes" ?
Spoiler
Show
Another strange thing i am currently observing is my mules buying wares of any kind on the warehouse and selling it on the same warehouse again.... oder and over again.
I am unable to see why they do that... it makes no sense....
Ignore that, seems it messed with the mod of PlayerWarehouse which was recommended. it made me able to buy stuff but obviously its buggy as hell. need to find another way to buy stuff at my warehouse.
Last edited by Ramokthan on Sun, 16. Jun 19, 03:03, edited 1 time in total.

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Sun, 16. Jun 19, 02:59

Ramokthan wrote:
Sun, 16. Jun 19, 02:51
Another strange thing i am currently observing is my mules buying wares of any kind on the warehouse and selling it on the same warehouse again.... oder and over again.
I am unable to see why they do that... it makes no sense....
Okay, that shoud not happen unless there are literally no other more urgent trades in the whole cluster of the Source. (or maybe you selected the warehouse as source and target ? :D )
The fact that it happens at all is still a problem, though. I'll look into it.

And if your warehouse has buy/sell offers for food and meds, and the mules have 'allow low-volume', they should buy any amount available.

Edit : try to buy food and meds manually in the NPC station, to see the amount on sale.
Just because it shows up in their storage doesn't mean it is for sale, another ship may have reserved it already.
Ramokthan wrote:
Sun, 16. Jun 19, 02:51
Ignore that, seems it messed with the mod of PlayerWarehouse which was recommended. it made me able to buy stuff but obviously its buggy as hell. need to find another way to buy stuff at my warehouse.
I use the two without bugs (obviously :D ). My mules always have something more urgent to move though, so they never traded between my warehouse and itself.
I can see how that would happen if there is nothing urgent to move only, I'll patch this soon so it never happens.
Last edited by LegionOfOne on Sun, 16. Jun 19, 03:37, edited 2 times in total.

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 03:14

The mules are supposed having something to do... like collecting energy from one of the factories since the factory stock is full and the warehouse stock is still not full.

dunno whats the logic is... i gotta stop for today, too tired.

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Sun, 16. Jun 19, 04:00

Ramokthan wrote:
Sun, 16. Jun 19, 01:02
Edit:
The mules start to deliver the product to the warehouse as soon as i assign the warehouse its recommended money stock, which is currently around 500k.
Didnt the description seid it does not need that in order to work? XD
I hadn't seen that, it may explain a lot.
Warehouses are not supposed to have anything as recommended budget.

The recommended budget, production budget and supplies budget should be zero (maybe that last one is more if you are building cargo drones).
If not, then you have added production modules, or habitations, or anything else that will completely mess up a warehouse.

Also, another tip I didn't think about because I already mentionned it on the Steam thread : all factories must have at least 1 credit of budget, not just warehouses.

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 11:14

Yep that may help.

I continue to troubleshoot, till i give up or it works. XD

Slowly i thing its developing into the right direction.
Still. Do Mules only begin emptying factories if they hit a certain threshold? Bc my Factory is like 40% full, much more then a mule capacity load and they dont deliver that wares to the warehouse. But if it goes over that 40% they start delivering again till it drops under that 40%.

I mean its not too bad but also not perfect. For my behalf they should empty it to 0 as long as their cargo can be filled almost completely.

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Sun, 16. Jun 19, 13:35

Ramokthan wrote:
Sun, 16. Jun 19, 11:14
Still. Do Mules only begin emptying factories if they hit a certain threshold? Bc my Factory is like 40% full, much more then a mule capacity load and they dont deliver that wares to the warehouse. But if it goes over that 40% they start delivering again till it drops under that 40%.
No, that should not happen. The only reason that they would only start over 40% is maybe that factory also USES hull parts to produce other wares.
If so, then the mamager will want to keep some reserves, and so he will not put every unit on sale.

The Mules still use the buy and sell offers created by the station managers, they have to unless I want the mod to 'cheat' and teleport wares.
So, managers need money ! A zero budget makes everything bug.
Also, NEVER a single production module, or habitation, on a warehouse ! It will mess up all calculations.

Are you extra, extra sure your warehouse has no production module, and every one of your stations has 1 credit of budget at least ?
Also, you are using the 3.5 version, right ?

Here is the advice I posted on Steam, in case it helps.
I was answering to a player with a Raw resources factory, and a Intermediate factory needing raw resources. His mules were not making deliveries consistently either.
In the end, the solution for him was 1 credit in every budget.

I assume your raw factory makes (silicon wafers, metals, etc) without using it, and just sells it.
Check that the manager has put the wares on sale, just by trying to buy them manually.
Then I assume your intermediate factory needs the raw wares, but does not make them.
Make sure that factory has a budget of at least 1 credit, or it will not publish buy offers.
Then, a Mule set up with the raw factory as Source, the Intermediate as Target, and no option activated (except commander) should work just fine.
To be sure, test by activating 'Allow Low Volumes'. If they start trading then only, that means the amounts on sale in your Raw factory were too small to bother with.

If your Raw factory is also using the wares it produces for some production, these wares will not show up for sale until the manager has about 60-70% full storage of that ware. Before that it will try to buy the ware.

If your Intermediate factory also produces (ore, ...) then a Mule should still deliver it as long as the storage is under 60-70%, when the manager starts selling that ware.
The only difference is when the Mule is trading in the whole system : wares that a factory produces and uses are never in the highest-priority deliveries.
But the factories set up as Source and Target are always the first priority, if there is something to sell.

If the 'bug' is only affecting silicon wafers and nothing else, it is quite strange because there is nothing special in the code about that ware.
Maybe check that the Intermediate Station has enough storage reserved for Silicon ?
If they only reserved room for 100 units, then the buy offer will never be high enough for Mules to notice.

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 13:51

Yes i made it extra sure all station have 1 cr or more, the warehouse has no habitats or product modules (no even energy cells, for the record).
the source stations ONLY processes Hull parts (and produces enery for its own use), which means it retrieves the required refined metals from the warehouse and the only endproduct it has are hull parts.
Hull parts are not used in this factory, however the hull parts are currently sold only, not used in another station of the mule network. this will change soon. :-)

Factory:
https://i.imgur.com/byCq1C6.png

Warehouse:
https://i.imgur.com/d7hNgqK.png

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Sun, 16. Jun 19, 14:03

Ramokthan wrote:
Sun, 16. Jun 19, 13:51
Yes i made it extra sure all station have 1 cr or more, the warehouse has no habitats or product modules (no even energy cells, for the record).
I think I officially ran out of advice :gruebel:

If you tried everything I suggested and still can't get it to work properly, at last try this :
PM me a link to your latest savegame (usually found in "C:\Users\[Your user name]\Documents\Egosoft\X4\[some numbers]\saves", with names like save_001.xml.gz).

I don't even need to be able to load your save, which would require having all the same essential mods.
Just give me the name and identifier ("ABC-123") of all your stations in the PM, and I can go into the savegame to see every variable and understand what is going wrong.

Then I can finally see if there is something "wrong" with the setup of your stations, or if it is really a bug.
And then fix it, one way or another !

Edit : from what I see in the screenshots, your warehouse's storage of E-cells, graphene, Hulls and Meds is full !
If there is no more room for wares, the warehouse stops buying.
Every ware has a reserved space, and will not go over that reserved space even if other wares have unused space, and so the station still has space.
By the gods I hope that was the problem and not some sneaky bug :)

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 14:28

The warehouse is not even half way full.

Not even close...

It just shows as it would be full, but it isnt.

If you got another UI i really wonder whats wrong.

https://i.imgur.com/5lXRWlG.png

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Sun, 16. Jun 19, 14:37

Ramokthan wrote:
Sun, 16. Jun 19, 14:28
If you got another UI i really wonder whats wrong.
No, you are right, the ware storage always looks full in the warehouse overview for me too, and that last screenshot shows the true storage.
So I really don't know what's going on.

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 15:05

If you really want to look into it heres my save:

https://ufile.io/bs5va7n8

My Factories IDs:
Hull Parts: TYA-269
Warehouse: OIS-776
Refined Metals: YQX-249
Graphene: HLS-539
Wharf (inactive yet): LPF-757

I can actually accept that they keep it half full if they start collecting it before it is completely full, but well, every credit counts this early in game and having 80k hullparts on stock you cant sell hurts quite a bit

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Sun, 16. Jun 19, 16:44

Ramokthan wrote:
Sun, 16. Jun 19, 15:05
Hull Parts: TYA-269
This station has a budget of 1 credit, but it has three already-pending orders to buy food at some Argon Factory.
That may cause the station manager to calculate his budget is below zero, and mess up everything on this station. Try giving more money until these trades clear.

Unfortunately, I see nothing else wrong with the Hull Factory, the Warehouse, or on the options of the Hülle 03 (ZFY-634) Mule between them.

One thing that may change the priorities of wares is building drones on your stations.
It should not affect the first run, selling hull parts or e-cells to your Warehouse, because Seller priority is activated between them.
But it will affect the return trip, so if your factory is building drones the wares necessary will be at the same priority as the wares under 10% storage.

I cannot debug further since the game crashes when I try to load the game. I hope you can finally make it work.

Edit : maybe incompatibility with another mod ? I cannot see how it would cause bugs unless it changes things about station managers, or trade stations, but who knows.

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 17:56

I increased the money stock of all stations a bit, even the ones who are not buying/selling anything to AI.
Doesnt seem to solve the issue described... but i guess i can live with that.

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Sun, 16. Jun 19, 18:40

Ramokthan wrote:
Sun, 16. Jun 19, 17:56
Doesnt seem to solve the issue described... but i guess i can live with that.
If it is a bug, I can't ! :D
If you want to try something else, I have an idea.
Edit : That doesn't work
Show
Maybe one of the trade variables in not getting calculated correctly, so if you could change just one thing manually in the script file :
On line 120, change
<sort_trades name="$outerList" tradelist="$supplies" sorter="volume"/>
into :
<sort_trades name="$outerList" tradelist="$supplies" sorter="totalvolume"/>

This may help your mules finally see that there is a lot of hull parts to move, since the order is on volume of the trade, which may not be calculated correctly by the game.
Edit : Nevermind, totalvolume didn't solve it : I just saw I have one of my own factories with the same problem.
I will figure this out, this is what debuglogs are for.

Final edit : solved it !
You actually need your warehouse to have a bit of money to publish trade offers.
I never noticed until I wanted to stockpile wares, and forbid my warehouse from trading with other factions.
Before, it was making money, going above 2 credits, then after a while recalculating trades THEN giving me the money above 2 credits, so for trades they always seemed to have more money.
So, leave at least some money on the warehouse budget.

To see if it was the problem in your game, select a trade ship and right-click on the warehouse, selecting "trade with", and see if the warehouse has amounts of wares listed on the buy column.
After you give a big enough budget, numbers will appear in that column, and the Mules will start working fine again. (I hope !!)

If that WAS the problem, it was 'kinda' my fault since I said it worked. Sorry ! :oops:

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 20:35

my Warehouse has several millions of money because it has to sell and buy a lot of things.

Like i said i am mainly buying medics and food and selling most of my other excess producs there... so the warehouse has a huge budget, still the factory of hull parts stays always above 40% fill.

Sorry, but nice attempt to fix that. :-)

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Sun, 16. Jun 19, 20:51

Ramokthan wrote:
Sun, 16. Jun 19, 20:35
Sorry, but nice attempt to fix that. :-)
Try more money, even a lot more money ? My warehouse has an insane amount of storage, because of the x10 storage capacity mod, so I gave it 200 millions. That did the trick :D

It's a shame, I had the exact same problem and managed to fix it. I was really hopeful.

Ramokthan
Posts: 107
Joined: Fri, 22. Apr 16, 21:25
x4

Re: [MOD] Mules and Warehouses v3.5

Post by Ramokthan » Sun, 16. Jun 19, 21:26

:-(

My factory is running full now, my warehouse is at 20% stock and it has 20 million budget (almost all i money i got at the moment).
But thr mules rather buy medics from the warehouse and selling it to the warehouse again... fuking morons...

Its getting a problem for me now bc my factory is close to being full and being unable to produce anymore.

Edit:
Weird enough it works with my silicon wafers and graphite factories perfectly. Almost too perfect... as soon something is finished they already take that to the warehouse...

Oh and btw the hull parts are an intermediate product now too... but they should not go over 50% capacity either way.
i even added more mules bc i thought my mules had too much to do but rather taking the hull parts to the warehouse they linger around bored or do that warehouse buy/sell bug.

Edit 2:
Weird shit 2:
Instead of finally moving the 100% full stock of hullparts to the warehouse they do this shit:
https://i.imgur.com/awbUKjl.png
https://i.imgur.com/hXmF9Ej.png

Im going to have a look at that script now... XD

LegionOfOne
Posts: 122
Joined: Sun, 16. Dec 18, 13:16
x4

Re: [MOD] Mules and Warehouses v3.5

Post by LegionOfOne » Tue, 18. Jun 19, 02:26

Ramokthan wrote:
Sun, 16. Jun 19, 21:26
Im going to have a look at that script now... XD
4.0 is out, hope the bugfixes included unlock your situation.

Post Reply

Return to “X4: Foundations - Scripts and Modding”