//=============================================================================// ExtraMovementFrames.js//=============================================================================// Version: 1.0.3// Date: 10 November 2015//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/*: * @author Modern Algebra (rmrk.net) * @plugindesc Set sprites with more than 3 frames of animation * * @param Cycle Time * @desc The normal number of frames to complete animation cycle for custom sprites * @default 60 * * @param Default Idle Frame * @desc The idle frame for custom sprites unless changed in the filename * @default 0 * * @param Default Pattern * @desc Set patterns for custom sprites unless changed in the filename. * @default [] * * @help INSTRUCTIONS: * * To create sprites that have more than 3 frames of animation, you need * to rename the character graphic to something of the form: * * RegularName%(x) * x : the number of frames in each character sprite * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * EXAMPLES: * * $001-Fighter01%(4) * // This graphic is a single character with four frames of animation. * * 022-Actors12%(6) * // This graphic would be interpreted as a character sheet of 8 * // characters each having six frames of animation. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Additionally, this script also allows you to specify the "idle" frame (the * frame where the sprite is not moving), and also the pattern if you wish to so * specify. In essence, all you need to do is add those integers after the * number of frames: * * Regular_Name%(x y z1 z2 ... zn) * x : the number of frames in each character sprite * y : the idle frame (the frame shown when sprite is not moving) * z1 ... zn : the pattern. * * If you choose to specify a pattern, then the idle frame is not automatically * included in the pattern and should be repeated if you want it to appear * * When naming your files, be aware that the first frame in a sprite is index 0, * the second frame is index 1, etc. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * EXAMPLES: * * $003-Fighter03%(4 2) * // This graphic is a single character with four frames of animation. * // The idle frame is 2 (the third one over). The pattern when moving * // would be 2 3 0 1, 2 3 0 1, etc. (unless default patterns set - * // see below) * * 032-People05%(4 0 1 0 3 2) * // This graphic would be interpreted as a character sheet of 8 * // characters, each having four frames of animation. The idle frame is * // 0 (the first in the sheet), and the pattern is 1 0 3 2, * // 1 0 3 2, etc. * * $003-Fighter03%(6 0 1 2 3 4 5) * // This graphic is a single character with six frames of animation. * // The idle frame is 0 (the first frame). The pattern when moving * // is 1 2 3 4 5, 1 2 3 4 5, etc. * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PLUGIN SETTINGS: * * Cycle Time = 60 * * Cycle Time is the number of frames it will take to complete a full * animation cycle for custom sprites at normal speed. It must be set to an * integer. * * * Default Idle Frame = 0 * * If you do not specify an idle frame for custom sprites in the file name, then it * will be this frame. You must set this to an integer. * * Default Pattern = [] * * If you do not specify a pattern, then what happens depends on what you write * in the plugin setting for "Default Pattern". For this setting, you have the * option of writing in arrays of numbers in the following format: * * [x y z1 z2 ... zn] * x : number of frames in the sprites for which this pattern is default * y : idle frame * z1 z2 ... zn : the pattern * * If you have setup one of those arrays for the number of frames which this * custom sprite has, then it will use that pattern and idle frame. * * If you have not set up a default pattern for this number of frames, then the * animation will simply cycle through the number of frames, starting with the * idle frame and moving right. The idle frame will be included in the animation. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * EXAMPLES * * Default Pattern = [5 1 2 3 4 3 2] * // Whenever you set up a custom sprite that has 5 frames of animation * // but do not specify a pattern, the idle frame will be 1 and the * // pattern will be 2 3 4 3 2, 2 3 4 3 2, etc. * * Default Pattern = [5 1 2 3 4 3 2], [6 0 1 2 5 4 3 0] * // Whenever you set up a custom sprite that has 5 frames of animation * // but do not specify a pattern, the idle frame will be 1 and the * // pattern will be 2 3 4 3 2, 2 3 4 3 2, etc. * // Whenever you set up a custom sprite that has 6 frames of animation * // but do not specify a pattern, the idle frame will be 0 and the * // pattern will be 1 2 5 4 3 0, 1 2 5 4 3 0, etc. *///=============================================================================

Post in this thread if you have any comments or questions. It is perfectly fine to post here even if this topic has not been posted in for a very long time.

Please do not message me privately, as any concerns you have are likely shared by others and they will benefit from our correspondence being public. Additionally, I am often absent, and posting publicly will allow other members to assist you when I am unable to do so quickly.

Known Compatibility Issues

Spoiler for Yanfly Core Engine 1.0.5:

Some people reported an error with Yanfly's Core Engine where the sprites would sometimes reset patterns sporadically. The issue was fixed when Yanfly updated that plugin to version 1.0.6. Please update your version of that script at http://yanfly.moe/2015/10/09/yep-1-core-engine/

Terms of Use

You are welcome to use this script in any project of yours, whether it is commercial or non-commercial. There is no need to credit me, and please feel free to modify the plugin in whatever ways suit your project.

