Need help adjusting sell price of items

Hello,

In my game I have a thief that, when he reaches a certain level, can get better deals when selling items. I'm trying to create a plug-in that will let me adjust that price but it doesn't seem to be working.

//=============================================================================// Fence.js//=============================================================================/*: * @plugindesc Shade fence skill. * @author Daniel Chessare * * @help Divide the sale price of an item * * @param Divisor * @desc Number to divide sale item by. * @default */(function() { var parameters = PluginManager.parameters('Fence'); var Divisor = parameters['Divisor'] || ''; var newSellPrice = Scene_Shop.prototype.sellingPrice; Scene_Shop.prototype.sellingPrice = function() { newSellPrice.call(this); return Math.floor(this._item.price / Divisor); }; }})();any thoughts?
You need to give more information.  What is happening?  What do you expect to happen?  What are you inputting as the values?

I don't know if it makes a difference, but I wouldn't begin a variable name with a capital letter.

However, the default function returns a value.  Why are you calling it if you are not going to place its return value somewhere and use it?

Seems like you want it to return the default value until your actor reaches a certain level, and then have it do your custom calculations instead.  Therefore, it would be something like this:

Code:
if ($gameActors.actor(id).level() < required_level) {  return newSellPrice.call(this);} else {  return Math.floor(this._item.price / Divisor);}
Nothing is happening, I test the plug-in and no matter what number I set in the parameter nothing happens.

Yeah, I wasn't going to implement the if statement until I got the function working properly. If statements are one of the few things I know how to do. Right now I'm just trying to adjust the sale price of items. By default it's half the price of the item's worth and I would like to adjust that. I'm pretty much following a plug-in template, I've tried it with and without the the newSellPrice.call and nothing happens. When I test the plug-in I'm trying to sell a 50g potion, which by default sells for 25g. In the parameters for Divisor I put in 5, just as a test. in the real game it will be a different value. It should adjust it to 10, but nothing happens. 
Have you tried debugging it?  F8 will open the debug console, or if you play the index.html (which is what I do, as F8 doesn't work for me for some reason) F12 is the key to bring up the developer tools.

You can put a breakpoint on one of your statements, try and sell something, and watch it go through to see what's happening.

Aaaaand, this is what it tells me in debug:

Uncaught SyntaxError: Unexpected token } on line 35You have too many } at the end so your plugin isn't even running.  I removed the extra } on the second last line and it works perfectly.
AH! Now I feel dumb, thanks very much!
Hello again:

Sorry to be a bother but when I try and use the if statement you made above I'm getting an error:

"Number is not a function" @line 27 which is if ($gameActors.actor(1).level() < 10) {

Code:
(function() {	var parameters = PluginManager.parameters('Fence');	var divisor = parameters['divisor'] || '';	var newSellPrice = Scene_Shop.prototype.sellingPrice;		Scene_Shop.prototype.sellingPrice = function() {			if ($gameActors.actor(1).level() < 10) {		return newSellPrice.call(this);		} else {		return Math.floor(this._item.price / divisor);		}			};})();
The error is this

$gameActors.actor(1).level() < 10

level is a property, not a function. 😎
Thanks! I have it fully functioning! Thanks to both of you!
Yeah, I said "something like this" because I didn't look it up to ensure the names/syntax were correct. At that stage I was focussing more on the calculation itself than the logic.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-adjusting-sell-price-of-items.49522/