[MOD/WIP] Dumb Mule

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

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

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

[MOD/WIP] Dumb Mule

Post by thijso » Fri, 3. Jul 20, 13:47

-------------------
Deprecated; see SimpleMule instead
--------------


I have Mules Supply and Warehouses Extended installed and like it a lot.

However, for one scenario I haven't been able to figure out the sweet spot for using that mod. Maybe the different mules are just confusing, maybe in combination with all the options, or I'm just stupid. I have become annoyed with my mules shifting 10 parts of this and 17 parts of that, while there are thousands of parts that can find a better home.

Anyway, the scenario is a fully self sufficient chain of stations leading to a (for now) Wharf. I've set it up where the Wharf is actually also a warehouse for all the resources needed by the other stations. There are five other stations in my current game, but for the next wharf, I'll probably break that down and extend it to about ten. All the stations feed all their product into the Wharf and get their resources back from it (put there by one of the other stations, including a refined goods complex that processes the raw ores and liquids).

So this WIP MOD I created (mostly from looking at and changing the MSWEx examples) does that:

1. it gets a list of products from the source station
2. it checks which one of those the target needs most at the moment
3. it fills the mule up with that resource (as much as fits or as much as the source has)
4. it carts that to the target and dumps it in storage
5. if option of return trade is checked, it looks at what the source needs and brings that stuff back, again filling up the mule

It seems to work and does mostly what I want it to now. Super simple to setup, also. Just point it at the two stations and toggle two-way trade to what you want, and go.

However... It's still WIP, and there are a few tweaks that I need to do.

One is that I've seen a couple of mules end up stuck with their cargo full. Not sure yet why.

The other is that you now need to manually create buy and sell orders for all your wares at the warehouse. Looking into how to automate that.

Third is that I want the mule to combine more than 1 trade if the first doesn't fill the cargo. Right now it just does 1 and goes.

And certainly more stuff will crop up as I go...

It works alongside MSWEx and shouldn't interfere with most other mods. You can get it here: https://github.com/thijs/DumbMule/archive/master.zip

Comments and suggestions welcome.
Last edited by thijso on Tue, 8. Sep 20, 09:52, edited 1 time in total.

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

Re: [MOD/WIP] Dumb Mule

Post by thijso » Sat, 4. Jul 20, 18:09

Updated and mostly working as I intended now. Download the new version from the same link: https://github.com/thijs/DumbMule/archive/master.zip
  • Now the mule tries to fill its cargo hold to the amount set in the options (defaults to 60%)
  • Now dumps any cargo that remains into the source station so that the mule runs continue without halting on full cargo hold of the ship
  • For two-way trade there's now an option to specify what percentage of resource wares (i.e. stuff that the Wharf needs to build ships) to keep at the target station; defaults to 50% of the set storage allocation
To get started, make one of your (preferably empty) cargo ships a Dumb Mule, and set the source and target station. Toggle the two-way option to what you need, and I'd suggest leaving the defaults for the others.

The only thing you need to do is check how the target station has set up its storage allocation. You might need to tweak some of the values the station manager has thought up, as you need the storage on the target station to work as a buffer for the resource wares. Usually, you want more than the manager thinks you want.

It goes without saying that it's a good idea to have enough storage on the target station...

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

Re: [MOD/WIP] Dumb Mule

Post by thijso » Sat, 4. Jul 20, 20:21

Oh, and yeah, for now it skips energy cells and food and medical. I'll be adding options for that soon, I think.

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

Re: [MOD/WIP] Dumb Mule

Post by thijso » Sat, 4. Jul 20, 21:24

Now it's looking good:

