-
-
Save vexx32/cfa23f44edfe4f29ffdcc4c8a77ccbfe to your computer and use it in GitHub Desktop.
Searches Noita's terrain generation wang tiles for a specific pixel color. These trigger pixels are often used to spawn items, entities, etc. By default this script will look for pixels which are linked to SpawnApparition(), which can spawn the Kummitus (player ghost) entity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Drawing | |
function Get-WangTileSpawnTriggers { | |
[CmdletBinding()] | |
param( | |
[Parameter()] | |
[string] | |
# Path to your unpacked Nolla_Games_Noita\data directory | |
$Path = "$env:USERPROFILE\AppData\LocalLow\Nolla_Games_Noita\data", | |
[Parameter()] | |
[System.Drawing.Color] | |
# Defaults to 00FF5A, the pixel spawn trigger for Kummitus / the player ghost. | |
# Supply a replacement in a similar format if you want to search for other spawn triggers | |
$TargetColor = [System.Drawing.Color]::FromArgb(0, 0xff, 0x5a) | |
) | |
function Measure-SpawnTrigger { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory)] | |
[string] | |
$Path, | |
[Parameter(Mandatory)] | |
[System.Drawing.Color] | |
$Color | |
) | |
$triggers = 0 | |
$bitmap = [System.Drawing.Bitmap]::FromFile($Path) | |
try { | |
for ($x = 0; $x -lt $bitmap.Width; $x++) { | |
for ($y = 0; $y -lt $bitmap.Height; $y++) { | |
$pixel = $bitmap.GetPixel($x, $y) | |
if ($pixel.ToArgb() -eq $Color.ToArgb()) { | |
$triggers++ | |
} | |
} | |
} | |
} | |
finally { | |
$bitmap.Dispose() | |
} | |
$triggers | |
} | |
Join-Path $Path -ChildPath 'wang_tiles' | | |
Get-ChildItem -Filter *.png -File | | |
ForEach-Object { | |
[PSCustomObject]@{ | |
Biome = $_.Name | |
ApparitionSpawnLocations = Measure-SpawnTrigger -Path $_.FullName -Color $TargetColor | |
} | |
} | |
} | |
Get-WangTileSpawnTriggers | Sort-Object -Property ApparitionSpawnLocations -Descending |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment