Yanfly Status Menu Core - Adding a Parameter

Hello all,

Link to Plugin: http://www.yanfly.moe/wiki/Status_Menu_Core_(YEP)

I am looking to add Critical Hit Multiplier to the status menu, but I am unsure how to call that. Note that I DO NOT mean the critical hit rate.

I am able to make the words "Critical Hit Multiplier" appear in the menu, but I'm unsure how to generate the actual number. Below is a snippit from the plugin. What I'm looking for would replace the "???"
Code:
    case 'fdr':
      this.drawAttributeName(Yanfly.Param.StatusAttr_fdr, dx, dy, dw);
      this.drawAttributeRate(actor.fdr, dx, dy, dw);
      break;
    case 'exr':
      this.drawAttributeName(Yanfly.Param.StatusAttr_exr, dx, dy, dw);
      this.drawAttributeRate(actor.exr, dx, dy, dw);
      break;
    case 'chm':
      this.drawAttributeName('Critical Hit Multiplier', dx, dy, dw);
      this.drawAttributeRate(???, dx, dy, dw);
      break;
    default:
      break;
    }
};

Any other info needed, please let me know.

Thanks in advance!
Critical hit multiplier isn't a parameter that exists in the base engine. That means you added it through another plugin.

The creator of that plugin would have decided how to call the parameter from the battler object. Usually this is a short code, similar to how the other xparams are called (cri == crit, exr == experience rate, etc) for example, my block plugin uses actor.blk to display block chance.
All right, I'll take a look around for that. Any ideas on where to begin looking? Maybe their core plugin?
I would recommend looking in the plugin that uses the multiplier parameter. Since you're using Yanfly's plugin, the most likely spot is somewhere in the Critical Control plugin.
I reviewed the Critical Control plugin which is where the Critical Multiplier is established.

Link to plugin: http://www.yanfly.moe/wiki/Critical_Control_(YEP)

From here I was able to identify how the actor's critical multiplier is calculated:

Code:
Game_Actor.prototype.criticalMultiplierBonus = function() {
    multiplier = Game_Battler.prototype.criticalMultiplierBonus.call(this);
    multiplier += this.actor().critMultBonus;
    multiplier += this.currentClass().critMultBonus;
    for (var i = 0; i < this.equips().length; ++i) {
      var equip = this.equips()[i];
      if (equip) multiplier += equip.critMultBonus;
    }
    return multiplier;
};

But I don't see a way to obtain the result as a variable, and then input that into the status menu core.


Any tips or suggestions on where to go from here would be appreciated. Thank you kindly. 🙂
Your original custom code:

case 'chm':
this.drawAttributeName('Critical Hit Multiplier', dx, dy, dw);
this.drawAttributeRate(???, dx, dy, dw);
break;

Changes into this:

case 'chm':
this.drawAttributeName('Critical Hit Multiplier', dx, dy, dw);
this.drawAttributeRate(actor.criticalMultiplierBonus(), dx, dy, dw);
break;

If I'm not mistaken, the function criticalMultiplierBonus() returns the necessary variable. So the ??? needs to change to actor.criticalMultiplierBonus() and that should give you the correct multiplier variable.
@shockra

Thanks for the help! This is perfect!! From here I edited to add the default crit rate and ended up with:

Code:
case 'chm':
this.drawAttributeName('Critical Hit Multiplier', dx, dy, dw);
this.drawAttributeRate(1.5+actor.criticalMultiplierBonus(), dx, dy, dw);
break;

So just to confirm with you, really, you just smacked actor. in front of the function, and that does the trick? Just so I know for any future reference.

Thank you again! Very helpful!
Basically, yes. The actor variable was likely established earlier in the function with the switch case, so it found the necessary actor when the crit multiplier function was called.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-status-menu-core-adding-a-parameter.120149/