trip from source to target:
moving 47 Turret Components (940 : 11% filled; 68% remaining) from Nopileos' Fortune VI Components to Nopileos' Fortune VI Wharf 01
moving 38 Drone Components (1140 : 13% filled; 55% remaining) from Nopileos' Fortune VI Components to Nopileos' Fortune VI Wharf 01
moving 134 Shield Components (1340 : 15% filled; 40% remaining) from Nopileos' Fortune VI Components to Nopileos' Fortune VI Wharf 01
trip back:
moving 178 Hull Parts (2136 : 25% filled; 54% remaining) from Nopileos' Fortune VI Wharf 01 to Nopileos' Fortune VI Components
moving 52 Plasma Conductors (1664 : 19% filled; 35% remaining) from Nopileos' Fortune VI Wharf 01 to Nopileos' Fortune VI Components
My ships are now actually hauling cargo at more than 50%-70% filled capacity regularly.

ObsidianOne
Posts: 38
Joined: Sun, 23. Dec 18, 10:16

Re: [MOD/WIP] Dumb Mule

Post by ObsidianOne » Mon, 6. Jul 20, 16:28

So this mod is for trade route , right ? I have seen many mod like that but none of them did what i wanted to do.Lets say i have two station far away from each other and 1 is need of graphene other is producing the graphene.Can this mod help to create route between those two station and transfer wares automatically ?

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

Re: [MOD/WIP] Dumb Mule

Post by thijso » Mon, 6. Jul 20, 19:38

Yes, that is what this mod is more or less meant for.

The graphene should be a 'product' in your production station, so you should be able to run it without tweaking any settings even.

I mean: select source station, select target station and confirm.

ObsidianOne
Posts: 38
Joined: Sun, 23. Dec 18, 10:16

Re: [MOD/WIP] Dumb Mule

Post by ObsidianOne » Tue, 7. Jul 20, 10:17

thijso wrote:
Mon, 6. Jul 20, 19:38
Yes, that is what this mod is more or less meant for.

The graphene should be a 'product' in your production station, so you should be able to run it without tweaking any settings even.

I mean: select source station, select target station and confirm.
Thanks for answer , i will try it for sure.

ObsidianOne
Posts: 38
Joined: Sun, 23. Dec 18, 10:16

Re: [MOD/WIP] Dumb Mule

Post by ObsidianOne » Tue, 7. Jul 20, 12:27

This is gonna work only if the station need that resource or it can transfer the wares no matter what ?

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

Re: [MOD/WIP] Dumb Mule

Post by thijso » Tue, 7. Jul 20, 13:50

It's setup so that the products at the source station (see the storage list, it's broken down into storage, resources and products, I think) are pushed to the target station and buy/sell orders are created automatically at the target to make that possible.

There's an option to select the wares you want to transport and to only do those, but I just found out that that is broken in the current version. Working on a fix now...

EDIT: I see in your case your source is producing graphene, so for you it should just work (without manually selecting things).

ObsidianOne
Posts: 38
Joined: Sun, 23. Dec 18, 10:16

Re: [MOD/WIP] Dumb Mule

Post by ObsidianOne » Tue, 7. Jul 20, 13:53

thijso wrote:
Tue, 7. Jul 20, 13:50
It's setup so that the products at the source station (see the storage list, it's broken down into storage, resources and products, I think) are pushed to the target station and buy/sell orders are created automatically at the target to make that possible.

There's an option to select the wares you want to transport and to only do those, but I just found out that that is broken in the current version. Working on a fix now...
Yeah it does not work for me at all.When i tried for the first time , it worked but it did not transfer the wares i wanted.İ picked graphene , it picked field coils.After this i never manage to make it work.It is keep saying ''searching for trade'' , thats all.

I can take a record for you if it is gonna help.

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

Re: [MOD/WIP] Dumb Mule

Post by thijso » Tue, 7. Jul 20, 14:28

Okay. I pushed a new version just a second ago, so if you grab that (same link as above, just replace the directory completely), ware selection should work.

However, if your source station produces the stuff you want to transfer, you should ONLY select the source station and the target station (and toggle two-way to your preference), and that is all. Leave all the rest as is, and it should work. It does for me, at least...

ObsidianOne
Posts: 38
Joined: Sun, 23. Dec 18, 10:16

Re: [MOD/WIP] Dumb Mule

Post by ObsidianOne » Tue, 7. Jul 20, 14:40

Thanks , i will try and report back.

ObsidianOne
Posts: 38
Joined: Sun, 23. Dec 18, 10:16

Re: [MOD/WIP] Dumb Mule

Post by ObsidianOne » Tue, 7. Jul 20, 16:03

This is the result , it picked field coils again https://ibb.co/j4ZfsGh it is picking it i think it is needed for construction.https://ibb.co/C27Htx3

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

Re: [MOD/WIP] Dumb Mule

Post by thijso » Tue, 7. Jul 20, 16:14

Ah, ok.

So, if you want it to really only transport Graphene, check the box 'Only selected wares'.

Otherwise, it will combine the list of things you select with the stuff the station produces and then figures out what the target station needs the most (by calculating the target amount the station wants divided by the amount there already). It does this with categories, so it could be that the ratio for two wares is, say 12% filled and 17% filled. These two would end up in the <20% category together and then it's random which one is picked. So it could be that the 17% filled one is transported first. This should even out in the long run, though.

But that's not important for your case. In your case, select graphene (as you did), then check the box 'only selected wares'. That should work.

EDIT: actually, no. I haven't needed that yet, so it's not yet in there... Give me an hour to program it in... ;) Sorry!

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

Re: [MOD/WIP] Dumb Mule

Post by thijso » Tue, 7. Jul 20, 16:22

Okay. So the fix was a lot easier than I expected.

Please re-download and restart your game. Now it should work. Select the wares, tick the 'only selected wares' box and it should only transfer those.

ObsidianOne
Posts: 38
Joined: Sun, 23. Dec 18, 10:16

Re: [MOD/WIP] Dumb Mule

Post by ObsidianOne » Tue, 7. Jul 20, 16:23

I will be waiting , thanks.

edit ; nvm i did not saw your last message , gonna test it now.

ObsidianOne
Posts: 38
Joined: Sun, 23. Dec 18, 10:16

Re: [MOD/WIP] Dumb Mule

Post by ObsidianOne » Tue, 7. Jul 20, 16:36

Did not work ; https://ibb.co/LYF5D3y , Is there any limit for travel ?

Edit : Nvm if there was limit , it could not transport field coils in the first place.

thijso
Posts: 89
Joined: Thu, 2. Jul 20, 23:24

Re: [MOD/WIP] Dumb Mule

Post by thijso » Tue, 7. Jul 20, 17:25

It seems it's not picking up any trades now? Is that correct? Are you sure you have graphene available at the source station (the factory in Path to Profit)?

If you can, restart your game with the options "-debug all -scriptlogfiles". It should write a log file to your local game directory (where it also saves your save files) in the directory logs\dumbmule. Check the file for the ship (QUJ-538) once it starts a run (maybe need to resetup the Dumb Mule). If possible, post it here?

ObsidianOne
Posts: 38
Joined: Sun, 23. Dec 18, 10:16

Re: [MOD/WIP] Dumb Mule

Post by ObsidianOne » Wed, 8. Jul 20, 11:22

Ofc i have https://ibb.co/L1pSf5x

And here is the log ; https://pastebin.com/mb6S0TJH

thijso_
Posts: 1
Joined: Wed, 22. Jul 20, 14:36

Re: [MOD/WIP] Dumb Mule

Post by thijso_ » Wed, 22. Jul 20, 14:44

Sorry for the late reply. This is an alternate account, as I'm unable to login with my main one at the moment.

The problem is that your use case is a little different than mine, so the setup of the trade fails in the first step. When you setup a DumbMule, it scans all the production wares at the source station, and creates buy offers on the destination station. However, in your case, graphene is not a product, but an intermediate resource. So it doesn't create the buy offers. I'm not able to fix the issue right now, but there is a workaround, which is to create the buy offer for graphene at the destination by hand. If you do this, and resetup the mule, it should work.

My responses will probably be slow for a while, as I don't have a lot of opportunities to check the forum at the moment, just FYI...

Post Reply

Return to “X4: Foundations - Scripts and Modding”