Animated Faces (Standalone)

Animated Faces
Version 1.4
​

Credit Where Credit Is Due:
First I would like to thank Fogomax for their TTKMessagePlus plugin. It was the huge inspiration (and some modifications of), into its own separate and new plugin!

Tell Me About The Plugin:
One of the problems (and requests) was for animated faces without the extra features that were incompatible with other plugins (ie. YEP_MessageCore). So this fixes that by being a stand-alone plugin that alias's features (if you don't know what that means, it's okay.. it "Goes around stuff" 😉 )

How To Install:
Create a face set with the required prefix (By default, this is anim_ however, you can change that in the plugin parameters), followed by whatever naming scheme you desire. Example: anim_Hero.png (see image for example)
Spoiler: anim_Hero.png
anim_Hero.png

Then add it into your Faces folder, and this plugin into your plugin manager, and then you are technically ready to rock and roll!

Changing Settings:
If you want to change how many Idle (top row) frames or Speaking (bottom row) frames are the "maximum", then you can either change their settings in the plugin parameters, or use a plugin command or script call to change them (check the plugin's help file).
* Note: Changes are persistent, until you tell them otherwise - And they will not conflict with normal|default faces

Changelog:
Hasn't been released long and I've already noticed a few problems. Here are the recent changes:
* v1.4 - Hotfix (added to battle scene - since MZ version had it)
* v1.3 - Synched up with MZ version (delay of frames was not right)
* v1.2 - Fixed a problem where speaking frames cap out at Idle frames
* v1.1 - Added a 'stop' to the animation if there is a wait (\. \| codes)

Terms of Use:
Free for use in both non-commercial and commercial, with credit (LordValinar and Fogomax)
Do NOT remove the author name
Do NOT re-upload anywhere except on these forums (modified or otherwise)
This is great thank you so much for doing it :uswt:
I want idle animation play if there is a wait "\|". What should I change in the code?
Is there a way to make the animations faster?
Is there a way to make the animations faster?
EDIT: I have noticed there is a problem in the delay formula (which was a problem in the MZ version as well where they were not converted into proper integers. Which means the delay is wrong. I will fix this immediately and re-upload a fixed version)

How do you mean "Faster"? If you want more frames into the animation itself -> You'll need more faces (There is no horizontal limit, so it's not limited to the 4x2 grid). However, if you mean the delay in between each animation? That is in the settings (plugin manager) or plugin commands.
I mean like the delay between each frame, animation rate. Like if you have a character shouting or talking fast.
Amazing plugin btw! Just what I needed.
I mean like the delay between each frame, animation rate. Like if you have a character shouting or talking fast.
I've updated it to fix delay issues (if anyone was experiencing those... I know it was apparent in MZ version), as for your question, I think that would have to be edited in the updateFaceAnimation() function where:
JavaScript:
if (this._afTick >= 6)

Would need to change the 6 to something shorter.
Sick it works, thanks!
It also affects blinking animations but that's okay.
Hey! Great plugin! Thanks for making this 🙂 I was desperately in need of a plugin like this!
Quick question, how can I remove the ping-pong type of animation?
I need the animation to start on frame 0 when it reaches the max frame, instead of going back like it does now.

EDIT: I did it. Just replace lines 216 and 217 with this:

this._animFaceIndex = 0;
if (this._animFaceIndex >= 0) {
Curious, does this work in battle? It works like a charm in the overworld but it doesn't seem to work in Battle with text boxes. I'm in MV.
Curious, does this work in battle? It works like a charm in the overworld but it doesn't seem to work in Battle with text boxes. I'm in MV.
EDIT: I apologize.. it appears I did not update the MV version for that. I'll try to amend it and get it re-uploaded asap

I think battle has its own method of handling messages (I think I remember something like that before "Scene_Battle.prototype.update" or something like that) - which was modified in the script so theoretically it SHOULD work in battle; although I have not tested this.
Ay no problemo man, thank you so much!
apologies for replying to such an old thread, however
is there any way to make this work within menus?
apologies for replying to such an old thread, however
is there any way to make this work within menus?

I mean technically yes, but that would be out of the scope of this plugin which was just made for messages. I could add it to my long list of "ToDo" plugins but no guarantee when I'll get to it, and not to mention I haven't been working on MV plugins anymore ( but thankfully aren't -that- different for MZ ).

Currently working on a custom tailored Grid-based Tactical Battle System for my game, and this will take awhile... If anyone else wants to give it a try, they're welcome to (just follow TOS on the plugin); I'd recommend looking at the "rpg_scenes.js" and "rpg_windows.js" scripts and find the necessary sections for the menu (might also have to change Window_Base in this plugin so it's not just $gameMessage checking for the animated status).
Do you know how I might alter this so that the "speak" animation just plays once and then goes to the idle?
Do you know how I might alter this so that the "speak" animation just plays once and then goes to the idle?
You would have to change the updateFaceAnimation() function around this part:

JavaScript:
if (this._animFaceIndex <= 0) {
    this._animFaceSide = 'left';
    if (this._afDelay[1] > 0 && (this._textState == null || this._afSpeakY < 0)) {
        // the old code (to change)
        var min = Math.ceil(this._afDelay[0]);
        var max = Math.floor(this._afDelay[1]);
        this._animFaceWait =  ~~(Math.random() * (max - min + 1) + min);
    }
}

Replacing the min/max and wait variable to changing the face image to a static one (without the "anim_" prefix). So something like this for example:

JavaScript:
if (this._animFaceIndex <= 0) {
    this._animFaceSide = 'left';
    if (this._afDelay[1] > 0 && (this._textState == null || this._afSpeakY < 0)) {
        // the new code (faceName, faceIndex)
        $gameMessage.setFaceImage("Actor1", 0);
    }
}

This is because as long as their is an animated version of the face set, it's going to keep looping while text is being written out. However, if the animation plays from left to right -> then right to left. When the loop is done, it'll change to a static/non animated face set, and will no longer play even while text is writing.

Of course you'll probably want some way to load in the proper face set and index (Game Variables can help with that, storing the name and index in which case use this code (and example of when you'd use this, is setting the variables right before the Show Message):
JavaScript:
if (this._animFaceIndex <= 0) {
    this._animFaceSide = 'left';
    if (this._afDelay[1] > 0 && (this._textState == null || this._afSpeakY < 0)) {
        // with variables (replace varID## with the actual variable ID number)
        const name = $gameVariables.value(varID01);
        const index = Number($gameVariables.value(varID02));
        $gameMessage.setFaceImage(name, index);
    }
}

Original thread: https://forums.rpgmakerweb.com/threads/animated-faces-standalone.125307/