Acquire the Erlking?

Please post any spoilers for X4: Foundations here.

Moderator: Moderators for English X Forum

Post Reply
User avatar
Pesanur
Posts: 1892
Joined: Sat, 5. Jan 08, 22:06
x4

Re: Acquire the Erlking?

Post by Pesanur » Thu, 24. Mar 22, 18:08

Mikhaleech wrote:
Wed, 23. Mar 22, 17:04
Ok Gentlements, instead of ridicoulous method, provided by Egosoft, here is a quick workaround to easy find all Erlking's Data Vaults:

Step 1. Temporarily turn off Steam Cloud sync in Steam properties. You may switch it on later.
Step 2. Temporarily turn off savegame compression in X4 game properties. You may switch it on later.
Step 3. Save your game in any slot, copy it somewhere for insurance. Quit the game.
Step 4. Download and install Notepad++ (if you didnt have it yet) or other more powerful XML edit program.
Step 5. Find and open with Notepad++ your savegame file. Usually it is located here - C:\Users\YOURNAME\OneDrive\Documents\Egosoft\X4\68221126\save
Step 6. Now sequentially find and fix all 5 strings with Erlking Vaults locations, to do so:
A. ctrl+F - find "landmarks_erlking_vault_01_macro". The first string shall be like this:
<component class="object" macro="landmarks_erlking_vault_01_macro" connection="space" code="BXD-821" owner="ownerless" knownto="player" id="[0x81bda]">
B. REPLACE in this string owner="ownerless" to owner="player"
C. Repeat the same operation with all subsequent strings from macro="landmarks_erlking_vault_01_macro" to macro="landmarks_erlking_vault_05_macro", where you should find and replace the owner for all numbers of vault_01, vault_02, etc.
Step 7. Dont forget to save the edited file. Then run the X4 game, load your edited savegame file.
Step 8. Open the map, position the view over new Avarice and Windfall sectors and type in the Search box (right upper corner of window) the word "data"
Step 9. PROFIT! All blueprints shall be added to you right after you fly near data vaults that deemed now as your property.

Yes this surgical operation shall mark your savegame as modified. I suppose the game verify a checksum. In that case consider to have two saves in different slots and simply remember or take a screenshot of vaults positions, then load clean save after and find them manually in all already known locations.
Thanks for the tip. I really appreciate it, as I was unable to found the two turrets BP vaults, but a small correction, vault's that have not yet been found, don't have the owner="ownerless" knownto="player" string, so you need to add it.

Berhg
Posts: 353
Joined: Wed, 25. Mar 09, 13:37
x4

Re: Acquire the Erlking?

Post by Berhg » Fri, 25. Mar 22, 00:03

Thank you mikhaleech. Got the last one using this method.
Save the bunnies! RTFM

[ external image ]

Diroc
Posts: 237
Joined: Wed, 22. Aug 12, 08:52
x4

Re: Acquire the Erlking?

Post by Diroc » Fri, 25. Mar 22, 04:46

Witzzard wrote:
Tue, 22. Mar 22, 01:30
Berhg wrote:
Tue, 22. Mar 22, 00:33
I've got my save pulled up. New I need hints on where to look on my 22 million lines of data. :lol:
There's a post in reddit from U/hatevampire describing how to read the save especially in that regards.
But from how i see it - the file is basically organised in connection-trees: SectorGroups (Cluster_) + Sectors (sector_), Zones (which can be dynamic temporally) followed by the content of that itself and their components and so on.
The blueprints can be found by searching for erlking_blueprint_ : 1 - Engine; 2- Shield; 3 - Main Battery; 4 - L Turrets; 5 - M Turrets.

After finding that you you reverse the search order (searching upwards in the lines instead of downwards) -> the first cluster_ line you should find, should give you which sector it is. Following hatevampire: Cluster_500_Sector001 = Avarice I; Cluster_500_Sector002 = Avarice IV; Cluster_500_Sector003 = Avarice V; Cluster_501 =Windfall 1; Cluster_502 = Windfall III; Cluster_503 = Windfall IV.

Now comes the seemingly more fiddly bit - where is it position wise in the sector. Which is also something i'm not a 100% on - so if anyone got a better idea, feel free to add to our understanding ;)
When the containing zone is a temporay zone, you seemingly can simply search from the erlking_blueprint_ : upwards for class="zone" and will find three lines "<offset> + position + </offset>", whereas the position line inbetween the offsets should hold the position you might want to look for.

If in the zone line, the zone isn't followed by a macro="tempzone" ,you'll seemingly have to go back down towards the vault/blueprint itself, as the position is set there through their own offset line.
You might want to use macro="landmarks_erlking_vault_. A few lines under that you should again see a <offset> line followed by a position. That position should then be the ones you should be looking at in the sector. Please note, the offset indicator should come before any <connections> indicator, as far as i can tell.

Then again, i'm not 100% clear on everything.
You can set up Alerts for when they are found as well.
In the same line that contains macro="landmarks_earlking_vault_ is a code="ABC-123" which corresponds to the station's unique callsign 3 letters, a hyphen and 3 numbers.

Add the Avarice and Windfall zones, add all the classes and put the ABC-123 or whatever the unique callsign in quotes after code= from the savefile into the object ID field for the Alert.

If you pick a good annoying notification sound and add an apporpriate notification text, you can send ships to go look for the Data Vaults and do something else.
Even if you are looking personally, it will let you know if you are not staring at the map that the vault is on your map.

CaptJimBob
Posts: 25
Joined: Sat, 15. Dec 12, 21:48
x4

Re: Acquire the Erlking?

Post by CaptJimBob » Fri, 25. Mar 22, 18:35

Well it seems the data vaults are random to where they spawn and just finished mapping the 3 Windfall and 3 Avarice sectors with advanced satellites in the core space (unexpanded) with a lot of overlap, and only found 3 data vaults. Trying to keep to the game play without having to go outside of gameplay but hard not to.

