How to show parameters in default shop scene

So you know how in the default shop scene, when hovering over a piece of equipment that improves or worsens your parameters, it just shows a number, not the parameter name? Is there a simple way to show that parameter name in the default shop scene?

So that in the red rectangle in the picture below, it would say "Attack" next to the number.

Spoiler
y2rI6lG.jpg

I know there are shop plugins like Yanfly's that show these kinds of things, but as you can probably see in the pic above, I'm using a plugin that allows item stock, and it's conflicted with every shop plugin out there. And honestly, besides not showing the parameter name, I have no problems with using the default shop scene.

EDIT: Okay, so I just discovered it's not actually showing a single parameter change, but rather it just adds all parameter changes a piece of equipment gives and throws out that number. Not very helpful.

This probably makes things more complicated, but is there a way, without using other shop plugins, to show any or all parameter changes individually that a weapon or armor gives?
Hmm, it should not be adding all of the parameters together, unless the other shop script is doing so.

Give this a try, see if it works with the script you are using. It is an quickie overwrite, so it might not play nice ... but we can work on it from there.

Code:
Window_ShopStatus.prototype.drawActorParamChange = function(x, y, actor, item1) {
    var width = this.contents.width - this.textPadding() - x;
    var paramId = this.paramId();
    var paramName = ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK'];
    var change = this._item.params[paramId] - (item1 ? item1.params[paramId] : 0);
    this.changeTextColor(this.paramchangeTextColor(change));
    this.drawText(paramName[paramId] + ' ' + (change > 0 ? '+' : '') + change, x, y, width, 'right');
};
I've just tested it with and without the plugin (This is the plugin BTW: http://endlessillusoft.com/shop-system/) and from what I can see, it literally adds all parameter changes together and draws the result. The number is not tied to a particular parameter or anything, but just an accumulation of any and all parameter changes.

With your snippet though, it only wants to draw the ATK parameter. So if a shield gives me 2 DEF, it will show as "ATK 0" in the shop.
Hmm ... in the default shop each weapon or armor should be tied to a particular parameter (attack for weapons, defense for armor) unless there is another script that is altering the default code.

Here is how it looks for me (with the shop script enabled) :

Spoiler
7q4x4ZK.png
Sword has +1 more attack than the Axe

JdCwzHg.png


tZhYUIQ.png

PB3xRtz.png
EDIT: Also with the code snippet I created :

