Showing/hiding facesets during game

KRash92

Villager
Member
Joined
Jun 5, 2020
Messages
5
Reaction score
0
First Language
French
Primarily Uses
RMMV
Hello everyone!

This is my first post on this forum, so I hope I'm not breaking any rules!

So my question is quite simple: would there be any options/plugins/else that would allow the player to hide or show facesets during the game? It would be activated by pressing a button, or talking to an NPC, whatever works^^

I want to let players decide if they want to see the facesets during conversations, or if they just want to leave the sprite's actual facial features to their imagination.

Thank you!
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,864
Reaction score
614
First Language
Dutch
Primarily Uses
RMMV
there is a easy way though to make a conditional branch:

if: facesets = ON (face switch)
text with faces

else

text without faces.
end

so when the switch is ON, it shows the faces, else, when the switch is off,
it doesn't show (this is basicly copy paste the same text but remove the faces)
 

KRash92

Villager
Member
Joined
Jun 5, 2020
Messages
5
Reaction score
0
First Language
French
Primarily Uses
RMMV
there is a easy way though to make a conditional branch:

.....
Thanks a lot for the answer!
I can't test it right now, but I'll do it right away when I can. I'll get back to you with the results : )

Edit: I just realized, if I understood it correctly, you'd need to copy the same text twice, one for if the switch is on, another if the switch is off, right? And for every dialogue including facesets. That sounds a bit tedious^^ I'll keep your answer in mind, and see if there isn't a way to make it a bit easier.
 
Last edited:

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,864
Reaction score
614
First Language
Dutch
Primarily Uses
RMMV
Now that I think of it, its one way, but its more complicated for else brances,
there might be an easier way, but that with a scriptcall, to disable/enable facesets.

else a plugin is required for the smoother way which might be better option.

you also have it on the wrong section (will be corrected).
report your post to move to JS request, because I think you have better luck on that part.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
178
Reaction score
81
First Language
English
Primarily Uses
RMMV
This seemed like a nice easy exercise, since I needed to figure out how to add options to the options menu anyway... so here you go!

JavaScript:
/*:
@plugindesc Add an option to show or hide NPC faces in messages
@author Solar Flare Games

@param optionText
@text Option Menu Text
@desc Text to show in the options menu.
@type text
@default Show NPC Faces

@help

This adds an option to hide NPC faces from message dialogs.

Note Tags
=========

<facealways> (event comments)
  If you place this code in a comment in your event, the next message will
  ignore the setting and always show a face graphic (assuming it has one).

*/

Utils.paramGetter = function(plugin, param, def) {
    return {
        get: function() {
            var params = PluginManager.parameters(plugin);
            if(params[param] === undefined) return def;
            return params[param];
        },
        configurable: true,
    };
};

(function() {
    Object.defineProperty(TextManager, 'optionShowFaces', Utils.paramGetter('SFG_OptionalFaces', 'optionText', 'Show NPC Faces'));
   
    const old_addOptions = Window_Options.prototype.addGeneralOptions;
    Window_Options.prototype.addGeneralOptions = function() {
        old_addOptions.call(this);
        this.addCommand(TextManager.optionShowFaces, 'showFaces');
    };
   
    const old_message = Game_Interpreter.prototype.command101;
    Game_Interpreter.prototype.command101 = function() {
        const result = old_message.call(this);
        const alwaysShowFace = Array.isArray(this._comments) && this._comments.some(cmt => cmt.toLowerCase().includes("<facealways>"));
        if(!ConfigManager.showFaces && !alwaysShowFace) {
            $gameMessage.setFaceImage("", 0);
        }
        this._comments = [];
        return result;
    };
   
    const old_cfgLoad = ConfigManager.applyData;
    ConfigManager.applyData = function(cfg) {
        old_cfgLoad.call(this, cfg);
        if(cfg.showFaces === undefined) this.showFaces = true;
        else this.showFaces = cfg.showFaces;
    };
   
    const old_cfgSave = ConfigManager.makeData;
    ConfigManager.makeData = function() {
        var cfg = old_cfgSave.call(this);
        if(this.showFaces === undefined) cfg.showFaces = true;
        else cfg.showFaces = this.showFaces;
        return cfg;
    };
})();

Terms:

  • Usable in commercial or non-commercial games.
  • No need to give credit, as this literally took about 10-20 minutes to make.
  • Did I miss something that I should put here?

I didn't test it in a blank project, so a slight chance exists that it depends on something I forgot to include; if that's the case it should be an easy fix.
 

KRash92

Villager
Member
Joined
Jun 5, 2020
Messages
5
Reaction score
0
First Language
French
Primarily Uses
RMMV
This seemed like a nice easy exercise, since I needed to figure out how to add options to the options menu anyway... so here you go!
Thanks a lot!
I'm sorry to add more work to your work, but could you please tell me how to make this work, as I'm quite the noobie when it comes to code and plugins? Do I need to turn this into a javascript file then add it to the game as a plugin, then simply switch it on to make it work? Or should I do something else?

Once again, sorry. And thank you!
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
178
Reaction score
81
First Language
English
Primarily Uses
RMMV
Yes, just create a file called SFG_OptionalFaces.js, paste that code into it, drop it in your plugins folder, and enable it in the Plugin NManager.
 

KRash92

Villager
Member
Joined
Jun 5, 2020
Messages
5
Reaction score
0
First Language
French
Primarily Uses
RMMV
Yes, just create a file called SFG_OptionalFaces.js, paste that code into it, drop it in your plugins folder, and enable it in the Plugin NManager.
Thanks again. I'll test it and get back to you : )
 

KRash92

Villager
Member
Joined
Jun 5, 2020
Messages
5
Reaction score
0
First Language
French
Primarily Uses
RMMV

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

Latest Threads

Latest Posts

Latest Profile Posts


:3c here's a thing i made a while while while back
Tried mochi for the first time. It's quite nice. Has a pleasant smell and taste, and is nice and chewy.
made a bio for the protag in my project!
Beggar : "I haven't eat for days..."
Kid : "Just do crime! You will get daily necessity for free in prison~"

Forum statistics

Threads
99,159
Messages
962,454
Members
130,725
Latest member
teendinsaikha
Top