BlackRain wrote:VincentTH wrote:I ran Simoom's script, and it deleted 471 CVs!!!!
I can post the final script if you need it.
I don't need it personally, but go ahead and post it for those that do. Shouldn't be an issue anymore.
Sure, here it is in its entirety. I combined Simoom's and Martian's script into 1. Credits go to both of them, of course.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="CWIR_IdleCV_Cleanup" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\games\Steam\steamapps\common\X Rebirth\MODS_JSGME\libraries\md.xsd">
<cues>
<cue name="CWIR_IdleCV_Cleanup" instantiate="true" namespace="this">
<conditions>
<event_game_loaded/>
</conditions>
<actions>
<!-- Idle CVs -->
<find_ship groupname="$Builders" primarypurpose="objectpurpose.build" space="player.galaxy" multiple="true"/>
<do_all exact="$Builders.count" counter="$Counter">
<do_if value="($Builders.{$Counter}.pilot.command.value == null) and not (@$Builders.{$Counter}.buildmodule.buildanchor.exists) and not (@$Builders.{$Counter}.container.exists) and not (@$Builders.{$Counter}.isplayerowned)">
<destroy_object object="$Builders.{$Counter}"/>
</do_if>
</do_all>
<write_to_logbook category="general" text="'Destroyed idle CVs: ' + $Builders.count" />
</actions>
</cue>
<cue name="CWIR_Docked_CV_Cleanup" instantiate="true" namespace="this">
<conditions>
<event_game_loaded/>
</conditions>
<actions>
<!-- Docked CVs -->
<find_station name="$shipyards" space="player.galaxy" functional="true" multiple="true">
<match_content class="class.buildmodule" />
</find_station>
<do_all exact="$shipyards.count" counter="$Counter">
<find_dock_location container="$shipyards.{$Counter}" size="tag.dock_xl" name="$docks" multiple="true"/>
<do_all exact="$docks.count" counter="$i">
<do_all exact="$docks.{$i}.component.docked.count" counter="$Count">
<do_if value="$docks.{$i}.component.docked.{$Count}.primarypurpose == objectpurpose.build and $docks.{$i}.component.docked.{$Count}.docklink">
<do_if value="$buildmodules.{$Count}.buildanchor.isplayerowned">
<start_script object="$docks.{$i}.component.docked.{$Count}.pilot" name="'player.default'"/>
</do_if>
<do_else>
<start_script object="$docks.{$i}.component.docked.{$Count}.pilot" name="'move.die'">
<param name="byjump" value="true"/>
</start_script>
</do_else>
</do_if>
</do_all>
</do_all>
<write_to_logbook category="general" text="'Destroyed docked CVs: ' + $docks.count" />
<remove_value name="$docks"/>
</do_all>
<remove_value name="$shipyards"/>
</actions>
</cue>
</cues>
</mdscript>
Put the contents into a file CleanUpCVs.xml and drop it in the directory
<Steam-XRebirth>/extensions/cwir/md
After you load your save game, do ENTER-2-4, and it will show how many docked/idle CVs have been deleted.
After you save the game, you can remove the script, as it is no longer needed in CWIR1.2.
Hope you find it useful.