Animated Faces (MZ Version)

Animated Faces
v1.3
​
Click here for the MV Version: [MV]Animated Faces 1.3

About:
Started out as the Standalone version of the TTKMessagePlus (Fogomax) plugin's animated face feature. Now converted over to MZ for the plugin commands. Possibly future updates (if any requests pop up).

Update (v1.3):
* Fixed (again!) v1.3 - Previous update broke some animations, and apparently the random delay between animations was read in a string format... so it was not getting the correct min-max values. That too has been fixed.

* Fixed (hopefully?) by stopping animations if a wait/pause text code is used.

* Added in a check during Scene_Battle, so should now animate faces in battle as well.

Can acquire by re-downloading here, or by getting it at github:
Animated Faces MZ v1.3

Instructions:
You will need to create an animated face set first (duh). The prefix can be whatever you choose in the plugin parameters, but by default it's "anim_".
- Top row = Idle animations (no text is moving)
- Bottom row = Speaking animations (text is moving)
Spoiler: Example

Next, place the plugin in your project's plugin folder (\js\plugins\..).
Finally, go into the plugin manager and add it there.

Usage:
By default, the plugin (with the above example) will be "Plun n' play", but you can alter the settings, or even use a plugin command to change them on the fly!

Terms of Use:
Can be used in non-commercial and commercial games with credit to LordValinar and Fogomax (for original works).
Do NOT remove the author from the plugin
Do NOT post the plugin (modified or otherwise) anywhere else besides these forums (RPG maker web).
I don't know if this will be responded to but I'm quite new to RPG maker.

Whenever i try to see if the text works it breaks and this is the error:

rmmz_managers.js:2030 TypeError: Cannot read property 'length' of undefined
at Game_Message.animatedFace (Animated Faces.js:228)
at Scene_Map.update (Animated Faces.js:239)
at Function.SceneManager.updateScene (rmmz_managers.js:2097)
at Function.SceneManager.updateMain (rmmz_managers.js:2057)
at Function.SceneManager.update (rmmz_managers.js:1938)
at Function.Graphics._onTick (rmmz_core.js:800)
at TickerListener.emit (pixi.js:9474)
at Ticker.update (pixi.js:9928)
at Ticker._tick (pixi.js:9679)
Just replying for public eye, even though you fixed it - changing a plugin name is generally not a good idea. Since if its named "LvMZ_AnimatedFaces.js" and its trying to gather plugin parameters from "Animaged Faces.js" it's not goinna work 😉
When testing escape characters that pause the text, like \!, \. or \|, the face remains animated. Would be nice to "pause" the talking animation when these are used.

I'm experiencing the same issue with the escape character \! that pause the text and wait for the player. The face remains animated.

I am using the latest version of the plugin (v1.3) with RPG Maker MZ (Corescript v1.4.4).
Hey all, I've been messing with this plugin and it's nearly perfect for what I've been working on.

However, I noticed that the character image will disappear when new text boxes load sometimes. Just for a frame or two. It only happens when the box has been up for a second. Less likely to occur if you're just spamming through the dialog.

Portrait totally flickers out of existence then comes back. Only seems to happen when loading the next messages from the same character. It's very distracting. There are no blank frames in the animation I have setup so I don't know what's causing it.

Any ideas?
That is a good idea actually. I'll see if I can get it in there and working 🙂 I'm not really good with escape characters, however, I think I am confident enough to figure it out ^_^
hello! i don't know if you are still active, i'm trying to make a game with your plugin and i would like to know if this feature is applicable

there are a lot of scenes in the game that i am working on where the character thinks and it would be helpful if there was a way to temporarily remove the talking animation

thank you!
Hi @lordvalinar !
Is there any chance a function that allows you to change time between single frames may be implemented?
Like, let's say the current plugin waits for 0.2 seconds until the next face animation appears (open mouth), and another 0.2 seconds until next one (fully open mouth). Could it be changed to 0.5, 0.8 seconds, etc.?
Hey all, I've been messing with this plugin and it's nearly perfect for what I've been working on.

However, I noticed that the character image will disappear when new text boxes load sometimes. Just for a frame or two. It only happens when the box has been up for a second. Less likely to occur if you're just spamming through the dialog.

Portrait totally flickers out of existence then comes back. Only seems to happen when loading the next messages from the same character. It's very distracting. There are no blank frames in the animation I have setup so I don't know what's causing it.

Any ideas?
I think I might have one. I was having this problem (or more accurately the faces weren't being loaded at all) on a character creator plugin I was working on, and what fixed that issue was a load listener. So try amending drawMessageFace() with the following: (and you don't need the comments - just included for notes)

