X4: Foundations

File information

Last updated

Original upload

Created by


Uploaded by


Virus scan

Safe to use

Tags for this mod

About this mod

This is a "fire-and-forget" version of the "old" MK3 Universe Trader by Mkess and BurnIt!.
It is different in many ways from both, the original and my X Return version, and some player
may find it too much of a "cheat" so please read the following description and features before
you decide to install it.

Permissions and credits
AutoTrader v0.9 January 30, 2023

Please see changelog for details.

This is a "fire-and-forget" version of the "old" MK3 Universe Trader by Mkess and BurnIt!.
It is different in many ways from both, the original and my X Return version. Since some players
found the initial version too much of a "cheat" I have added a setup with various options that can
be set before and after the AutoTrader has been activated. Please read the following description,
in particular the setup options new with version 0.3, before you decide to install it.

Short Description:

The AutoTrade will work on any of your NPC ships which is not docked and has no
command running (i.e. default wait). This is a new condition as some players have reported problems
if the ship had orders batched or was docked.

To start the script select the ship, right-click to bring up the context menu and select "Comm"
to talk to the captain. There is only a single option "Auto Trade Menu". Once you have clicked
that a sub-menu is displayed with the options:
  • Auto Trade: Select that and the captain will receive a star "*" behind his name to indicate
  • that the script is running. Please be patient as it may take a while (depending on setup you chose) before the autotrader is moving. It is strongly recommended that you do not interfere with the
    ship or captain in any way.
  • AutoTrade Setup: This will open a setup menu with various options which can be selected at
  • any time via "Comm". Any setting you choose will be confirmed by the captain in the player logbook under"upkeep". All setting will be displayed together with the regular profit message (see below). The following options are available:
    • "Jump" (default true): Enables/disables jumping. If you disable it then the autotrader will
    • fly using travel mode and, if not a capital (L/XL) ship, also highways.
    • "Prefer Player Stations" (default true): Enables/disables player station trading priority. If
    • enabled (default) then the autotrader/autominer will serve the player-owned stations with priority. Whendisabled, all trade deals will be equally considered to determine the best deal.
    • "Know all Trades" (default true): Enables/disables only trade offers and system known to player.
    • When enabled (default) the autotraders/autominers know the entire galaxy. If you decide to disable thisfeature please be aware that this can cause the autotrader/miners to idle for a rather long time until youhave discovered systems with resources (mining) and station that offer trades.
    • "Trade all Wares" (default true): Enables/disables trading in spaceweed/fuel and maja dust. This
    • option is (naturally) only available for autotraders as autominers have no illegal wares. Disable it ifyou do not wish your autotraders to get into trouble with the police.

The setup parameter values will be shown in the autotrader's logbook report. You can change parameters at
any time. Changing a setting again will revert them and trigger a confirming logbook entry. Also be aware
that he will charge a fee(***) for his service and use your credits for trading. The higher his skills the
higher the fee but also the more effective he will trade. He will trade or mine for you without the need for
any further actions (hence fire and forget). When you select "Auto Trade" then the captain will become an:
  • AutoMiner if the ship has gas or liquid storage then the captain becomes an Autominer,
  • AutoTrader if the ship has container storage then the captain becomes an Autotrader.


    The Autotrader ...
  • ... will prioritize trades with player stations unless "Prefer Player Station" is set to "false" in which case
  • he will treat all trades as equal.
  • ... will transfer credits to you after a trade transaction has been completed. There will be no credit transfer
  • for trades with player-owned stations.
  • ... knows the entire galaxy which he will search for a maximum profit trade(*) unless "Know all Trades" is set
  • to "false" in which case he will only trade with stations and harvest resources in systems known to the player.
  • ... is able to create an anomaly to reach his destination unless "Jump" is set to "false" in which case he will
  • fly using travel mode but will not use no highways.
  • ... lifts the Fog of War (not relevant if "Know all Trades" is set to "false").
  • ... set all systems and faction he trades with as known to the player (not relevant if "Know all Trades" is set
  • to "false").
  • ... gains a small experience for every successful trade.
  • ... provides a (very) small reputation gain for the player with each faction after a successful trade.
  • ... will send regular profit information together with his name (his level in brackets), the ship's name (and id
  • code in brackets) and the optional setup parameter values to the upkeep section of your logbook,
  • ... charges commission fee as a percentage(***) of the profit for his services.
  • ... will trade more effectively but also charge a higher fee the higher his skills are.
  • ... will not trade/harvest with stations/in systems which are "enemy" to the player.

