New things for player ships to do; things I wanted done.
- StationSweep gathers loot around a station
- PatrolRoute defends each of a list of waypoints for a time
- CargoFerry forces wares onto a station, even if it doesn't want them
- DeployGlobe drops mines or lasertowers in rings around a point
- CollectDeployables pick up probes, beacons, sats, mines, and lasertowers
Also see my other x4f work
Installing and Using #
Download this project as a .zip file. Unpack that into the X4
extensions/ folder. This may vary from machine to machine but
Steam/steamapps/common/X4/extensions should get you started. It's ok
if it's named
dragoncommands-master/. The new commands should then appear
on ships' "Default Behaviors" menu in game.
Pick up player owned deployables (Resource Probes, Nav Beacons, Satellites, Mines, Laser Towers) round a specified point.
'Destination' and 'Radius' define the area to be scanned for deployable items to collect.
The various 'Collect' flags determine which classes of item to pick up. The ship will only pick up what it can carry: it must have space for the item as well as the ability to carry that specific item: Mk2 Laser Towers require a ship with a free size S dock.
'Nearest First' if checked picks up items based on how close they are to each other; if unchecked the order is probes, beacons, satellites, mines, then lasertowers.
Have a ship deploy mines and/or laser towers in a globe (or ring) around a specified point. Options control the size of the globe, number of rings, number and types of items deployed.
'Center Point' is the place your deployment surrounds.
'Deploy Laser Towers' and 'Deploy Mines', when checked, allow deploying that type of item. When both are selected, one or the other is chosen randomly per drop. If the ship has multiple types of mine or laser tower (Mk1 vs Mk2, etc), the selection of which to drop is also random.
'Radius' determines the size of the inside of your deployment globe. Items will be placed at least this far away from center, possibly further if 'Placement Variation' is non-zero.
'Rings' determines how many rings or meridians items will be deployed on. the surface of the globe is equally divided between rings, and the items to be deployed are distributed equally on those rings. There may be leftovers.
'Rings' = 0 will deploy at random points across the globe. 'Rings' = 1 will deploy a ring on the plane of the ecliptic around the center point.
'Drop Percent' allows ordering a deployment of less than 100% of the available deployables (if you want to reserve some).
Once the ship has finished, it will fly back to the center point, and await further orders.
Deep thanks to @mewosmith and @UniTrader on the EGO Discord for their assitance with the co-ordinate generation and for being good people.
I hadn't found an easy way to stockpile claytronics, or supply a sales outpost with excess production, or have a centralized buying point for resources... so I made this command.
The CargoFerry takes wares from a Source station, and delivers them to a Destination station. Even if the destination station doesn't want them and has no buy order for them. No credits are exchanged, no ware reservations are made. Logbook entries are made at pickup and dropoff.
In order to maximize the chances of getting cargo, the ship will idle near the Source station until it has a valid load; then dock and attempt to load. It then flies to Dest, unloads, and goes back to Source to idle or load more as may be.
Anyone needing a two-way version that carries cargo back should holler at me... or perhaps a preist, because whatever you're trying to do is wrong, and I haven't coded that up yet.
'Source' and 'Dest' must both be stations that you own.
'Keep' is the percentage of the source's inventory to reserve. Setting this to '10' will result in 10% of the source's target inventory of each ware remaining unavailable to this ship, for example.
'Fill' is the percentage of the destination station's available capacity to fill with each ware. As the available capacity shrinks with each transfer, this is not a stable or precise measurement.
'Fill Ship to Fly' can keep the ship from flying with small amounts of cargo. When zero, the ship will fly when there's anything at all to cary. A value here has the ship wait until it that full before making a trip. It will always try to carry as much cargo as it can when it flies.
'Prioritize Demand, Supply, Random' control how the ship selects wares to carry each trip. The higher the value of each factor, the more weight given to it in deciding which wares to carry on a given trip.
'Demand' is calculated against the amount of the ware the destination station could take if all its free space ( * Fill) were dedicated to that ware. 'Supply' is caluculated against the source's target amount of that ware (* Keep). 'Random' is just that.
'Source Wares' is the list of wares the ship will carry. By default this is the source station's products (final and intermediates). You can override that manually here, and specify any/all wares, which will be carried should they happen to become available on the source station. This will let you strip resources and storage wares from a a station.
'Commander', if set to a station you own, becomes this ship's commander.
Ware Selection Logic or "why did it take all but 1 Hull Part?" #
The game provides a nice smooth inventory management system for stations; which the CargoFerry pilot utterly ignores for the Destination station. 'Demand', how much of a ware the destination station needs, is calculated based on how much of the ware the station could take, if this ware was the only one using the currently available free space. see Zeno's Paradox of Achillies and the Tortise for how that works over time.
'Supply' is based on the source station's desired amount of a ware, the ware's target value. For products or resources of a station, the station manager keeps that number updated with a sane amount.
For wares the station didn't want, such as might land there from manual ware transfers, CargoFerry, StationSweep, or other means, the target count of the ware is however much there is.
In that case the Supply target calculation acts similalrly to the Demand target calculation and the ship will take a fraction (Keep) of the remaining amount until there's only one left. If 'Keep' is 0 (meaning no reserve), it will take that last one too.
It's so untidy when incoming traders dump goods all around your station, just because it stopped buying an item. The upgrade components and loot left over from the battles outside your shipyards would be nice to have, but is tedious to collect. Thus, StationSweep.
This command does 'Collect Drops' in the area around the specified station; and when the ship's cargo bay fills past the given amount, it will dock, FORCE the cargo onto the station, then resume looking for drops. No credits are exchanged or necessary, and the wares may not be anything the station supllies or produces. A logbook entry is made when a load is dropped.
What your station does with the cargo then is up to you. If there's no free space on the station, the cargo will silently be lost.
'Home' is a station you own, which will become this ship's commander. It should probably have some container storage.
'Sweep Radius' is the area to collect drops from. As with 'Collect Drops' (it uses the same code), inventory items, ammo, and wares are collected. Only cargo is dropped at the station, however. Use 'Deposit Inventory' manually occasionally if you have an HQ. The ship will go back to sweeping afterwards.
'Fill' is the percentage of available cargo space to use before considering the ship to be full, and docking at Home and dumping cargo.
This command makes a ship visit each location on a list, linger there for a time searching for enemeies to attack, before moving to the next location. After the last location is visited the ship returns to the first location and runs the list again. Essentially it has the ship run the 'Defend Position' command for a time period on each of a list of objects.
'Home' is an optional, player owned station to assign as the ship's commander. Workaround for running a default behavior order on station subordinates.
'Change after' is the time limit per point, inclusive of travel time between points. This time limit can be exceeded, if the ship gets distracted attacking, is interrupted by other manual orders, etc. Once the specified time (or more) has passed, the ship witll travel to the next destination and take at least one pass by it seeking enemies before possibly moving on.
'Patrol Radius' is the size of the area around the destination that the ship is to use for flying around randomly in.
'Attack Radius' is the size of the area around the destination object to attack enemies in. Enemy ships outside this range will not be engaged; unless the 'KillCrazy' flag is set.
'Recall Subordinates' if set, does a 'Recall Subordinates' order before travel between waypoints. This will result in subordinates that can dock doing so, and those that can't being sent ahead to defend the destination before the wing commander. If unset, subordinates are left to follow as best they can and will catch up after changes.
'KillCrazy' if set, removes the limit on pursuing enemies past the attack radius. This ship will try really hard to kill everything it engages with, which often results in the discovery of Xenon shipyards. Use with caution.
'Add Waypoint' Lets you select an object (any object: station, gate, satellite, nav beacon, ... other ships) to be visited and patrolled around. There's no limit (beyond whatever the game UI might impose) on how many waypoints you may have.
A waypoint that can't be reached is silently skipped, in the hope that it might be reachable next time. So this should at least fail gracefully with blacklists changing, waypoints being destroyed, or other unforseen occurances.