Spoiler
VS4gvrB.png
dSO9SBJ.png
Okay, I've discovered the culprit. Maliki's Dual Wield (https://forums.rpgmakerweb.com/index.php?threads/malikis-dual-wield-ver-2-2.49724/) This plugin requires that you put shields under 'Weapons' in the database. Which is why it returned ATK 0 earlier with your snippet. From what I can also gather, your snippet seems to get rid of this 'parameter adding' that Maliki's Dual Wield seems to want to cause. Also, I forgot to mention that your snippet does work with that shop system plugin I linked to earlier.

Is there a way, though, to show all parameter changes, not just the ones tied to weapons and armor (ATK for weapons, DEF for armor)? Say I have an armor that increases my DEF +1 and MDF +2. Is there a way I can show both of these in the default shop scene?

So it would show...
DEF +1
MDF +2

And not just...
DEF +1
Yes, the default code could be altered to display multiple parameters. But while that does look nice when the party is only one character, it becomes a mess once you add more (depending on how many parameters you want to show). For each weapon or armor it will list whoever can wear the item and all eight parameters which will clump together and run off the screen.

Spoiler
WfLkLm0.png

dFw7PYR.png
Well fortunately for me, for the time being, my game is a single actor game. I'm thinking of adding 'followers' (maybe no more than 1) whose equipment will be locked and unable to change, but still undecided on it. So that stuff wouldn't affect me. And even if I did add followers, could there be a way to hide them from the shop scene, since I'm gonna lock their equipment anyway?

I'll still gladly take the updated snippet.
The snippet is rather rough and a quickie overwrite, but should work well enough :

Code:
Window_ShopStatus.prototype.drawActorEquipInfo = function(x, y, actor) {
  var enabled = actor.canEquip(this._item);
  var paramHeight = 0;
  this.changePaintOpacity(enabled);
  this.resetTextColor();
  this.drawText(actor.name(), x, y, 168);
  var item1 = this.currentEquippedItem(actor, this._item.etypeId);
  if (enabled) {
    paramHeight = this.drawActorParamChange(x, y, actor, item1);
  }
  this.drawItemName(item1, x, y + (paramHeight || this.lineHeight()));
  this.changePaintOpacity(true);
};

Window_ShopStatus.prototype.drawActorParamChange = function(x, y, actor, item1) {
  var width = this.contents.width - this.textPadding() - x;
  var change = 0;
  var lines = 0;
  var paramName = ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK'];
 
  for (var id = 0; id < paramName.length; id++) {
    change = this._item.params[id] - (item1 ? item1.params[id] : 0);
    
    if (change > 0) {
      this.changeTextColor(this.paramchangeTextColor(change));
      this.drawText(paramName[id] + ' ' + (change > 0 ? '+' : '') + change, x, y + lines, width, 'right');
      lines += this.lineHeight();
    }
  }

  return lines;
};
I'm curious, is it not supposed to show decreased parameter values? Because if I equip a +2 ATK weapon, and then look at another weapon in the shop that does +1 ATK, nothing shows at all. Not -1 ATK, just absolutely nothing.

By comparison, the default code does show a decrease in parameter value.
Oh, whoops, in testing I made it so that only positive values are displayed and did not remove that code later on. Sorry about that.

EDIT: Oop, give me a moment ...

Code:
Window_ShopStatus.prototype.drawActorEquipInfo = function(x, y, actor) {
  var enabled = actor.canEquip(this._item);
  var paramHeight = 0;
  this.changePaintOpacity(enabled);
  this.resetTextColor();
  this.drawText(actor.name(), x, y, 168);
  var item1 = this.currentEquippedItem(actor, this._item.etypeId);
  if (enabled) {
    paramHeight = this.drawActorParamChange(x, y, actor, item1);
  }
  this.drawItemName(item1, x, y + (paramHeight || this.lineHeight()));
  this.changePaintOpacity(true);
};

Window_ShopStatus.prototype.drawActorParamChange = function(x, y, actor, item1) {
  var width = this.contents.width - this.textPadding() - x;
  var change = 0;
  var lines = 0;
  var paramName = ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK'];
 
  for (var id = 0; id < paramName.length; id++) {
    change = this._item.params[id] - (item1 ? item1.params[id] : 0);
    this.changeTextColor(this.paramchangeTextColor(change));
    this.drawText(paramName[id] + ' ' + (change > 0 ? '+' : '') + change, x, y + lines, width, 'right');
    lines += this.lineHeight();
  }

  return lines;
};
Awesome, thanks! There's a little minor problem relating to the Dual Wield plugin I mentioned. Not sure how willing you'd be to try to fix it. Basically, you have a main hand and offhand you can equip any weapons into, including shields. The problem is when you equip a weapon into the offhand only, then look at a weaker weapon in the shop (to potentially equip in the main hand), it compares it to the offhand-equipped weapon and displays the parameter change as a negative, when I think it should be a positive.

Basically what I'm asking, is there a way to change the parameter displays in the shop to reflect the actor's overall parameters, instead of just the weapons and armor? Basically showing the actor's parameters in the shop scene, and then any parameter changes from weapons or armor in the shop are added to that, instead of the currently equipped weapon. I hate to ask more of you, since you've already done so much for me (which I am very grateful for).
When there are multiple weapons the default code will take the display the one with the worst overall parameters (usually people are looking for an upgrade to their worst item). I could do something like this really easily :

dpmn2Sx.png

Where it shows the total parameter plus or minus the selected item versus the weakest item.
I think I get what you mean, but I'm not entirely 100% sure. Could provide a clearer example through text? I'm not gleaning much from that screenshot. What do you mean when you say "versus the weakest item"?
So, let's say that you have a dual-wielding character. The character has a sword that has ATK+10 and an axe that has ATK+8 ... the default shop will always compare the highlighted shop item against the axe regardless of what hand the weapon is in.
Gotcha. At first I didn't think it was really necessary to compare it against any equipped weapons if you displayed the actor's parameters, but I get you now. The shop still compares against the weakest weapon.

If you can do that, then that'd be great.
Hey @Ossra , I rewrote the code to better address the issue. It's a really good function, so I'll try to add it to my plugin formally.
But for now, this should suffice.
Spoiler
Window_ShopStatus.prototype.drawActorEquipInfo = function(x, y, actor) {
var enabled = actor.canEquip(this._item);
var paramHeight = 0;
this.changePaintOpacity(enabled);
this.resetTextColor();
this.drawText(actor.name(), x, y, 168);
var item1 = this.currentEquippedItem(actor, this._item.etypeId);
if (enabled) {
paramHeight = this.drawActorParamChange(x, y, actor, item1);
}
this.drawItemName(item1, x, y + (paramHeight || this.lineHeight()));
this.changePaintOpacity(true);
};

Window_ShopStatus.prototype.drawActorParamChange = function(x, y, actor, item1) {
var width = this.contents.width - this.textPadding() - x;
var change = 0;
var lines = 0;
var actorParam = 0;
var paramName = ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK'];

for (var id = 0; id < paramName.length; id++) {
change = this._item.params[id] - (item1 ? item1.params[id] : 0);
if (item1) {
if (this.doublewielding(actor) && DataManager.isWeapon(item1)) {
if(item1 === actor.equips()[0]) var item2 = actor.equips()[1];
if(item1 === actor.equips()[1]) var item2 = actor.equips()[0];
}
if(this._item.meta.twohand && item2) change -= item2.params[id];
if (item1.etypeId !== this._item.etypeId && item1.id !== this._item.id) {
actorParam = this._item.params[id] > 0 ? actor.param(id) - this._item.params[id] : actor.param(id) + this._item.params[id];
} else {
actorParam = actor.param(id);
}
} else {
actorParam = actor.param(id);
}
this.changeTextColor(this.paramchangeTextColor(change));
if (change == 0) {
this.drawText((change > 0 ? '+' : '') + ' ' + ' ' + paramName[id] + ' ' + (actorParam + change), x, y + lines, width, 'right');
} else {
this.drawText((change > 0 ? '+' : '') + change + ' ' + paramName[id] + ' ' + (actorParam + change), x, y + lines, width, 'right');
};
lines += this.lineHeight();
}

return lines;
};

Window_ShopStatus.prototype.currentEquippedItem = function(actor, etypeId) {
var list = [];
var equips = actor.equips();
var slots = actor.equipSlots();
for (var i = 0; i < slots.length; i++) {
if (slots === etypeId) {
if (i < 2 && $dataClasses[actor._classId].meta.monkeygrip) {
list.push(equips);
} else {
if (i == 0 && !this.ignoreWeap1(actor)) list.push(equips);
if (i == 1 && !this.ignoreWeap2(actor)) list.push(equips);
}
if (i >= 2) list.push(equips);
}
}
var paramId = this.paramId();
var worstParam = Number.MAX_VALUE;
var worstItem = null;
for (var j = 0; j < list.length; j++) {
if (!list[j]) {
return null;
}
if (list[j] && list[j].params[paramId] < worstParam) {
worstParam = list[j].params[paramId];
worstItem = list[j];
}
}
return worstItem;
};

Window_ShopStatus.prototype.ignoreWeap1 = function (actor) {

if (this._item.meta.twohand && !actor.equips()[0]) return true;
if (this._item.meta.shld && !this.dualwielding(actor)) return true;
if (this._item.meta.shld && actor.equips()[1] && actor.equips()[1].meta.shld) return true;
if (this.dualwielding(actor) && !actor.equips()[0]) return true;
return false;
};

Window_ShopStatus.prototype.ignoreWeap2 = function (actor) {

if (!actor.equips()[0]) return false;
if (this.dualwielding(actor)) return true;
if (this._item.meta.twohand && actor.equips()[0] && !actor.equips()[0].meta.twohand) return true;
return false;

};

Window_ShopStatus.prototype.dualwielding = function (actor) {

if(actor.equips()[0] && actor.equips()[0].meta.twohand) return true;
if(actor.equips()[1] && actor.equips()[1].meta.twohand) return true;
return false;
};

Window_ShopStatus.prototype.doublewielding = function (actor) {

if(actor.equips()[0] && actor.equips()[1]) return true;
return false;
};

Thx

Edited to update code

Original thread: https://forums.rpgmakerweb.com/threads/how-to-show-parameters-in-default-shop-scene.85827/