Animated mugshots?

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
Hello, I just spent some time searching the master plugin list and google for an animated mugshot plugin.
I'm looking for something that can auto run a currently displayed mugshot sheet in conversation cycling through 8 of it's faces when text is displaying, but upon when the message has ended it stops at face 1 of the sheet used.

Given the simplicity of this idea- I could change the expressions and mouth movements within the single sheet used to represent one character.
I have seen a few plugins that use busts and or animated blinks on message commands within the sheet but they are specifically commanded within the message when to operate rather than just simply running through an animation passively.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,757
Reaction score
12,199
First Language
English
Primarily Uses
RMMV
Sounds easy enough. Should this happen with ALL dialogues, or only specific ones? ie - are you going to set up 8 frames of animation for every single character in your game who speaks?
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
I feel the easiest way by default to have them work for ALL dialogues.

The ability to configure parameters on how many frames you want cycling on a sheet and speed would be a nice option.
Alternatively you could always just copy and paste the same frames to eliminate animation on particular instances or some kind of function like a plugin command or script call to cease animations of the plugin temporarily. Whichever seems easier to set up.

I certainly feel this would add more life to a game and to those who don't want to bother with bust plugins.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,757
Reaction score
12,199
First Language
English
Primarily Uses
RMMV
Are you using any message plugins?
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
The only message plugins I am currently using are:
Yanfly's Message core
Yanfly's Messagemacros
Yanfly's Mespack1 (which is used for letter sound effects)

Also that reminds me since I mentioned mespack1- will there be an option to have animations cease once the dialogue finishes? Say restores on mugshot#1 of the sheet currently in use?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,757
Reaction score
12,199
First Language
English
Primarily Uses
RMMV
I'm not really familiar with Yanfly's plugins, and I don't have them. I know the message core is free, not sure on the others.

I wouldn't get started tonight so if someone else hasn't done this within the next 24 hours or so, I'll look at it for you. And yes, I'd make it so you can go back to a specific frame when the text is all displayed.




Edit: Okay, here you go.

Note, I've added Yanfly's message plugins but haven't really tested thoroughly with them. This should work okay as long as you don't do any face stuff with Yanfly's plugins. I'm also not sure how it'll go if you do a multi-page message or use Yanfly's plugins to change the message box height to include more lines.

See how it goes, let me know if you find any issues.

Save as Shaz_AnimatedMugshots.js

Code:
/*:
 * @plugindesc Animated Mugshots
 * @author Shaz
 *
 * @param defaultStartFrame
 * @desc Frame to start on by default (top left is 1)
 * @default 1
 *
 * @param defaultEndFrame
 * @desc Frame to end on by default (bottom right is 8)
 * @default 8
 *
 * @param defaultSpeed
 * @desc Frame speed (number of characters before changing frame)
 * @default 5
 *
 * @help
 *
 * This plugin allows a message box to animate a face image by specifying
 * a starting and ending frame, and an animation speed.
 *
 * When the text has been displayed, the face will revert to the first
 * frame.
 *
 * Starting and ending frame, and animation speed, revert to the defaults
 * after each message, so use a plugin command to override the defaults
 * with each Show Text command if necessary.
 *
 *
 * Plugin Command:
 *   SetFaceAnim startFrame endFrame             
 *      : sets starting and ending frame and uses default speed
 *   SetFaceAnim startFrame endFrame animSpeed   
 *      : sets starting and ending frame and animation speed
 */