If this is you first install then just extract the contents of the zipped file into your extensions
folder. If you have the previous version then remove that from your extensions folder before extracting
the zipped file.

Please note, there have been reports that an extensions folder in the X4 main root directory
does not activate any mods. Due to a current info from the developers the original idea was to place
the extensions folder into the X4 document folder. So please try that if you have trouble with starting
mods from the main root folder. In any case you are strongly advised to backup your saved games.

Stop Autotrade
If you comm an autotrader then the "Auto Trade Menu" has two options "Stop AutoTrade" and "Auto Trade Setup".
The setup allows to change the option parameters. For example, if "Known Trades" is set to "true" and you
select it again, it will change to "false". Any parameter changes should take effect instantly, i.e. no save
and/or restart is necessary.
The option "Stop AutoTrade" removes the script from the captain, also the star "*" behind his name but preserves
his profit history and his gained skills. It will also reset all setup options to the default values.
Stopping the script has two purposes:

1# Moving the Captain to new Ship: There are several methods.
A) Order the ship to dock at the station where the new ship is docked. Fire or move the captain of
the new ship to work as a service crew at the old ship, then move the captain of the old ship to the
new ship as service crew (or directly as captain if you have fired the one at the new ship) and promote
best crew member to captain. As the autotrader has gain experience during his trade runs and hence he
will be the best choice.
B) Dock at the old ship (of course, a corresponding docking area is required for the ship you fly) and
send the captain as service crew (or captain if the position is available) to your ship. Then fly and
dock at the new ship, fire or send the captain of the new ship as service crew to your ship and then
have the captain of the old ship work as new captain.

2# Uninstall the AutoTrader Mod: Once you have stopped ALL of your autotraders, save the
game, exit X4 and remove the mod from your extensions folder.

Any feedback is most welcome and, of course, also details on any problems you may encounter please post here.

Changelog Version 0.9 January  30, 2023:

1# Fixed a bug that allowed trades with stations unkown to the player although "Know All Trades" was set to 0 (false). Thanks to narta for spotting this bug.

Changelog Version 0.8 January  20, 2023:

1#  Changed the code to avoid negative profit which could occure under rare circumstances.
2#  Added new wares of Split and Boron.
3#  Optimized the AutoMiner code although there is a slim chance that the harvest  area is invalid. In this case an alert is created  in  the player logbook. Please PM me with the logbook details.

Changelog Version 0.7 February 18, 2019:

1# Fixed a bug that mismatched buy and sell offers (thanks to ROMB for spotting this).
2# Added all language references in the context file to avoid crashes/freezes for Windows 7 players
who do not have the English Steam version (thanks to Kadatherion for pointing that out).

Changelog Version 0.6 January 11, 2019:

1# Added information on the last trade to the "upkeep" part of the player's logbook.
2# Improved the format for numerical values (amount and credits).

Changelog Version 0.5 December 18, 2018:

#1 Removed the ability to use highways as this has caused issues with ship not able to leave them.

Changelog Version 0.4 December 17, 2018:

#1 Added a condition for autominers preventing them to harvest in enemy systems.

Changelog Version 0.3 December 15, 2018:

1# Added new conditions for a hailed ship to offer the "Auto Trade Menu" option.
2# Added an "AutoTrade Setup" with various options (see above).
3# Added the ship's ID code to the regular report in the player's logbook under "Upkeep".
4# Fixed a bug that under certain conditions prevented the autominer to find resources.
5# The regular logbook report will now appear right after a trade has finished.
6# Removed all credit transactions when trading with player-owned stations.

Questions and Answers

Q: I've Comm the ship but do not get the Auto Trade Menu option. What do I miss?
A: The option will show only if the ship has only the default order (Hold position) and is in space (not docked).

Q: I started the autotrader on a ship but I cannot see any orders or commands. How can I tell the Autotrader is working?
A: If there is a star "*" behind the pilot's name the script is running. Also you should see a message in the player's logbook.

Q: I have set/changed an option in the setup. How do I know if it's actually working?
A: As soon as you set an option a message will be sent to the logbook. Also the current option settings are part of the regular message the autotrader send to your logbook.

