thx script
help script error
The script is not "error proof", it asumes your act files are perfectly made to begin with. I didn't use this script when I made the GRFs anyway, it's meant as an example.
I'm not sure what error you're receiving, but you can get all the resized heads from the GRF in this post :
http://herc.ws/board/topic/8280-big-head-characters/?p=49465
Is there anyway to convert a grf? XD i would like to make it a bit bigger like 0.8
convert 1 by 1 seems too waste time Orz
Yep, it's possible of course. Use the script below to remake a GRF instead. The input variables should be rather clear; change the path of data.grf for your own data.grf.
// Act Editor 1.0.5+ required// The following script will resize the heads, weapons, // shields, backpacks and wings to the mag value below.Utilities.Services.EncodingService.SetDisplayEncoding(1252);var mag = 0.7f;var dataGrfPath = @"C:ROdata.grf";var grfDestinationPath = @"C:RObighead.grf";var dataMaleHeadPath = @"dataspriteÀΰ£Á·¸Ó¸®Åë³²1_³²";var dataFemaleHeadPath = @"dataspriteÀΰ£Á·¸Ó¸®Åë¿©1_¿©";// Used to resize weapons, shields, backpacks and wings.bool resizeAcc = true; // Set this value to true to resize weapons, shields, backpacks and wingsvar foldersToExclude = new[] { @"¸öÅë", @"¸Ó¸®Åë" }.ToList();var foldersToRescale = new[] { @"dataspriteÀΰ£Á·", @"datasprite·Îºê", @"datasprite¹æÆÐ"};var progress = -1f;TaskManager.DisplayTaskC("Magnifying sprites...", "Please wait...", () => progress, isCancelling => {try { using (var grfDest = new GrfHolder(grfDestinationPath, GrfLoadOptions.New)) using (var grf = new GrfHolder(dataGrfPath)) { grf.Commands.BeginNoDelay(); var maleHeadReference = new Act( grf.FileTable[dataMaleHeadPath + ".act"].GetDecompressedData(), new Spr( grf.FileTable[dataMaleHeadPath + ".spr"].GetDecompressedData())); var femaleHeadReference = new Act( grf.FileTable[dataFemaleHeadPath + ".act"].GetDecompressedData(), new Spr( grf.FileTable[dataFemaleHeadPath + ".spr"].GetDecompressedData())); Action<FileEntry, Act> magnify = new Action<FileEntry, Act>((actEntry, actRef) => { if (!actEntry.RelativePath.IsExtension(".act")) return; if (isCancelling()) throw new OperationCanceledException(); var sprEntry = grf.FileTable.TryGet(actEntry.RelativePath.ReplaceExtension(".spr")); var actBody = new Act(actEntry.GetDecompressedData(), sprEntry == null ? new Spr() : new Spr(sprEntry.GetDecompressedData())); using (var mem = new MemoryStream()) { for (int ai = 0; ai < actBody.NumberOfActions; ai++) { for (int fi = 0; fi < actBody[ai].NumberOfFrames; fi++) { var frame = actBody.TryGetFrame(ai, fi); var frameRef = actRef.TryGetFrame(ai, fi); if (frame == null || frameRef == null) continue; if (frame.Anchors.Count == 0 || frameRef.Anchors.Count == 0) continue; var anchorFrame = frame.Anchors[0]; var layerRef = frameRef.Layers[0]; var anchorX = frame.Anchors[0].OffsetX; var anchorY = frame.Anchors[0].OffsetY; var diffX = anchorX - frameRef.Anchors[0].OffsetX; var diffY = anchorY - frameRef.Anchors[0].OffsetY; anchorFrame.OffsetX = (int) ((layerRef.OffsetX + diffX) * (mag - 1) + anchorX); anchorFrame.OffsetY = (int) ((layerRef.OffsetY + diffY) * (mag - 1) + anchorY); } } actBody.Magnify(mag); if (sprEntry == null) actBody.SaveNoSprite(mem); else actBody.Save(mem); grfDest.Commands.AddFileAbsolute(actEntry.RelativePath, mem); } }); foreach (var entry in grf.FileTable.EntriesInDirectory(@"dataspriteÀΰ£Á·¸öÅë³²", SearchOption.TopDirectoryOnly)) magnify(entry, maleHeadReference); foreach (var entry in grf.FileTable.EntriesInDirectory(@"dataspriteÀΰ£Á·¸öÅë¿©", SearchOption.TopDirectoryOnly)) magnify(entry, femaleHeadReference); if (resizeAcc) { progress = 50f; var index = -2; var entries = new List<FileEntry>(); foreach (var folderToRescale in foldersToRescale) { entries = entries.Concat(grf.FileTable.EntriesInDirectory(folderToRescale, SearchOption.AllDirectories)).ToList(); } foreach (var actEntry in entries) { index++; if (!actEntry.RelativePath.IsExtension(".act")) continue; if (foldersToExclude.Any(p => actEntry.RelativePath.Contains(p))) continue; if (isCancelling()) throw new OperationCanceledException(); var sprPath = actEntry.RelativePath.ReplaceExtension(".spr"); var sprEntry = grf.FileTable.TryGet(sprPath); using (var mem = new MemoryStream()) { var spriteExists = sprEntry != null; act = new Act(actEntry.GetDecompressedData(), spriteExists ? new Spr(sprEntry.GetDecompressedData()) : new Spr()); act.Magnify(mag, true); // Magnify the anchors as well if (spriteExists) act.Save(mem); else act.SaveNoSprite(mem); grfDest.Commands.AddFileAbsolute(actEntry.RelativePath, mem); } progress = 50f + ((float) index / entries.Count) * 50f; } } progress = -1; grfDest.Commands.End(); grfDest.Save(); grfDest.Reload(); grfDest.Compact(); }}catch (OperationCanceledException) { }catch (Exception err) { ErrorHandler.HandleException(err);}finally { GC.Collect(); progress = 100f;}});