(function() {
    function toNumber(str, def) {
        return isNaN(str) ? def : +(str || def);
    }

    var parameters = PluginManager.parameters('Shaz_AnimatedMugshots');
    var defaultFaceStartFrame = toNumber(parameters['defaultStartFrame'], 1) - 1;
    var defaultFaceEndFrame = toNumber(parameters['defaultEndFrame'], 8) - 1;
    var defaultFaceAnimSpeed = toNumber(parameters['defaultSpeed'], 5);
    var finishAnim = parameters['finishAnim'].toLowerCase() === 'true';

    var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        switch (command.toLowerCase()) {
            case 'setfaceanim':
                $gameMessage.setFaceStartFrame(Number(args[0]) - 1);
                $gameMessage.setFaceEndFrame(Number(args[1]) - 1);
                $gameMessage.setFaceAnimSpeed(Number(args[2] || defaultFaceAnimSpeed));
                break;
            default:
                _Game_Interpreter_pluginCommand.call(this, command, args);
                break;
        }
    };

    var _Game_Message_clear = Game_Message.prototype.clear;
    Game_Message.prototype.clear = function() {
        _Game_Message_clear.call(this);
        this._faceStartFrame = defaultFaceStartFrame;
        this._faceEndFrame = defaultFaceEndFrame;
        this._faceAnimSpeed = defaultFaceAnimSpeed;
    };

    Game_Message.prototype.setFaceStartFrame = function(startFrame) {
        this._faceStartFrame = startFrame;
    };

    Game_Message.prototype.setFaceEndFrame = function(endFrame) {
        this._faceEndFrame = endFrame;
    };

    Game_Message.prototype.setFaceAnimSpeed = function(animSpeed) {
        this._faceAnimSpeed = animSpeed;
    };

    Game_Message.prototype.faceStartFrame = function() {
        return this._faceStartFrame;
    };

    Game_Message.prototype.faceEndFrame = function() {
        return this._faceEndFrame;
    };

    Game_Message.prototype.faceAnimSpeed = function() {
        return this._faceAnimSpeed;
    };


    var _Window_Message_clearFlags = Window_Message.prototype.clearFlags;
    Window_Message.prototype.clearFlags = function() {
        _Window_Message_clearFlags.call(this);
        this._faceFrame = $gameMessage.faceStartFrame();
        this._faceFrameWait = 0;
    };

    var _Window_Message_terminateMessage = Window_Message.prototype.terminateMessage;
    Window_Message.prototype.terminateMessage = function() {
        ImageManager.releaseReservation(this._imageReservationId);
        _Window_Message_terminateMessage.call(this);
    };

    var _Window_Message_onEndOfText = Window_Message.prototype.onEndOfText;
    Window_Message.prototype.onEndOfText = function() {
        if ($gameMessage.faceName() !== "" && this._faceFrame > $gameMessage.faceStartFrame()) {
            this._faceFrame = $gameMessage.faceStartFrame();
            this.drawMessageFace();
        }
        _Window_Message_onEndOfText.call(this);
    };

    var _Window_Message_processNormalCharacter = Window_Base.prototype.processNormalCharacter;
    Window_Message.prototype.processNormalCharacter = function(textState) {
            if ($gameMessage.faceName() !== "" && (textState || this._faceFrame > $gameMessage.faceStartFrame())) {
                if (this._faceFrameWait > $gameMessage.faceAnimSpeed()) {
                    this._faceFrame += 1;
                    if (this._faceFrame > $gameMessage.faceEndFrame()) {
                        this._faceFrame = $gameMessage.faceStartFrame();
                    }
                    this.drawMessageFace();
                    this._faceFrameWait = 0;
                }
                this._faceFrameWait += 1;
            }
        if (textState) {
            _Window_Message_processNormalCharacter.call(this, textState);
        }
    };

    Window_Message.prototype.drawMessageFace = function() {
        this.contents.clearRect(0, 0, Window_Base._faceWidth,  Window_Base._faceHeight);
        this.drawFace($gameMessage.faceName(), this._faceFrame, 0, 0);
    };

})();
 
Last edited:

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
Got your message so I've just been throwing a few test attempts and unfortunately I'm not seeing anything working as intended.

To break down what I did:

  1. Copied and pasted the code in a js filetype with notepad+
  2. Placed in the js/plugin folder of the project and added the plugin on top of the list.
  3. Ran a test- no compatiability issues- no crashes etc, but no results of animating faces.
  4. disabled all plugins aside from the animated mugshots- no results.
  5. Made a new project fresh of all plugins and ran it through a test- same results, no crashes or bug reports still however which is good.
  6. Altered the parameters in terms of speed, used plugin commands to modify how animation handles- nothing
  7. I restarted my computer (sometimes plugins start working properly when the entire PC is reset for some reason) No results.
I'm out of options on how else to run the tests, I even triple checked the js to make sure all the code was transferred properly but something is missing on my end.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,757
Reaction score
12,199
First Language
English
Primarily Uses
RMMV
I'm sorry I missed this post - if you need my attention you might be best to tag me as that'll make sure I get a notification.

If it seems as if the plugin just isn't there at all, it could be due to a few really easy mistakes ...