Basically, my plugin is your plugin, but please do not re-post this plugin or any modified version of it on another forum or website without checking with me first.

Great plugin MA Thanks for your hard work, this plugin is essential for my project!

A little something that might interest you though...

It seems there's a little conflict with Yanfly's Core Engine (v. 1.05). I'm using a 9 frames sprite sheet with 0 as an idle stance and when I'm using your plugin with Yanfly's, it seems to influence the way frames are read. It's hard to explain what is happening, as the effects look a bit random... Sometimes, the character will behave normally and go through his walking cycle normally, but sometimes (after turning in another direction), the game will not show the frames as it's supposed to. Sometimes, it'll look like it only show 3 frames of animation per cycle, sometimes 7, etc... It seems pretty random.

Your plugin works great alone, and I've tested it with several other plugins, and only Yanfly's Core Engine seems to conflict with it. I don't know if you're interested in compatibility issues or not, but considering Yanfly's Core Engine is a pretty major plugin, I thought you might be interested.

Thanks!

Edit: I did some other tests... The results I posted above were with a basic character speed of 5 (no dashing). I just tested it out with a basic speed of 4 (the default one), and it seems to work fine... I'll test it with other base speeds.

I just tested it out with other speeds, and it seems to work fine with speeds 2, 4 and 6, but it seems sometimes broken with a speed of 3, and almost always with a speed of 5. I wasn't able to tell anything with a speed of 1, since the animation goes way too fast to tell.

By the way, I just recalled... Shaz made a plugin allowing more frames per walking cycle. Her plugin worked well with the basic version of Yanfly's Core Engine, but once it got updated, it changed something that conflicted with Shaz's plugin. I remember testing it out, finding that it was working well with a speed of 4, but not with a speed of 5. I don't know if this helps you or not, but I thought you might like to know.

I couldn't repeat the error that you mentioned, but I did notice a few errors in the code while I was playing around with it so I have updated this script to version 1.0.2. There was an issue with my resetPattern function, so it is possible that was what was causing the glitches you noticed.

The only major change from the user's perspective was that I changed the way that default patterns work. Before, it just included the active pattern, so a person would still have to include both the number of frames and the idle frame in the filename. Now, it works so that you set up the default pattern just like you would name a filename (i.e. #frames, idleFrame, pattern). You just need to include the number of frames in the filename, and the idle frame will be selected from the default pattern associated with that number of frames.

I've been testing out again and here are my results with the update on your plugin. I've tested with Yanfly's Core Engine 1.05, with a sprite sheet of 9 frames (1 idle frame and 8 frames in a walking cycle of 1-2-3-4-5-6-7-8), and no dashing (except to test out "speed 7").

With Yanfly's Core Engine set to Off: Everything seems to work perfectly fine!

With Yanfly's Core Engine set to On: It varies depending on the speed of the character...

Speed 1: the animation seems to works correctly, but will sometimes make the character shake, as if it were trembling.Speed 2 and 3: the animation is often stable but sometimes the walking cycle will be broken (as if it were using less than 8 frames of the animation maybe?). Most of the time, when I have my character stop and change direction, the walking cycle will reset to its correct pattern. At these speeds, the sprite often seems to tremble, like with Speed 1.Speed 4 and 5: There's no more trembling, but there are still frame issues in the walking cycle here and now (like Speed 2 and 3).Speed 6: Everything looks good!Speed 7 (Speed 6 + Dashing): Very hard to say… it looks like the game only reads like 3 frames and then repeat them ultra quickly, it's too quick to say what's happening, but it's definitely wrong.

At any rate, I thank you to have checked this out. I don't know if you want to investigate further or not, but if so, I could make you a video so you could get a better idea.

Edit: I think the error I seldom see with the animation is that the idle frame will sometimes be swapped with another frame, and that the idle frame will end up being within the walking cycle. Then, when the character stops for a moment and begins walking in another direction, the idle frame will be correctly replaced outside the cycle.

I would like to resolve the issue, but I am still having a lot of trouble reproducing the error. Thanks for offering to make a video, but it wouldn't help much unless I could print what was happening on the console.

I've been looking at Yanfly Core, and it is hard to see what could be causing the error apart from a possibility that it might prematurely reset the pattern occasionally by fiddling with the stop count. To help me diagnose the problem, try commenting out the following lines at 1066-1084 of Yanfly Core and see if you still get the error:

It's not a great patch though, since it might re-break whatever it was that Yanfly had fixed. However, I've reviewed the code and I don't believe that there will be any problems.

Anyway, it's not a good idea to directly modify another plugin. I've made the compatibility patch a separate plugin: http://pastebin.com/W7yxdrCk. You can reverse the changes to the Core Engine plugin that I instructed you to make and add this compatibility patch to your plugin list instead. You have to put it immediately below Yanfly Core Engine in the plugin list.

I'm grateful for this thanks, was using Galv's diagonal, idle and extra frames plugins for the playable character but couldn't find a plugin for my event frames until this. It works if I put it before the Galv ones.