BugMeNot2014 Posted January 14, 2022 Posted January 14, 2022 Can somebody help me with such script ? I need to remove all frames from particular animation, or even better, remove all frames, from all animations Quote
0 Tokei Posted January 24, 2022 Posted January 24, 2022 There are many ways to achieve that: foreach (var action in act) { action.Frames = action.Frames.Take(1).ToList(); } If you need more... "control" with indexes and which animations to remove exactly, you can do it this way too: for (int aid = 0; aid < act.Actions.Count; aid++) { for (int fid = act.Actions[aid].Frames.Count - 1; fid >= 1; fid--) { act[aid].Frames.RemoveAt(fid); } } If you want to apply this to a batch of files, you can do it this way too: var path = @"C:\Sprites\"; foreach (var file in Directory.GetFiles(path, "*.act")) { var actFile = new Act(file); actFile.Actions.ForEach(p => p.Frames = p.Frames.Take(1).ToList()); actFile.Save(file); } Quote
0 Akbare Posted January 15, 2022 Posted January 15, 2022 you ask for spriting item or script ? please more info not everyone can understand what you are saying Quote
0 chibubong Posted March 10, 2023 Posted March 10, 2023 On 1/24/2022 at 11:41 AM, Tokei said: There are many ways to achieve that: foreach (var action in act) { action.Frames = action.Frames.Take(1).ToList(); } If you need more... "control" with indexes and which animations to remove exactly, you can do it this way too: for (int aid = 0; aid < act.Actions.Count; aid++) { for (int fid = act.Actions[aid].Frames.Count - 1; fid >= 1; fid--) { act[aid].Frames.RemoveAt(fid); } } If you want to apply this to a batch of files, you can do it this way too: var path = @"C:\Sprites\"; foreach (var file in Directory.GetFiles(path, "*.act")) { var actFile = new Act(file); actFile.Actions.ForEach(p => p.Frames = p.Frames.Take(1).ToList()); actFile.Save(file); } I can't make this script work, it is not running and no errors were also given. Quote
0 Tokei Posted March 10, 2023 Posted March 10, 2023 2 hours ago, chibubong said: I can't make this script work, it is not running and no errors were also given. What part is not working for you? It removes all frames except the first one for me. Quote
0 antonigaming Posted March 19, 2023 Posted March 19, 2023 Piggybacking on this question. How do you run such script on a whole batch? Quote
0 Tokei Posted March 19, 2023 Posted March 19, 2023 11 hours ago, antonigaming said: Piggybacking on this question. How do you run such script on a whole batch? var path = @"C:\test\"; foreach (var actFile in Directory.GetFiles(path, "*.act")) { var sprFile = actFile.ReplaceExtension(".spr"); var act2 = new Act(actFile, sprFile); foreach (var action in act2) { action.Frames = action.Frames.Take(1).ToList(); } act2.SaveWithSprite(actFile, sprFile); } Quote
0 notmyproblem Posted April 2, 2023 Posted April 2, 2023 (edited) If anyone is looking to remove death animations here is the code var path = @"C:\RO\data\sprite\test"; foreach (var actFile in Directory.GetFiles(path, "*.act")) { var sprFile = actFile.ReplaceExtension(".spr"); var act2 = new Act(actFile, sprFile); for (int aid = 32; aid < act2.Actions.Count; aid++) { for (int fid = act2.Actions[aid].Frames.Count - 1; fid >= 1; fid--) { act2[aid].Frames.RemoveAt(fid); } } act2.SaveWithSprite(actFile, sprFile); } Edited April 10, 2023 by notmyproblem Quote
0 antonigaming Posted April 23, 2023 Posted April 23, 2023 On 4/2/2023 at 8:26 PM, notmyproblem said: If anyone is looking to remove death animations here is the code var path = @"C:\RO\data\sprite\test"; foreach (var actFile in Directory.GetFiles(path, "*.act")) { var sprFile = actFile.ReplaceExtension(".spr"); var act2 = new Act(actFile, sprFile); for (int aid = 32; aid < act2.Actions.Count; aid++) { for (int fid = act2.Actions[aid].Frames.Count - 1; fid >= 1; fid--) { act2[aid].Frames.RemoveAt(fid); } } act2.SaveWithSprite(actFile, sprFile); } What if I want to make the death animation faster and not totally removing it? Quote
0 Rivers Posted September 9, 2023 Posted September 9, 2023 (edited) Nevermind I did not read the code properly. Edited September 9, 2023 by Rivers My bad. Quote
0 reinmisaac Posted October 6, 2023 Posted October 6, 2023 (edited) The old script did not completely remove the death animation for me, so I modified it. not sure if it's optimal but it does the job for me. var path = @"C:\data\sprite\몬스터"; // Folder Path foreach (var actFile in Directory.GetFiles(path, "*.act")) { var sprFile = actFile.ReplaceExtension(".spr"); var act2 = new Act(actFile, sprFile); { act2.AnimationExecute(4, action => { action.Frames = new List<Frame> { new Frame() };}); } act2.SaveWithSprite(actFile, sprFile); } Edited October 24, 2023 by reinmisaac new script Quote
Question
BugMeNot2014
Can somebody help me with such script ? I need to remove all frames from particular animation, or even better, remove all frames, from all animations
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.