Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hey, im using a custom image as actor portrait and im wondering if you can make the notetag which defines the image conditional somehow. Essentially i want the custom portrait to change to another picture depending on which armor im wearing. Is this possible somehow?

(1 edit)

Yes, this is possible. I suggest using a small plugin for this purpose.

Create a plugin with any name and put it below mine. Paste this:

/*:
 * @target MZ
 */
(function() {
const _menuPortrait = Game_Actor.prototype.menuPortrait;
Game_Actor.prototype.menuPortrait = function() {
    
    if (this.name() == 'Reid' && this.isEquipped($dataArmors[1])) {
        return 'Reid_LiteArmor';
    }
    if (this.name() == 'Reid' && this.isEquipped($dataArmors[2])) {
        return 'Reid_HeavyArmor';
    }
    // use default portrait
    return _menuPortrait.call(this);
}
})();
(1 edit)

I appreciate the help but i am uncertain i can manage creating a plugin. Is the text you provided supposed to be pasted in the plugin or the notes, if in the plugin, do any changes need to be made to the notetag? 

I also assume certain parts sould be replaced with the names i use in my game (such as reid_heavyarmor which i assume needs to be replaced with the name of the picture i want). Are there any other parts which need to be replaced?

Sorry if these are obvious questions, im fairly new to this.

For this use-case, you want to create a new plugin, that stands just next to mine. That means:

  1. Create a new file in your game/js/plugins and call it, e.g., "CustomMenuPortraits.js" (the name doesn't matter as long as it's ending on "js")
  2. Paste the code from my last reply
  3. Yes exactly, you need to adjust the names, and also the numbers inside the $dataArmor brackets.
  4. If none of your "rules" apply, then my plugin's original functionality comes into play (i.e. the notetag <menu portrait: file> is used)
  5. In RPG Maker -> Plugin Manager, include your new custom plugin and put it below the menu customizer

This is just a sample code that I offered to you. Notetags just aren't flexible enough; if I were to make a feature that chooses a different picture just for equip, then the next person would request it just for weapons, or states, or any other situation. However, custom code provides you with much more freedom.

Thanks, i really appreciate the help. I completely understand why you wouldnt add it, i just have so little knowledge of plugins that i didnt know if the functionality was already in there but i didnt know how to use it. 

I think ill figure it out with these instructions, now that i see it step by step it doesnt seem too bad.