So to add, to see were I might have missed spots that I filled in later I use the map filters... set the map to show Other and search/filter on Satellite, Data Vault and the name of the ship(s) you are controlling.

Edit: So after well over another hour of watching ships fly around on my screen map and trying not to blink as they explored the outer reaches, have the last 2. Such excitement cannot be matched.

silentradios
Posts: 8
Joined: Wed, 13. Oct 21, 06:19
x4

Re: Acquire the Erlking?

Post by silentradios » Sat, 26. Mar 22, 00:35

Edit: 3/27/22 - See viewtopic.php?f=182&t=445929&p=5116566#p5116566 for an updated script that has some GUI and support for compressed saves.
Edit2: Apparently Avarice V and IV were swapped (I got the friendly name mapping from reddit - not sure where a real source is) -- I confirmed in my save and two others did as well.

I wrote a quick powershell script to parse out the positions of these from a savefile... You can just edit the save file location and copy/paste it into a powershell window.. (or the ISE/VS Code) -- or save it as a .ps1 file and execute it from powershell/similar (but you may need to enable script execution).
Output looks like:

Code: Select all

location            Xkm        Ykm        Zkm blueprint                                   vault                            code   
--------            ---        ---        --- ---------                                   -----                            ----   
Avarice I   -130.511729  -3.997909 -20.570798 shield_pir_xl_battleship_01_standard_01_mk1 landmarks_erlking_vault_02_macro PEA-580
Avarice V   -74.799359    8.76127 -44.103066 engine_pir_xl_battleship_01_allround_01_mk1 landmarks_erlking_vault_01_macro AZB-839
Windfall I  -124.946703 -31.050369 201.385469 turret_pir_l_battleship_01_laser_01_mk1     landmarks_erlking_vault_04_macro LKH-370
Windfall IV -227.566695   2.759944 -25.136927 turret_pir_m_battleship_01_gatling_02_mk1   landmarks_erlking_vault_05_macro RDK-874
Windfall IV -192.834066   2.296562 -45.444981 weapon_pir_xl_battleship_01_mk1             landmarks_erlking_vault_03_macro UEA-137
Here's the code for those wanting to run it themselves:

Code: Select all

#This uses a fair amount of memory - if you have limited ram exit X4 first...

$Xml=New-Object Xml
#unzip .gz file with 7-zip or gunzip first or use uncompressed saves
$Xml.Load("C:\full\path\to\autosave_02.xml")
$components=Select-Xml -Xml $Xml -XPath "/savegame/universe//component"
$erl=$components | ?{$_.Node.macro -and $_.Node.macro.Contains("erlking")}
$vaults = $erl | ?{$_.Node.macro -and $_.Node.macro.Contains("landmarks_erlking_vault")}

#From hatevampire at https://www.reddit.com/r/X4Foundations/comments/thjbik/how_to_read_save_file/
#Not sure where the real source of friendlyname is..

$locationtoname = @{
    cluster_500_sector001_macro="Avarice I"
    cluster_500_sector002_macro="Avarice V"
    cluster_500_sector003_macro="Avarice IV"
    cluster_501_macro="Windfall I"
    cluster_502_macro="Windfall III"
    cluster_503_macro="Windfall IV"
}

$macrotocoords=@{
     "Zone004_Cluster_503_Sector001_macro"="139680,0,-3215.59"
     "Zone003_Cluster_500_Sector003_macro"="-115796.9,0,-96109.38"
     "Zone002_Cluster_503_Sector001_macro"="-2269.199,0,165758.4"
     "Zone006_Cluster_500_Sector002_macro"="-184409.83,0,-3343.0"
     "Zone003_Cluster_501_Sector001_macro"="-97898.44,0,-23632.81"
     "Zone003_Cluster_500_Sector001_macro"="-97898.44,0,-23632.81"
     "Zone005_Cluster_501_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_504_Sector001_macro"="157616.8,0,-84263.63"
     "tzoneCluster_500_Sector002SHCon9_GateZone_macro"="-39827.2,0,200000"
     "tzoneCluster_500_Sector002SHCon5_GateZone_macro"="-50000,0,200000"
     "Zone001_Cluster_500_Sector003_macro"="-117046.9,0,82593.75"
     "Zone001_Cluster_501_Sector001_macro"="-127062.5,0,133718.8"
     "Zone005_Cluster_504_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_500_Sector001_macro"="103164.1,0,-32492.19"
     "Zone002_Cluster_500_Sector001_macro"="-10960.94,0,112070.3"
     "Zone003_Cluster_500_Sector002_macro"="-7132.69,0,531.25"
     "Zone002_Cluster_500_Sector002_macro"="-118489.4,0,-131687.5"
     "tzoneCluster_500_Sector003SHCon9_GateZone_macro"="50000,0,200000"
     "Zone005_Cluster_500_Sector002_macro"="98694.83,0,-126406.3"
     "tzoneCluster_500_Sector001SHCon2_GateZone_macro"="66960.9,0,-207957"
     "tzoneCluster_500_Sector003SHCon5_GateZone_macro"="40054.7,0,200000"
     "tzoneCluster_500_Sector001SHCon10_GateZone_macro"="-45738.28,0,-200000"
     "Zone005_Cluster_500_Sector003_macro"="34671.88,0,-152515.6"
     "Zone001_Cluster_504_Sector001_macro"="-127062.5,0,133718.8"
     "Zone003_Cluster_502_Sector001_macro"="-97898.44,0,-23632.81"
     "Zone002_Cluster_504_Sector001_macro"="137904.1,0,135199.3"
     "Zone005_Cluster_503_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone001_Cluster_500_Sector001_macro"="-127062.5,0,133718.8"
     "Zone004_Cluster_501_Sector001_macro"="103164.1,0,-32492.19"
     "tzoneCluster_500_Sector001SHCon4_GateZone_macro"="76886.7,0,-207957"
     "Zone006_Cluster_502_Sector001_macro"="47000.0,0,172000.0"
     "Zone002_Cluster_500_Sector003_macro"="44015.63,0,158125"
     "tzoneCluster_500_Sector001SHCon6_GateZone_macro"="-55785.2,0,-200000"
     "Zone002_Cluster_501_Sector001_macro"="-10960.94,0,112070.3"
     "Zone001_Cluster_500_Sector002_macro"="-78593.63,0,157937.5"
     "Zone003_Cluster_503_Sector001_macro"="-199365.3,0,-55454.45"
     "Zone001_Cluster_502_Sector001_macro"="-127062.5,0,133718.8"
     "Zone003_Cluster_504_Sector001_macro"="-226443.3,0,-97194.67"
     "Zone005_Cluster_500_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_500_Sector003_macro"="110359.4,0,7250"
     "Zone001_Cluster_503_Sector001_macro"="-190039.3,0,180073.9"
     "Zone005_Cluster_502_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_500_Sector002_macro"="101721.7,0,100656.3"
     "Zone002_Cluster_502_Sector001_macro"="108009.3,0,115933.7"
     "Zone004_Cluster_502_Sector001_macro"="103164.1,0,-32492.19"
}

