This should work:
$d = Math.floor(PokemonID Mod 4);
$c = (Math.floor(PokemonID/256)Mod 4) * 4;
$b = (Math.floor(PokemonID/65536)Mod 4) * 16;
$a = (Math.floor(PokemonID/16777216)Mod 4) * 64;
Unown = Math.floor(($a + $b + $c + $d) Mod 28);
Might have to change Mod to %'s
Also, for the Pokemon name hex-editing, you have to open the individual Pokemon .pkm files generated by PokeSAV, not the overall .sav file. Any hex editor should do.
$d = Math.floor(PokemonID Mod 4);
$c = (Math.floor(PokemonID/256)Mod 4) * 4;
$b = (Math.floor(PokemonID/65536)Mod 4) * 16;
$a = (Math.floor(PokemonID/16777216)Mod 4) * 64;
Unown = Math.floor(($a + $b + $c + $d) Mod 28);
Might have to change Mod to %'s
Also, for the Pokemon name hex-editing, you have to open the individual Pokemon .pkm files generated by PokeSAV, not the overall .sav file. Any hex editor should do.