Q: I've an autotrader running and added the "auto trade" to the orders of the ship as well as some wares to the list that shows there. Now is not doing anything. What is wrong?
A: Once you have started the "Auto trade" any order you give to that ship can potentially cause errors. There is no need to add any orders or wares nor command him to do anything. He will trade and/or mine autonomously without any need to intervene. To "fix" your autotrader comm and select "Stop Autotrade" then remove all orders and start the Auto Trade again.

Q: I see the message of the autotrader in my logbook but do not know what, for example, "Know 0" means.
A: All settings are boolean variables which can have two values "true" (or 1) and "false" (or 0). In your example it means that your autotrader (or autominer) will only trade with station (and harvest resources) you have discovered.

Q: The Mod is broken! I've started the Auto Trade on a ship, the captain has a star behind his name, I've received one message in the logbook, the ship did move but now it's just hanging there doing nothing. What is wrong?
A: The ship is waiting which can have several reasons. Either it is on a cooldown which can take up to 90 minutes if the captain is a rookie and the only crew. It can also be due to the lack of discovered trade offers/ resource areas. This will happen frequently if you set "Known" to false (0) and have not discovered sufficient stations/resource areas.

Q: I've 20+ miners and 40+ traders on Auto Trade and made 100 Gazillion Credits in one hours. Isn't that cheating?
A: The mod is not meant for a fleet of traders. Usually 2 or 3 miners and traders are enough to keep you afloat while you have time to explore, do missions or start to build stations. If this is not your play-style and you insist of having a huge fleet of trader ships then you do not need this mod.

Q: Is there something wrong with the money transfer? I never get charged for buying wares and receive only profits.
A: The way trade accounts are coded has changed since version 0.3 because some players used a fleet of autotraders which, under certain conditions, could lead to temporary negative profit. Now the account is done in a balancing way, i.e. after a trade is completed the difference between the income and the spending of that trade is transferred to the player.

Q: I'm running the latest version but the profits shown in the logbook are totally screwed, switching between negative values and billions of credit profit. Is the mod broken?
A: Very unlikely! I'm running the mod for many hours in different setups and never had such an issue. It's is more likely that you run another mod that interfers. However, if you can exclude a mod incompatibility then please email your saved game and I'll take a look.

Q: My Autotraders keep trading in illegal wares filling the storage of equipment docks, ship yards and wharves, instead of trading in urgently needed build resoures. It seems the autotrader mod broke the economy that way.
A: The Autotrader mod does not "invent" new trade offers. It searches for the most profitable offers provided by the vanilla game. Drugs (spaceweed, spacefuel and majadust) are usually most profitable and are bought by trade stations and those stations you have mentioned. They cannot  overload the storage (there is a failsafe in the vanilla game for that). However, if you do not wish them to deal in illegal wares then use the setup to disable the trade in such wares.

Q: The mod will destroy the economy because it magically spawns wares rather than buys them. Also it never transfers wares to the buyer. Why did you code it that way?
A: You are wrong in all accounts unless you run another mod that interferes with the AutoTrader. If you check the code then you will find the lines where wares are transferred from the seller to the ship and from the ship to the buyer. There are no wares just "spawned"! And concerning the economy: This mod was originally coded to accelerate the ware distribution in the galaxy in order to study long term effects to the economy.

Q: The autotrader is just sitting near a station for many minutes and got attacked by marauders. I know they are just waiting there but can you make them dock or add an emegency jump so they do not get destroyed?
A: No, because the entire docking and undocking procedure will cause more issues like waiting for free docking slots, destroyed docking areas, destroyed stations and colisions with other ships, to mention only a few. And concering enemy attacks, the autotrader will be fairly safe near a station as the corresponding faction usually attacks any enemy ships. Besides, enemy attacks do happen in the game even if you run a vanilla trader and it's up to you to protect them.

Q: Allright, I've read all the wall of text and now I wonder how you use the mod?
A: It depends on the gamestart but in general I make some credits with missions, scoop up loot, shooting Xenons/Kha'ak and collecting crystals until I can afford a miner ship. The Drill (solid) is usually the first I make autominer. Later I add a gas/liquid autominer. The end goal is to have a Pelican for autotrading and one each of the Cranes, solid and gas/liquid, as autominers. Three ships are enough for a long time until I have the PHQ, good reputations and blueprints to start building stations. Then I add three more and add crew from my stations (habitat module) over time to make them trade/mine more efficient.

Cheers Euclid