#Get offsets up the tree
function Recurse-Offsets($node){
    if($node.class -and $node.class -eq "galaxy"){
        return @()
    }
    if($node.offset -ne $null){
        if($node.offset.position){
            $x=$node.offset.position.x
            $y=$node.offset.position.y
            $z=$node.offset.position.z
        } else {
            $x,$y,$z=0,0,0
        }
        if($node.offset.rotation){
            if($node.offset.rotation.yaw){$yaw=$node.offset.rotation.yaw} else {$yaw=0}
            if($node.offset.rotation.pitch){$pitch=$node.offset.rotation.pitch} else {$pitch=0}
            if($node.offset.rotation.roll){$roll=$node.offset.rotation.roll} else {$roll=0}
        } else {
            $pitch,$roll,$yaw=0,0,0
        }
        if($macrotocoords[$node.macro]){
            $x,$y,$z=$macrotocoords[$node.macro].Split(",")
        }
        $obj = [pscustomobject]@{
            x=$x
            y=$y
            z=$z
            pitch=$pitch
            roll=$roll
            yaw=$yaw
            code=$node.code
            macro=$node.macro
            class=$node.class
        }
        return @($obj) + (Recurse-Offsets -node $node.ParentNode)
    } else {
        return Recurse-Offsets -node $node.ParentNode
    }
}

. {
    foreach($vault in $vaults){
        $data=Recurse-Offsets $vault.Node
        $sums = $data | Measure-Object -Sum -Property x,y,z
        $location = $data |?{$_.class -eq "sector"} | select -ExpandProperty macro
        if([string]::IsNullOrWhiteSpace($location)){
            $location = $data |?{$_.class -eq "cluster"} | select -ExpandProperty macro
        }
        [pscustomobject]@{
            location=$locationtoname[$location]
            Xkm=($sums |?{$_.property -eq "x"}).sum/1000
            Ykm=($sums |?{$_.property -eq "y"}).sum/1000
            Zkm=($sums |?{$_.property -eq "z"}).sum/1000
            blueprint=$vault.Node.connections.connection.component.blueprints |?{$_ -ne $null}
            vault=$vault.Node.macro
            code=$vault.Node.code
        }
    }
} | ft -AutoSize
Some other useful bits:

Code: Select all

<#
#Some other useful snippets

#detailed output
. {
    foreach($vault in $vaults){
        Recurse-Offsets $vault.Node
        "-----"
    }
} | ft -AutoSize