Did you give it the right name? It should be Shaz_AnimatedMugshots.js - though if it's working and you gave it the wrong name, it should just take the default values.
Is the plugin enabled in the plugin manager?
Where is it in your list of plugins? Try putting it right at the bottom and see if it makes a difference.
When you play, hit F8 to open the developer tools, and go to the Console tab. Are there any error messages there for this plugin or for any others?

If none of those help, try creating a brand new project (or use the one you sent me) and add the plugin to it, along with the image you gave me. See if that works. If it does, there may be an incompatibility with another plugin, so it'll be a matter of figuring out which one(s) it's not liking.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
I'm in the process of creating a test version for you but I'll have to do it tomorrow, so far my day hasn't been good. My PC is having difficulty booting up, probably shoddy windows 10 update as it's been messing my cintiq/wacom configurations aswell, everything is running extremely slow so i'm making hard backups
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
Sorry to double post: It's been a hectic last 30 odd hours, I've been moving gigs of data around.
Just to clear things up, I've made extra sure that the plugin is working with the correct name as the parameters are there for me to work on but the result is the same.

I have sent you an email containing a cut down version of the project with the plugins as they are and some events next to the starting position to interact with, there are few rooms to navigate but it should provide you with all the testing you need for the dialogue and any in game problems that might arise.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
Just quickly, I can't remember but the event near the club that has the same character sprite as the player should be using the animated mugshot.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,757
Reaction score
12,199
First Language
English
Primarily Uses
RMMV
Sorry for the delay.

Can you please find this line (I think it's about line 69) and delete it?
Code:
var finishAnim = parameters['finishAnim'].toLowerCase() === 'true';
I was intending to have something else in there, but I couldn't get it to work, and forgot to remove the line. The above causes an error in the console window when I load the game. But with the line removed, the faces animate correctly.

So give that a go, and let me know if you still have issues.

I will note that your game was not playable for me on my machine (which is only about 3 years old). I couldn't move with the keys at all, and I had to click numerous times to move with the mouse. Turning the lighting plugins off solved the problem. I sure hope your intended players have souped up computers :D
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
I took that line out of the plugin and it's working beautifully!
Now that I know it's working properly I got to make a mission to start making all relevant mugshots have an animation frames, thank you so much for helping me with this issue.

I'm not sure exactly what specifications you need as of yet to run this game smoothly, I do remember showing a friend on his laptop and it was laggy as. As of now my current graphics card is a gtx 1070 and I got a decent processor etc, so I would say you may need something a bit high end to run all the visuals I have going in it.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,757
Reaction score
12,199
First Language
English
Primarily Uses
RMMV
I'd say so. I know the lighting plugins require a bit of grunt, and you have a fair few plugins - not sure if any/many of the others will be as CPU heavy.

Glad you got it working :)
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
Yeah It was a tough decision though because origionally I was using terrax's light plugin but it was giving me alot of fps issues I had to make the harsh decision but reworking the whole project into yanfly's one soley because it performed smoother, it's kinda sad to be honest because i figured any PC in this day and age could handle anything MV spat out.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,757
Reaction score
12,199
First Language
English
Primarily Uses
RMMV
Are you saying you did this after I posted yesterday, or before? Because the version you gave me has the Tarrax one.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,104
Reaction score
228
First Language
English
Primarily Uses
N/A
Oh no years ago when this project was in it's earliest beta stages I had the terrax lighting plugin in use well before yanfly's came along.

Years ago you did actually receive an earlier project to help me with a plugin issue maybe you opened the wrong project? I'm not sure.
If you check the monsters tab and it has Banished Enforcers and Cops etc that will be the most recent version.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Profile Posts

so, ive been gone for too long when i log in and see that everything is where is shouldn't be. XD
Steam killing my eyes.. I forgot why I use it only when I have no other choice
Making a map, my brain went "Look, Mjölnir!" as I plotted out a sacrificial entrance.

Actually, it went, "Look, hammer. Wait, Thor's hammer!"
CG tile rendering, take 3: windows.
which section you guys think looks more accurate to the perspective? left or right?

for reference, this is what it looks like "at street level"
Okay, Animal Crossing is remarkably addictive and exceptionally calming. I've been playing it pretty exclusively... like... 6 hours a day. Been a while since I've been this engrossed.

Forum statistics

Threads
95,402
Messages
928,920
Members
125,620
Latest member
Marlin
Top