Jump to content
  • 0

Act editor remove all frames script


BugMeNot2014

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  46
  • Reputation:   3
  • Joined:  07/19/14
  • Last Seen:  

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

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  657
  • Reputation:   662
  • Joined:  11/12/12
  • Last Seen:  

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);
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  491
  • Reputation:   19
  • Joined:  11/19/11
  • Last Seen:  

you ask for spriting item or script ?

please more info

not everyone can understand what you are saying

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  2
  • Reputation:   1
  • Joined:  11/30/16
  • Last Seen:  

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. 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  657
  • Reputation:   662
  • Joined:  11/12/12
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  03/11/17
  • Last Seen:  

Piggybacking on this question. How do you run such script on a whole batch?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  657
  • Reputation:   662
  • Joined:  11/12/12
  • Last Seen:  

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);
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  07/28/22
  • Last Seen:  

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 by notmyproblem
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  03/11/17
  • Last Seen:  

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?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  236
  • Reputation:   46
  • Joined:  12/04/13
  • Last Seen:  


Nevermind I did not read the code properly.

Edited by Rivers
My bad.
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  08/24/22
  • Last Seen:  

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 by reinmisaac
new script
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...