Works best OOZ, so go to a zone where no other capital ships are present before installing this.
After this script runs, you will receive a notification in your in-game display, and in your logbook.
Please deactivate this script by:
- deactivating it in your in-game "Extensions" menu, or
- deleting the directory "w.e_dockalldrones" from your extensions directory.
Note: While this script does appear to dock/destroy all orphaned drones in the galaxy, some of my ships are still showing drones in use. Unless something is found that says otherwise, I'm taking this to mean that in some situations, drones can be marked "in use" without actually being in space somewhere. Should help efforts to narrow down the search for anyone trying to get to the bottom of the drones in use problem. NOTE: This issue was fixed in X:R 3.60 RC1.
_____
Usage:
1. In-game, go to a zone where there are no other capital ships. (This script should not yet be installed at this point.)
2. Save the game, exit,
3. Install this script,
4. Load your save,
5. Wait for the notification (should come in around 10 seconds),
6. Save,
7. Deactivate this mod,
8. Restart the game,
9. Load
_____
Installation:
Extract to your extensions directory.
_____
Uninstallation:
Disable from your in-game extensions directory,
or
Delete the folder "w.e_dockalldrones" from your extensions directory.
_____
Compatibility:
This mod is current as of X:R 4.00
Compatible with X:R 3.61
Should be future-proof since it alters no vanilla files.
Compatible with Windows, Linux, and Mac versions of X Rebirth.
_____
Available for download:
http://www.nexusmods.com/xrebirth/mods/453
_____
Code:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="we_DockAllDrones" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<cues>
<cue name="we_DockAllDrones">
<conditions>
<event_player_created/>
</conditions>
<delay min="10s"/>
<actions>
<create_list name="$we_FollowerDronesDocked"/>
<create_list name="$we_LostFollowers"/>
<create_list name="$we_LeaderDronesDocked"/>
<create_list name="$we_LostNonFollowers"/>
<create_list name="$we_LostWelders"/>
<create_list name="$we_LostCargoLifters"/>
<create_list name="$we_OtherLostMassTraffic"/>
<create_list name="$we_WorkingMassTraffic"/>
<find_ship name="$we_EverySingleVerySmallShip" multiple="true" space="player.galaxy" class="[class.drone, class.ship_xs]" recursive="true"/>
<write_to_logbook category="tips" text="'Drone reset script active. \n\n Preliminary search. \n %1 ships found.'.[$we_EverySingleVerySmallShip.count]"/>
<do_all exact="$we_EverySingleVerySmallShip.count" counter="$i">
<!-- Followers first. Set drones following other drones to dock with their mother ship if it's still intact. Otherwise, goodbye. -->
<do_if value="$we_EverySingleVerySmallShip.{$i}.commander.isclass.drone or $we_EverySingleVerySmallShip.{$i}.commander.isclass.ship_xs">
<do_if value="$we_EverySingleVerySmallShip.{$i}.commander.commander.isoperational">
<!--<write_to_logbook category="tips" text="'%1 sent to dock with %2.'.[$we_EverySingleVerySmallShip.{$i}.knownname, $we_EverySingleVerySmallShip.{$i}.commander.commander.knownname]"/>-->
<append_to_list name="$we_FollowerDronesDocked" exact="$we_EverySingleVerySmallShip.{$i}"/>
<abort_scripts entity="$we_EverySingleVerySmallShip.{$i}.controlentity"/>
<set_object_commander object="$we_EverySingleVerySmallShip.{$i}" commander="$we_EverySingleVerySmallShip.{$i}.commander.commander"/>
<dock_drone homebase="$we_EverySingleVerySmallShip.{$i}.commander" object="$we_EverySingleVerySmallShip.{$i}"/>
</do_if>
<do_else>
<!--<write_to_logbook category="tips" text="'%1 destroyed. LOST FOLLOWERS'.[$we_EverySingleVerySmallShip.{$i}.knownname]"/>-->
<append_to_list name="$we_LostFollowers" exact="$we_EverySingleVerySmallShip.{$i}"/>
<destroy_object object="$we_EverySingleVerySmallShip.{$i}"/>
</do_else>
</do_if>
<!-- Leaders last. Set drones following other drones to dock with their mother ship if it's still intact. Otherwise, goodbye. -->
<do_else>
<do_if value="$we_EverySingleVerySmallShip.{$i}.ismasstraffic" negate="true">
<do_if value="$we_EverySingleVerySmallShip.{$i}.commander.isoperational or $we_EverySingleVerySmallShip.{$i}.dronecommander.isoperational">
<!--<do_if value="$we_EverySingleVerySmallShip.{$i}.commander">
<write_to_logbook category="tips" text="'%1 sent to dock with %2.'.[$we_EverySingleVerySmallShip.{$i}.knownname, $we_EverySingleVerySmallShip.{$i}.commander.knownname]"/>
</do_if>
<do_else>
<write_to_logbook category="tips" text="'%1 sent to dock with %2.'.[$we_EverySingleVerySmallShip.{$i}.knownname, $we_EverySingleVerySmallShip.{$i}.dronecommander.knownname]"/>
</do_else>-->
<append_to_list name="$we_LeaderDronesDocked" exact="$we_EverySingleVerySmallShip.{$i}"/>
<abort_scripts entity="$we_EverySingleVerySmallShip.{$i}.controlentity"/>
<dock_drone homebase="$we_EverySingleVerySmallShip.{$i}.commander" object="$we_EverySingleVerySmallShip.{$i}"/>
</do_if>
<do_else>
<!--<write_to_logbook category="tips" text="'%1 destroyed. LOST NON-FOLLOWERS'.[$we_EverySingleVerySmallShip.{$i}.knownname]"/>-->
<append_to_list name="$we_LostNonFollowers" exact="$we_EverySingleVerySmallShip.{$i}"/>
<destroy_object object="$we_EverySingleVerySmallShip.{$i}"/>
</do_else>
</do_if>
<!-- can probably remove this. to do: verify that $we_LostMassTraffic is always empty.
nope. looks like there are mass traffic objects that don't have a commander.
normal mass traffic does, since they're docked above,
so these are likely candidates as lost welder drones and cargolifters. -->
<do_elseif value="$we_EverySingleVerySmallShip.{$i}.commander.isoperational or $we_EverySingleVerySmallShip.{$i}.dronecommander.isoperational" negate="true">
<do_if value="$we_EverySingleVerySmallShip.{$i}.unitcategory" exact="unitcategory.welder">
<!--<write_to_logbook category="tips" text="'%1 destroyed. LOST WELDERS'.[$we_EverySingleVerySmallShip.{$i}.knownname]"/>-->
<append_to_list name="$we_LostWelders" exact="$we_EverySingleVerySmallShip.{$i}"/>
<destroy_object object="$we_EverySingleVerySmallShip.{$i}"/>
</do_if>
<do_elseif value="$we_EverySingleVerySmallShip.{$i}.unitcategory" exact="unitcategory.transport">
<!--<write_to_logbook category="tips" text="'%1 destroyed. LOST CARGOLIFTERS'.[$we_EverySingleVerySmallShip.{$i}.knownname]"/>-->
<append_to_list name="$we_LostCargoLifters" exact="$we_EverySingleVerySmallShip.{$i}"/>
<destroy_object object="$we_EverySingleVerySmallShip.{$i}"/>
</do_elseif>
<do_else>
<!--<write_to_logbook category="tips" text="'%1 destroyed. LOST OTHER MASSTRAFFIC'.[$we_EverySingleVerySmallShip.{$i}.knownname]"/>-->
<append_to_list name="$we_OtherLostMassTraffic" exact="$we_EverySingleVerySmallShip.{$i}"/>
<destroy_object object="$we_EverySingleVerySmallShip.{$i}"/>
</do_else>
</do_elseif>
<do_else>
<append_to_list name="$we_WorkingMassTraffic" exact="$we_EverySingleVerySmallShip.{$i}"/>
</do_else>
</do_else>
</do_all>
<show_notification caption="'=== DRONE RESET ==='" details="'Drone reset script completed. \n\n %1 leader drones heading home. \n %2 follower drones heading home. \n %3 lost follower drones found and destroyed. \n %4 lost non-follower drones found and destroyed. \n %5 lost Construction URVs found and destroyed. \n %6 lost CargoLifters found and destroyed. \n %7 other lost mass traffic xs ships and drones found and destroyed. \n\n %8 mass traffic drones are working and have been left alone.'.[$we_LeaderDronesDocked.count, $we_FollowerDronesDocked.count, $we_LostFollowers.count, $we_LostNonFollowers.count, $we_LostWelders.count, $we_LostCargoLifters.count, $we_OtherLostMassTraffic.count, $we_WorkingMassTraffic.count]" queued="false" priority="9"/>
<write_to_logbook category="tips" text="'Drone reset script completed. \n\n %1 leader drones heading home. \n %2 follower drones heading home. \n %3 lost follower drones found and destroyed. \n %4 lost non-follower drones found and destroyed. \n %5 lost Construction URVs found and destroyed. \n %6 lost CargoLifters found and destroyed. \n %7 other lost mass traffic xs ships and drones found and destroyed. \n\n %8 mass traffic drones are working and have been left alone.'.[$we_LeaderDronesDocked.count, $we_FollowerDronesDocked.count, $we_LostFollowers.count, $we_LostNonFollowers.count, $we_LostWelders.count, $we_LostCargoLifters.count, $we_OtherLostMassTraffic.count, $we_WorkingMassTraffic.count]"/>
<remove_value name="$we_EverySingleVerySmallShip"/>
<remove_value name="$we_FollowerDronesDocked"/>
<remove_value name="$we_LostFollowers"/>
<remove_value name="$we_LeaderDronesDocked"/>
<remove_value name="$we_LostNonFollowers"/>
<remove_value name="$we_LostWelders"/>
<remove_value name="$we_LostCargoLifters"/>
<remove_value name="$we_OtherLostMassTraffic"/>
<remove_value name="$we_WorkingMassTraffic"/>
<reset_cue cue="this" />
</actions>
</cue>
</cues>
</mdscript>
Check out my other mods for X Rebirth:
MarineRebalance,
BetterAutoAim
SmalltalkHack,
Epic Capital Ship Shields,
Station Engineers,
Engineer Drone Fix,
Slightly More Useful Plot Station,
Miscellaneous IZ Combat Tweaks,
Miscellaneous OOZ Combat Tweaks,
DifficultyHack