JavaScript:
// Alias - Animated faces update index by frame
const windowMsg_drawMsgFace = Window_Message.prototype.drawMessageFace;
Window_Message.prototype.drawMessageFace = function() {
    // moved here for the bitmap variable
    const faceName = $gameMessage.faceName();
    if ($gameMessage.animatedFace()) {
        $gameMessage.setFaceImage(faceName, this._afIndex);
    }
    // load bitmap for loadListener
    const bitmap = ImageManager.loadFace(faceName);
    bitmap.addLoadListener(() => {
        // once loaded, then draw
        windowMsg_drawMsgFace.call(this);
    };
};

-- @Rinober
Well I'm not really modifying this anymore, but in updateFaceAnimation() line 317 from my current copy at least (the "if (this._afTick >= 6)" is what determines that, but to make it so it's different timing would involving editing more of the code, and that's outside the scope of my intentions. I was just trying to convert Fogomax's original plugin (which had more to it, but I just wanted the animated faces, so made it a stand alone). Sorry

--
Alright I guess I can take another look at the script and maybe try to fix things or add new features. I've kind of taken a break from the coding scene for awhile but I'll take see what I can do later in the week. Will see about the "wait" escape characters and a function or something for @Rinober 's request as well 😉
HYYYYYPE!
I came here with a similar issue to the above (flickering avatars when a new textbox appears), and tried pasting lordvalinar's code over the similar-looking code in the js, but when I try various versions of it my program won't load and says there's an issue with a missing ')' (after argument list) or when I try to fix that by randomly adding a a closing bracket, it has a problem with an unexpected ')'.

(Basically it all goes wrong after the '=>'. I'd appreciate any help, as the flickering when loading these images spoils an otherwise wonderful plugin.
@Cow_Children As a general rule, you need to provide actual details when you need help with errors. That is, press F8 and go to the Console tab and post a screenshot.

However, in this case it's pretty easy to find.

On the second to last line, there's a missing close parenthesis, it should read
Code:
    });
Many thanks for the timely reply. That solved the missing token issue, but now all animated faces are wholly invisible. (Regular faces show fine, but animated ones with names like anim_rann_sure.png don't show at all).

Spoiler: Screenshot from game showing lack of face
oof!.png

(As above, there's now a blank square where the face presumably ought to be).

And the code I'm now using (the code from post #47 with your added parenthesis from post #50) is:
Spoiler: code hidden in case it's inaccurate and confuses future visitors to the thread
// Alias - Animated faces update index by frame
const windowMsg_drawMsgFace = Window_Message.prototype.drawMessageFace;
Window_Message.prototype.drawMessageFace = function() {
// moved here for the bitmap variable
const faceName = $gameMessage.faceName();
if ($gameMessage.animatedFace()) {
$gameMessage.setFaceImage(faceName, this._afIndex);
}
// load bitmap for loadListener
const bitmap = ImageManager.loadFace(faceName);
bitmap.addLoadListener(() => {
// once loaded, then draw
windowMsg_drawMsgFace.call(this);
});
};

For reference, I've pasted that over the // Alias - Animated faces update index by frame paragraph from https://github.com/DarkArchon85/RMMZ-Plugins/blob/master/LvMZ_AnimatedFaces.js
I'm still having trouble with this excellent plugin. Using the raw code I have the dropped frames between one text box and the next, but adding the code you suggested in post #47 the faces are completely invisible, just an empty box.

I tried this in my ongoing project, and also in a brand new project (to see if another plugin was interfering) but I get the same problem.
Hey, this is a pretty amazing plugin and works splendidly in my project. I was just curious — would it be possible somehow to have the idle animation run in the equip and skills scenes (or other ones menu scenes that show the character's face)?
I'm still having difficulty knowing where to paste lordvalinar's code from post 47 into the original code. (I tried a few ways and places, but it always made the images entirely invisible). Has anyone managed to assemble a full version of the code (or update the downloadable plugin) which works without the image blinking out between textboxes?

This plugin remains one of the best things in the game I'm making, but its flickering is irksome. (I would appreciate any help from the beneficent valinar, because I suspect I'm making a simple mistake here).
Hello! I am a HUGE fan of this plugin! Unfortunately for me, I discovered it pretty late in development. Changing the Prefix in the menu to nothing seems to work with all my face sprites, but causes a weird glitch when there is no face sprite that erases the text at the start of the message. Does anyone have a fix to this? Or am I doomed to change every single face sprite to one with a prefix at the start?
Version 1.4 updated and uploaded (file on this thread, or on github). Can now customize how many frames per animation (default = 6 frames), and added a Load Listener which should now properly load up the face images ... (it worked while testing my CharGen and Loot Menu plugins - still works in progress - so should also work here).
Could you do this with custom artwork as well?

Original thread: https://forums.rpgmakerweb.com/threads/animated-faces-mz-version.125776/