#parse out zone info
$zoneinfo = [xml](gc c:\path\to\dlc_pirate_sectors.xml)
$hash = @{}
$zoneinfo.macros.macro | %{
    $_.connections.connection | %{
        $hash += @{$_.macro.ref = $_.offset.position } 
    }
}
# Generate a powershell hash for the above xml and put it on the clipboard
"@{`n" + ($hash.GetEnumerator() |%{"    `"$($_.key)`"=`"$(@($_.value.x,$_.value.y,$_.value.z) -join ",")`"`n"}) + "}" | clip
$components=Select-Xml -Xml $Xml -XPath "/savegame/universe//component"
# Get all classes
$components.Node.class | select -Unique | sort

order of map related:
    galaxy
    cluster
    sector
    zone
#>
Last edited by silentradios on Sun, 27. Mar 22, 23:51, edited 3 times in total.

User avatar
OOZ662
Posts: 1211
Joined: Tue, 8. Apr 08, 10:45
x4

Re: Acquire the Erlking?

Post by OOZ662 » Sat, 26. Mar 22, 07:30

Given that the map sectors zoom and "scroll" in order to fit what's inside them and AFAIK there's no coordinate readout in the UI, how does one determine where (0,0,0) is inside a sector?

silentradios
Posts: 8
Joined: Wed, 13. Oct 21, 06:19
x4

Re: Acquire the Erlking?

Post by silentradios » Sat, 26. Mar 22, 07:40

I was just eyeballing the center based on the center of the hex for vertical and the middle of the top edge for horizontal. That said due the different relative zoom I did find it helpful to deploy an advanced satellite (which has a known 75km radius) near the center to help with eyeballing positioning.

User avatar
OOZ662
Posts: 1211
Joined: Tue, 8. Apr 08, 10:45
x4

Re: Acquire the Erlking?

Post by OOZ662 » Sat, 26. Mar 22, 08:04

I laid myself a nav beacon for each coordinate "arm" and found nothing where it was supposed to be, so I'm just curious if my sector having a station way into the -z has shifted the sector map down such that (0,0,0) is no longer in the center. Or I just didn't set them accurately enough; I'll try again after I get off work tomorrow.

Berni
Posts: 515
Joined: Sun, 15. Feb 04, 13:52
x4

Re: Acquire the Erlking?

Post by Berni » Sat, 26. Mar 22, 17:32

Berhg wrote:
Thu, 17. Mar 22, 05:01
Board it without damaging any of its systems and you won't suffer rep loss. You don't even have to get the shields down and damage the hull. It will just take a long time for the marines to cut through the hull. Use several large transports to get the maximum amount of marines possible in the assault.
how do you do this?? my boarding pods won't launch until i've 1) destroyed turrets 2) stripped the shield and 3) damaged the hull to 80%

...is there a cheat or exploit or workaround to start boarding without these 3 steps??

EDIT:

nvm, figured it out^^ -> set both options to very strong! :)

User avatar
mr.WHO
Posts: 8549
Joined: Thu, 12. Oct 06, 17:19
x4

Re: Acquire the Erlking?

Post by mr.WHO » Sat, 26. Mar 22, 22:56

Strange, in my save, I can only find blueprints erlking_blueprint_1 to 3, but not 4 and 5 (the turrets).

I thought it was hotfixed?

Or should I check for vaults instead?

for position x,y,z what is the unit? meters? like 78064.089, what does it mean? 78 km?

Witzzard
Posts: 170
Joined: Wed, 3. Aug 05, 15:17
x4

Re: Acquire the Erlking?

Post by Witzzard » Sun, 27. Mar 22, 01:25

As far as i can tell you normaly should find blueprints and vaults. You can try finding the vaults, but i think somethings then borked if you don't find the blueprints themselves.
And yes it would be 78km.

User avatar
Pesanur
Posts: 1892
Joined: Sat, 5. Jan 08, 22:06
x4

Re: Acquire the Erlking?

Post by Pesanur » Sun, 27. Mar 22, 07:59

mr.WHO wrote:
Sat, 26. Mar 22, 22:56
Strange, in my save, I can only find blueprints erlking_blueprint_1 to 3, but not 4 and 5 (the turrets).

I thought it was hotfixed?

Or should I check for vaults instead?

for position x,y,z what is the unit? meters? like 78064.089, what does it mean? 78 km?

Look for erlking_vault

Genoscythe
Posts: 175
Joined: Fri, 27. Jan 17, 13:19
x4

Re: Acquire the Erlking?

Post by Genoscythe » Sun, 27. Mar 22, 13:24

silentradios wrote:
Sat, 26. Mar 22, 00:35
I wrote a quick powershell script to parse out the positions of these from a savefile... You can just edit the save file location and copy/paste it into a powershell window.. (or the ISE/VS Code) -- or save it as a .ps1 file and execute it from powershell/similar (but you may need to enable script execution).
Output looks like:

Code: Select all

location            Xkm        Ykm        Zkm blueprint                                   vault                            code   
--------            ---        ---        --- ---------                                   -----                            ----   
Avarice I   -130.511729  -3.997909 -20.570798 shield_pir_xl_battleship_01_standard_01_mk1 landmarks_erlking_vault_02_macro PEA-580
Avarice IV   -74.799359    8.76127 -44.103066 engine_pir_xl_battleship_01_allround_01_mk1 landmarks_erlking_vault_01_macro AZB-839
Windfall I  -124.946703 -31.050369 201.385469 turret_pir_l_battleship_01_laser_01_mk1     landmarks_erlking_vault_04_macro LKH-370
Windfall IV -227.566695   2.759944 -25.136927 turret_pir_m_battleship_01_gatling_02_mk1   landmarks_erlking_vault_05_macro RDK-874
Windfall IV -192.834066   2.296562 -45.444981 weapon_pir_xl_battleship_01_mk1             landmarks_erlking_vault_03_macro UEA-137
Here's the code for those wanting to run it themselves:

Code: Select all

#This uses a fair amount of memory - if you have limited ram exit X4 first...

$Xml=New-Object Xml
#unzip .gz file with 7-zip or gunzip first or use uncompressed saves
$Xml.Load("C:\full\path\to\autosave_02.xml")
$components=Select-Xml -Xml $Xml -XPath "/savegame/universe//component"
$erl=$components | ?{$_.Node.macro -and $_.Node.macro.Contains("erlking")}
$vaults = $erl | ?{$_.Node.macro -and $_.Node.macro.Contains("landmarks_erlking_vault")}

#From hatevampire at https://www.reddit.com/r/X4Foundations/comments/thjbik/how_to_read_save_file/
#Not sure where the real source of friendlyname is..

$locationtoname = @{
    cluster_500_sector001_macro="Avarice I"
    cluster_500_sector002_macro="Avarice IV"
    cluster_500_sector003_macro="Avarice V"
    cluster_501_macro="Windfall I"
    cluster_502_macro="Windfall III"
    cluster_503_macro="Windfall IV"
}

$macrotocoords=@{
     "Zone004_Cluster_503_Sector001_macro"="139680,0,-3215.59"
     "Zone003_Cluster_500_Sector003_macro"="-115796.9,0,-96109.38"
     "Zone002_Cluster_503_Sector001_macro"="-2269.199,0,165758.4"
     "Zone006_Cluster_500_Sector002_macro"="-184409.83,0,-3343.0"
     "Zone003_Cluster_501_Sector001_macro"="-97898.44,0,-23632.81"
     "Zone003_Cluster_500_Sector001_macro"="-97898.44,0,-23632.81"
     "Zone005_Cluster_501_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_504_Sector001_macro"="157616.8,0,-84263.63"
     "tzoneCluster_500_Sector002SHCon9_GateZone_macro"="-39827.2,0,200000"
     "tzoneCluster_500_Sector002SHCon5_GateZone_macro"="-50000,0,200000"
     "Zone001_Cluster_500_Sector003_macro"="-117046.9,0,82593.75"
     "Zone001_Cluster_501_Sector001_macro"="-127062.5,0,133718.8"
     "Zone005_Cluster_504_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_500_Sector001_macro"="103164.1,0,-32492.19"
     "Zone002_Cluster_500_Sector001_macro"="-10960.94,0,112070.3"
     "Zone003_Cluster_500_Sector002_macro"="-7132.69,0,531.25"
     "Zone002_Cluster_500_Sector002_macro"="-118489.4,0,-131687.5"
     "tzoneCluster_500_Sector003SHCon9_GateZone_macro"="50000,0,200000"
     "Zone005_Cluster_500_Sector002_macro"="98694.83,0,-126406.3"
     "tzoneCluster_500_Sector001SHCon2_GateZone_macro"="66960.9,0,-207957"
     "tzoneCluster_500_Sector003SHCon5_GateZone_macro"="40054.7,0,200000"
     "tzoneCluster_500_Sector001SHCon10_GateZone_macro"="-45738.28,0,-200000"
     "Zone005_Cluster_500_Sector003_macro"="34671.88,0,-152515.6"
     "Zone001_Cluster_504_Sector001_macro"="-127062.5,0,133718.8"
     "Zone003_Cluster_502_Sector001_macro"="-97898.44,0,-23632.81"
     "Zone002_Cluster_504_Sector001_macro"="137904.1,0,135199.3"
     "Zone005_Cluster_503_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone001_Cluster_500_Sector001_macro"="-127062.5,0,133718.8"
     "Zone004_Cluster_501_Sector001_macro"="103164.1,0,-32492.19"
     "tzoneCluster_500_Sector001SHCon4_GateZone_macro"="76886.7,0,-207957"
     "Zone006_Cluster_502_Sector001_macro"="47000.0,0,172000.0"
     "Zone002_Cluster_500_Sector003_macro"="44015.63,0,158125"
     "tzoneCluster_500_Sector001SHCon6_GateZone_macro"="-55785.2,0,-200000"
     "Zone002_Cluster_501_Sector001_macro"="-10960.94,0,112070.3"
     "Zone001_Cluster_500_Sector002_macro"="-78593.63,0,157937.5"
     "Zone003_Cluster_503_Sector001_macro"="-199365.3,0,-55454.45"
     "Zone001_Cluster_502_Sector001_macro"="-127062.5,0,133718.8"
     "Zone003_Cluster_504_Sector001_macro"="-226443.3,0,-97194.67"
     "Zone005_Cluster_500_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_500_Sector003_macro"="110359.4,0,7250"
     "Zone001_Cluster_503_Sector001_macro"="-190039.3,0,180073.9"
     "Zone005_Cluster_502_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_500_Sector002_macro"="101721.7,0,100656.3"
     "Zone002_Cluster_502_Sector001_macro"="108009.3,0,115933.7"
     "Zone004_Cluster_502_Sector001_macro"="103164.1,0,-32492.19"
}

#Get offsets up the tree
function Recurse-Offsets($node){
    if($node.class -and $node.class -eq "galaxy"){
        return @()
    }
    if($node.offset -ne $null){
        if($node.offset.position){
            $x=$node.offset.position.x
            $y=$node.offset.position.y
            $z=$node.offset.position.z
        } else {
            $x,$y,$z=0,0,0
        }
        if($node.offset.rotation){
            if($node.offset.rotation.yaw){$yaw=$node.offset.rotation.yaw} else {$yaw=0}
            if($node.offset.rotation.pitch){$pitch=$node.offset.rotation.pitch} else {$pitch=0}
            if($node.offset.rotation.roll){$roll=$node.offset.rotation.roll} else {$roll=0}
        } else {
            $pitch,$roll,$yaw=0,0,0
        }
        if($macrotocoords[$node.macro]){
            $x,$y,$z=$macrotocoords[$node.macro].Split(",")
        }
        $obj = [pscustomobject]@{
            x=$x
            y=$y
            z=$z
            pitch=$pitch
            roll=$roll
            yaw=$yaw
            code=$node.code
            macro=$node.macro
            class=$node.class
        }
        return @($obj) + (Recurse-Offsets -node $node.ParentNode)
    } else {
        return Recurse-Offsets -node $node.ParentNode
    }
}

. {
    foreach($vault in $vaults){
        $data=Recurse-Offsets $vault.Node
        $sums = $data | Measure-Object -Sum -Property x,y,z
        $location = $data |?{$_.class -eq "sector"} | select -ExpandProperty macro
        if([string]::IsNullOrWhiteSpace($location)){
            $location = $data |?{$_.class -eq "cluster"} | select -ExpandProperty macro
        }
        [pscustomobject]@{
            location=$locationtoname[$location]
            Xkm=($sums |?{$_.property -eq "x"}).sum/1000
            Ykm=($sums |?{$_.property -eq "y"}).sum/1000
            Zkm=($sums |?{$_.property -eq "z"}).sum/1000
            blueprint=$vault.Node.connections.connection.component.blueprints |?{$_ -ne $null}
            vault=$vault.Node.macro
            code=$vault.Node.code
        }
    }
} | ft -AutoSize
Some other useful bits:

Code: Select all

<#
#Some other useful snippets

#detailed output
. {
    foreach($vault in $vaults){
        Recurse-Offsets $vault.Node
        "-----"
    }
} | ft -AutoSize

#parse out zone info
$zoneinfo = [xml](gc c:\path\to\dlc_pirate_sectors.xml)
$hash = @{}
$zoneinfo.macros.macro | %{
    $_.connections.connection | %{
        $hash += @{$_.macro.ref = $_.offset.position } 
    }
}
# Generate a powershell hash for the above xml and put it on the clipboard
"@{`n" + ($hash.GetEnumerator() |%{"    `"$($_.key)`"=`"$(@($_.value.x,$_.value.y,$_.value.z) -join ",")`"`n"}) + "}" | clip
$components=Select-Xml -Xml $Xml -XPath "/savegame/universe//component"
# Get all classes
$components.Node.class | select -Unique | sort

order of map related:
    galaxy
    cluster
    sector
    zone
#>
This spewed out a couple of errors of not being able to find my file despite the path being right, but I got it working eventually. You sir are a true knight errant. I would also like to ask EGO to change this tedium, my god, just lock it behind research or something, we need have have a shipyard anyway to actually equip these weapons!

silentradios
Posts: 8
Joined: Wed, 13. Oct 21, 06:19
x4

Re: Acquire the Erlking?

Post by silentradios » Sun, 27. Mar 22, 13:34

Genoscythe wrote:
Sun, 27. Mar 22, 13:24

This spewed out a couple of errors of not being able to find my file despite the path being right, but I got it working eventually. You sir are a true knight errant. I would also like to ask EGO to change this tedium, my god, just lock it behind research or something, we need have have a shipyard anyway to actually equip these weapons!
What did you end up having to fix / change? I thought I tested it in a fresh session but perhaps I missed something.. if so I'll update the post.

Genoscythe
Posts: 175
Joined: Fri, 27. Jan 17, 13:19
x4

Re: Acquire the Erlking?

Post by Genoscythe » Sun, 27. Mar 22, 13:43

silentradios wrote:
Sun, 27. Mar 22, 13:34
Genoscythe wrote:
Sun, 27. Mar 22, 13:24

This spewed out a couple of errors of not being able to find my file despite the path being right, but I got it working eventually. You sir are a true knight errant. I would also like to ask EGO to change this tedium, my god, just lock it behind research or something, we need have have a shipyard anyway to actually equip these weapons!
What did you end up having to fix / change? I thought I tested it in a fresh session but perhaps I missed something.. if so I'll update the post.
Nah I think it might be my PC, when I copied the file as a path it would give me
Spoiler
Show
Exception calling "Load" with "1" argument(s): "'▼', hexadecimal value 0x1F, is an invalid character. Line 1, position
1."
At line:5 char:1
+ $Xml.Load("C:\Users\MYUSER\Documents\Egosoft\X4\NUMBERS\save\autosave_02.xml.gz")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
so I just tried different files until it worked. I'm not very knowledgeable in code, can you maybe point me to what I did wrong here?

silentradios
Posts: 8
Joined: Wed, 13. Oct 21, 06:19
x4

Re: Acquire the Erlking?

Post by silentradios » Sun, 27. Mar 22, 14:43

Genoscythe wrote:
Sun, 27. Mar 22, 13:43
+ $Xml.Load("C:\Users\MYUSER\Documents\Egosoft\X4\NUMBERS\save\autosave_02.xml.gz")
That would be a compressed save :) hence the comment "#unzip .gz file with 7-zip or gunzip first or use uncompressed saves" in the script. I'm going to make a version that deals with compressed saves and more in a bit here.
Edit: just did, see two posts down -- give it a whirl and let me know if it works for someone that isn't me ;)
Last edited by silentradios on Sun, 27. Mar 22, 14:55, edited 1 time in total.

