rainbowflesh
New Member
- Dec 21, 2019
- 13
- 8
.npc to .dat convert script:
How to use:
1. open pwsh terminal by your way or use Windows key + r then run `pwsh`
2. cd to your game files folder eg. `cd $HOME\AppData\LocalLow\RalivDev\Archipelagates\npcs`
3. copy and paste script, run
4. move .dat to ../appearances
Code:
Get-ChildItem -Path . -Filter *.npc -Recurse | ForEach-Object {
$npcFile = $_.FullName
try {
# Read and parse JSON content
$jsonContent = Get-Content -Raw -Path $npcFile | ConvertFrom-Json
# Extract appearance field
if ($jsonContent.PSObject.Properties.Name -contains 'appearance') {
$appearanceValue = $jsonContent.appearance
# Construct .dat file path
$datPath = [System.IO.Path]::ChangeExtension($npcFile, ".dat")
# Serialize appearance object to JSON and write to file
$appearanceValue | ConvertTo-Json -Depth 10 | Out-File -FilePath $datPath -Encoding UTF8
Write-Host "Processed: $npcFile -> $datPath"
} else {
Write-Warning "No 'appearance' key in $npcFile"
}
} catch {
Write-Error ("Failed to process {0}: {1}" -f $npcFile, $_)
}
}
1. open pwsh terminal by your way or use Windows key + r then run `pwsh`
2. cd to your game files folder eg. `cd $HOME\AppData\LocalLow\RalivDev\Archipelagates\npcs`
3. copy and paste script, run
4. move .dat to ../appearances