Changing selling price

Indinera

Indie Dev
Veteran
Joined
Mar 13, 2012
Messages
1,900
Reaction score
796
First Language
French
I'd like it to be divided by 3 instead of 2.

I'm using Yanfly ShopMenuCore but all I've seen there is a <Sell Price: x> specific to each item, not a formula for all of them at the same time. Maybe I'm not looking at the right place?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,095
Reaction score
13,589
First Language
English
Primarily Uses
RMVXA
I am not 100% sure where it is in MV, but in ACE I found a command called selling_price in the code, and the entire code for that command is:

@item.price / 2

I imagine it will be in a similar spot in MV. Check to see if you have a Scene_shop code or something similar.
 

Indinera

Indie Dev
Veteran
Joined
Mar 13, 2012
Messages
1,900
Reaction score
796
First Language
French
In which *.js I would find it, any idea?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,095
Reaction score
13,589
First Language
English
Primarily Uses
RMVXA
I found it in rpg_scenes.js. I had to then use notepads search function and it came up with this command near the very end of the code on that .js file:

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

A switch of 2 to 3 should work. Though I'd recommend making it a small plug-in instead, sadly what I know about doing that is nil for MV. Maybe one of our coders can show how to do it as a small plug-in if desired?
 

TSR

The Northern Frog
Veteran
Joined
Nov 14, 2019
Messages
196
Reaction score
145
First Language
French
Primarily Uses
RMMV
Hello! The function @bgillisp found is the right one!
Just copy-paste it in scene_shop section of YEP_ShopMenuCore and change the function as you like.
 

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
303
Reaction score
454
First Language
English
Primarily Uses
N/A
I actually made this exact change to Roguelite 2 and can confirm that what @bgillisp suggests works. Like he said, though, put it in a different plugin in case you ever end up updating your base JS files.
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
840
Reaction score
338
First Language
Javascript
Primarily Uses
RMMV
I'd like it to be divided by 3 instead of 2.
Maybe one of our coders can show how to do it as a small plug-in if desired?
Yep Yep sure sure no prob. Done and done ;)
1590420885200.png
Use that plugin to set a variable that will control the amount of division. ;)

1590419599666.png

1590420003649.png
Place the plugin at below Yanfly's and any other shop plugins :)

Edit v0.20:
Added a new parameter for "Custom Code" which overwrites the function if custom code is used.
1590420631135.png
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts


:3c here's a thing i made a while while while back
Tried mochi for the first time. It's quite nice. Has a pleasant smell and taste, and is nice and chewy.
made a bio for the protag in my project!
Beggar : "I haven't eat for days..."
Kid : "Just do crime! You will get daily necessity for free in prison~"

Forum statistics

Threads
99,159
Messages
962,454
Members
130,725
Latest member
teendinsaikha
Top