User avatar
mr.WHO
Posts: 8549
Joined: Thu, 12. Oct 06, 17:19
x4

Re: Acquire the Erlking?

Post by mr.WHO » Sun, 27. Mar 22, 14:45

Shit, still got one final blueprint to find out in Avarice IV with coordinates:
x 236'377
y 6'367
z 311'797

But I spammed a grid of advance sattelites in North-East of the sector and can't find anything :(

silentradios
Posts: 8
Joined: Wed, 13. Oct 21, 06:19
x4

Re: Acquire the Erlking?

Post by silentradios » Sun, 27. Mar 22, 14:51

Edit 3/27: Apparently Avarice V and IV were swapped (I got the friendly name mapping from reddit - not sure where a real source is) -- I confirmed in my save and two others did as well
Edit 6/2/23: Thanks jojorne for catching an issue related to the GUI for compressed saves

Here is a bat file that runs the powershell inside it (sneaky.. but effective) : https://anechoic.space/erlkinggui.bat
It has a few features over the previous script including:
  • A File selection dialog
  • Support for gz / compressed saves
  • GUI output of the positions
Here is the same script that you can copy and past and save into a .bat file (use notepad and save as UTF-8 or ANSI (do not select the with BOM ones) and run to avoid the prompts that you get from windows about it being safe or not..

Code: Select all

@findstr/v "^@f.*&" "%~f0"|powershell -noprofile -executionpolicy bypass -&goto:eof
#Fist line stolen from https://stackoverflow.com/a/2611394
#This uses a fair amount of memory - if you have limited ram exit X4 first...
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Messagebox]::Show("This uses a fair amount of memory - if you have limited ram exit X4 first...")

#stolen from https://4sysops.com/archives/how-to-create-an-open-file-folder-dialog-box-with-powershell/
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{ 
    InitialDirectory = [Environment]::GetFolderPath('MyDocuments') + "\Egosoft\X4" 
    Filter = 'Save file (*.xml; *.xml.gz)|*.xml;*.xml.gz'
    Title = "Select savegame file"
}
while([string]::IsNullOrWhiteSpace($FileBrowser.FileName)){
    $null = $FileBrowser.ShowDialog()
    sleep 1
}

#from https://social.technet.microsoft.com/Forums/windowsserver/en-US/5aa53fef-5229-4313-a035-8b3a38ab93f5/unzip-gz-files-using-powershell?forum=winserverpowershell
Function Expand-GZip{
    Param(
        $infile,
        $outfile = ($infile -replace '\.gz$','')
        )
    $input = New-Object System.IO.FileStream $inFile, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::Read)
    $output = New-Object System.IO.FileStream $outFile, ([IO.FileMode]::Create), ([IO.FileAccess]::Write), ([IO.FileShare]::None)
    $gzipStream = New-Object System.IO.Compression.GzipStream $input, ([IO.Compression.CompressionMode]::Decompress)
    $buffer = New-Object byte[](1024)
    while($true){
        $read = $gzipstream.Read($buffer, 0, 1024)
        if ($read -le 0){break}
        $output.Write($buffer, 0, $read)
        }
    $gzipStream.Close()
    $output.Close()
    $input.Close()
}

