BugMeNot2014 Posted January 14, 2022 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 46 Reputation: 3 Joined: 07/19/14 Last Seen: June 7, 2023 Share 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 Link to comment Share on other sites More sharing options...
0 Tokei Posted January 24, 2022 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 690 Reputation: 715 Joined: 11/12/12 Last Seen: December 28, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 Akbare Posted January 15, 2022 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 491 Reputation: 20 Joined: 11/19/11 Last Seen: June 5, 2023 Share Posted January 15, 2022 you ask for spriting item or script ? please more info not everyone can understand what you are saying Quote Link to comment Share on other sites More sharing options...
0 chibubong Posted March 10, 2023 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 2 Reputation: 1 Joined: 11/30/16 Last Seen: January 13 Share 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 Link to comment Share on other sites More sharing options...
0 Tokei Posted March 10, 2023 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 690 Reputation: 715 Joined: 11/12/12 Last Seen: December 28, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 antonigaming Posted March 19, 2023 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 5 Reputation: 0 Joined: 03/11/17 Last Seen: August 22, 2024 Share Posted March 19, 2023 Piggybacking on this question. How do you run such script on a whole batch? Quote Link to comment Share on other sites More sharing options...
0 Tokei Posted March 19, 2023 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 690 Reputation: 715 Joined: 11/12/12 Last Seen: December 28, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 notmyproblem Posted April 2, 2023 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 1 Reputation: 0 Joined: 07/28/22 Last Seen: November 26, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 antonigaming Posted April 23, 2023 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 5 Reputation: 0 Joined: 03/11/17 Last Seen: August 22, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 Rivers Posted September 9, 2023 Group: Members Topic Count: 50 Topics Per Day: 0.01 Content Count: 240 Reputation: 56 Joined: 12/04/13 Last Seen: January 9 Share Posted September 9, 2023 (edited) Nevermind I did not read the code properly. Edited September 9, 2023 by Rivers My bad. Quote Link to comment Share on other sites More sharing options...
0 reinmisaac Posted October 6, 2023 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 1 Reputation: 0 Joined: 08/24/22 Last Seen: November 29, 2023 Share 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 Link to comment Share on other sites More sharing options...
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
Link to comment
Share on other sites
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.