Change Selling price

Hey guys!


I'm making a plugin that changes the price of an weapon/armor according it's basis params (HP, MP, ATK, DEF, etc). I already made the buying price, now I'm struggling to make the selling price. I'm still getting the price on database, not the new price altered by my plugin. can anyone help me? 🙁


The buying price code:

Code:
var _WindowShopBuy_price = Window_ShopBuy.prototype.price;
        Window_ShopBuy.prototype.price = function(item) {
        var _priceMod = newMod[8];
        for (i = 0; i < 7; i++) {
          _priceMod += item.params[i] * newMod[i];
        }
            var price = _WindowShopBuy_price.call(this, item);
            price += _priceMod;
            return price;
        };
up
Selling is handled elsewhere in the code.


I found it over under Scene_Shop.

Spoiler
Scene_Shop.prototype.sellingPrice = function() {
return Math.floor(this._item.price / 2);
};



Your method is called within the Window part of the shop.


If I had to guess, this is calling directly to the item's price, which is a property(?) of the item itself.


You will likely need to modify this code to accommodate your price-change-code if you want selling to be affected.

Original thread: https://forums.rpgmakerweb.com/threads/change-selling-price.72033/