$gzip = $false

if($FileBrowser.FileName -match "\.gz$"){
    Write-Host "Extracting compressed save, this may take a while"
    $gzip = $true
    Expand-GZip -infile $FileBrowser.FileName
}

if($gzip) {
    $file = ($FileBrowser.FileName -replace '\.gz$','')
} else {
    $file = $FileBrowser.FileName
}

Write-Host "Loading XML, this may take a while and will use lots of ram"

$Xml=New-Object Xml
#unzip .gz file with 7-zip or gunzip first or use uncompressed saves
$Xml.Load($file)

Write-Host "Finding Erlking Data Vaults"
$components=Select-Xml -Xml $Xml -XPath "/savegame/universe//component"
$erl=$components | ?{$_.Node.macro -and $_.Node.macro.Contains("erlking")}
$vaults = $erl | ?{$_.Node.macro -and $_.Node.macro.Contains("landmarks_erlking_vault")}

#From hatevampire at https://www.reddit.com/r/X4Foundations/comments/thjbik/how_to_read_save_file/
#Not sure where the real source of friendlyname is..

$locationtoname = @{
    cluster_500_sector001_macro="Avarice I"
    cluster_500_sector002_macro="Avarice V"
    cluster_500_sector003_macro="Avarice IV"
    cluster_501_macro="Windfall I"
    cluster_502_macro="Windfall III"
    cluster_503_macro="Windfall IV"
}

$macrotocoords=@{
     "Zone004_Cluster_503_Sector001_macro"="139680,0,-3215.59"
     "Zone003_Cluster_500_Sector003_macro"="-115796.9,0,-96109.38"
     "Zone002_Cluster_503_Sector001_macro"="-2269.199,0,165758.4"
     "Zone006_Cluster_500_Sector002_macro"="-184409.83,0,-3343.0"
     "Zone003_Cluster_501_Sector001_macro"="-97898.44,0,-23632.81"
     "Zone003_Cluster_500_Sector001_macro"="-97898.44,0,-23632.81"
     "Zone005_Cluster_501_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_504_Sector001_macro"="157616.8,0,-84263.63"
     "tzoneCluster_500_Sector002SHCon9_GateZone_macro"="-39827.2,0,200000"
     "tzoneCluster_500_Sector002SHCon5_GateZone_macro"="-50000,0,200000"
     "Zone001_Cluster_500_Sector003_macro"="-117046.9,0,82593.75"
     "Zone001_Cluster_501_Sector001_macro"="-127062.5,0,133718.8"
     "Zone005_Cluster_504_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_500_Sector001_macro"="103164.1,0,-32492.19"
     "Zone002_Cluster_500_Sector001_macro"="-10960.94,0,112070.3"
     "Zone003_Cluster_500_Sector002_macro"="-7132.69,0,531.25"
     "Zone002_Cluster_500_Sector002_macro"="-118489.4,0,-131687.5"
     "tzoneCluster_500_Sector003SHCon9_GateZone_macro"="50000,0,200000"
     "Zone005_Cluster_500_Sector002_macro"="98694.83,0,-126406.3"
     "tzoneCluster_500_Sector001SHCon2_GateZone_macro"="66960.9,0,-207957"
     "tzoneCluster_500_Sector003SHCon5_GateZone_macro"="40054.7,0,200000"
     "tzoneCluster_500_Sector001SHCon10_GateZone_macro"="-45738.28,0,-200000"
     "Zone005_Cluster_500_Sector003_macro"="34671.88,0,-152515.6"
     "Zone001_Cluster_504_Sector001_macro"="-127062.5,0,133718.8"
     "Zone003_Cluster_502_Sector001_macro"="-97898.44,0,-23632.81"
     "Zone002_Cluster_504_Sector001_macro"="137904.1,0,135199.3"
     "Zone005_Cluster_503_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone001_Cluster_500_Sector001_macro"="-127062.5,0,133718.8"
     "Zone004_Cluster_501_Sector001_macro"="103164.1,0,-32492.19"
     "tzoneCluster_500_Sector001SHCon4_GateZone_macro"="76886.7,0,-207957"
     "Zone006_Cluster_502_Sector001_macro"="47000.0,0,172000.0"
     "Zone002_Cluster_500_Sector003_macro"="44015.63,0,158125"
     "tzoneCluster_500_Sector001SHCon6_GateZone_macro"="-55785.2,0,-200000"
     "Zone002_Cluster_501_Sector001_macro"="-10960.94,0,112070.3"
     "Zone001_Cluster_500_Sector002_macro"="-78593.63,0,157937.5"
     "Zone003_Cluster_503_Sector001_macro"="-199365.3,0,-55454.45"
     "Zone001_Cluster_502_Sector001_macro"="-127062.5,0,133718.8"
     "Zone003_Cluster_504_Sector001_macro"="-226443.3,0,-97194.67"
     "Zone005_Cluster_500_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_500_Sector003_macro"="110359.4,0,7250"
     "Zone001_Cluster_503_Sector001_macro"="-190039.3,0,180073.9"
     "Zone005_Cluster_502_Sector001_macro"="-23023.44,0,-160132.8"
     "Zone004_Cluster_500_Sector002_macro"="101721.7,0,100656.3"
     "Zone002_Cluster_502_Sector001_macro"="108009.3,0,115933.7"
     "Zone004_Cluster_502_Sector001_macro"="103164.1,0,-32492.19"
}

#Get offsets up the tree
function Recurse-Offsets($node){
    if($node.class -and $node.class -eq "galaxy"){
        return @()
    }
    if($node.offset -ne $null){
        if($node.offset.position){
            $x=$node.offset.position.x
            $y=$node.offset.position.y
            $z=$node.offset.position.z
        } else {
            $x,$y,$z=0,0,0
        }
        if($node.offset.rotation){
            if($node.offset.rotation.yaw){$yaw=$node.offset.rotation.yaw} else {$yaw=0}
            if($node.offset.rotation.pitch){$pitch=$node.offset.rotation.pitch} else {$pitch=0}
            if($node.offset.rotation.roll){$roll=$node.offset.rotation.roll} else {$roll=0}
        } else {
            $pitch,$roll,$yaw=0,0,0
        }
        if($macrotocoords[$node.macro]){
            $x,$y,$z=$macrotocoords[$node.macro].Split(",")
        }
        $obj = [pscustomobject]@{
            x=$x
            y=$y
            z=$z
            pitch=$pitch
            roll=$roll
            yaw=$yaw
            code=$node.code
            macro=$node.macro
            class=$node.class
        }
        return @($obj) + (Recurse-Offsets -node $node.ParentNode)
    } else {
        return Recurse-Offsets -node $node.ParentNode
    }
}

$data=. {
    foreach($vault in $vaults){
        $data=Recurse-Offsets $vault.Node
        $sums = $data | Measure-Object -Sum -Property x,y,z
        $location = $data |?{$_.class -eq "sector"} | select -ExpandProperty macro
        if([string]::IsNullOrWhiteSpace($location)){
            $location = $data |?{$_.class -eq "cluster"} | select -ExpandProperty macro
        }
        [pscustomobject]@{
            location=$locationtoname[$location]
            Xkm=($sums |?{$_.property -eq "x"}).sum/1000
            Ykm=($sums |?{$_.property -eq "y"}).sum/1000
            Zkm=($sums |?{$_.property -eq "z"}).sum/1000
            blueprint=$vault.Node.connections.connection.component.blueprints |?{$_ -ne $null}
            vault=$vault.Node.macro
            code=$vault.Node.code
        }
    }
} 
$data | ft -AutoSize
$data | Out-GridView
if($gzip){
    if([System.Windows.Forms.MessageBox]::Show("Remove the extracted save $file" , "Remove Save?" , 4, 64) -eq "Yes"){
        Remove-Item -Path $file
    }
}

[System.Windows.Forms.Messagebox]::Show("Done, you can copy out of the cmd window or grid view before closing this if you want.")

<#
#Some other useful snippets

#detailed output
. {
    foreach($vault in $vaults){
        Recurse-Offsets $vault.Node
        "-----"
    }
} | ft -AutoSize

#parse out zone info
$zoneinfo = [xml](gc c:\path\to\dlc_pirate_sectors.xml)
$hash = @{}
$zoneinfo.macros.macro | %{
    $_.connections.connection | %{
        $hash += @{$_.macro.ref = $_.offset.position } 
    }
}
# Generate a powershell hash for the above xml and put it on the clipboard
"@{`n" + ($hash.GetEnumerator() |%{"    `"$($_.key)`"=`"$(@($_.value.x,$_.value.y,$_.value.z) -join ",")`"`n"}) + "}" | clip
$components=Select-Xml -Xml $Xml -XPath "/savegame/universe//component"
# Get all classes
$components.Node.class | select -Unique | sort

order of map related:
    galaxy
    cluster
    sector
    zone
#>
Last edited by silentradios on Sat, 3. Jun 23, 05:16, edited 3 times in total.

Genoscythe
Posts: 175
Joined: Fri, 27. Jan 17, 13:19
x4

Re: Acquire the Erlking?

Post by Genoscythe » Sun, 27. Mar 22, 15:18

silentradios wrote:
Sun, 27. Mar 22, 14:43
Genoscythe wrote:
Sun, 27. Mar 22, 13:43
+ $Xml.Load("C:\Users\MYUSER\Documents\Egosoft\X4\NUMBERS\save\autosave_02.xml.gz")
That would be a compressed save :) hence the comment "#unzip .gz file with 7-zip or gunzip first or use uncompressed saves" in the script. I'm going to make a version that deals with compressed saves and more in a bit here.
Edit: just did, see two posts down -- give it a whirl and let me know if it works for someone that isn't me ;)
Thank you so much, seems to work just fine. now here are my findings:
Spoiler
Show
Avarice I -41.50094 0.411687 114.338425 landmarks_erlking_vault_03_macro CRO-532
Avarice I -14.863245 2.050524 142.23512 landmarks_erlking_vault_01_macro RZO-942
Avarice V -110.893177 -0.237999 -122.240589 shield_pir_xl_battleship_01_standard_01_mk1 landmarks_erlking_vault_02_macro LWL-406
Avarice V -201.535812 11.280293 337.57925 turret_pir_l_battleship_01_laser_01_mk1 landmarks_erlking_vault_04_macro DMI-448
Windfall III -9.835768 3.133138 -142.84255 landmarks_erlking_vault_05_macro XNA-779
HOWEVER, there are no vaults in Avarice V, instead they were located on these positions in avarice IV? I think the macro you used to map the sectors mixed something up. I have marked beacons as player owned in the save file (RIP unmodified game, will just play on earlier save), see the image.

https://imgur.com/a/7HUyGme

User avatar
mr.WHO
Posts: 8549
Joined: Thu, 12. Oct 06, 17:19
x4

Re: Acquire the Erlking?

Post by mr.WHO » Sun, 27. Mar 22, 16:16

Genoscythe wrote:
Sun, 27. Mar 22, 15:18
HOWEVER, there are no vaults in Avarice V, instead they were located on these positions in avarice IV? I think the macro you used to map the sectors mixed something up. I have marked beacons as player owned in the save file (RIP unmodified game, will just play on earlier save), see the image.

https://imgur.com/a/7HUyGme
OMG, THANK YOU!

I've been satelite griding the Avarice V, like an idiot for last 2 hours, while in fact my last remaining vault was in Avarice IV.

Post Reply

Return to “X4: Foundations - Spoilers”