How to make shops refuse certain items

Joined
Sep 15, 2017
Messages
63
Reaction score
13
First Language
Telepathy
Primarily Uses
RMVXA
Hi there!
I was just wondering...
Is it possible to make shops refuse certain items in a simple way without using scripts?

Example: I have a fruit shop and I don't want the fruit shop to accept weapons or armors as merchandise.

Can I do that in a simple way without having to add a script (I already have one for shop processing).

Thanks
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
not in that form.

by default, items that have a gold price of 0 cannot be sold. That is the only way the engine itself can prevent selling.

This can be overridden by giving a shop a specific value for the item - but I don't know if that is what you want, beccause it is a lot of work to set everything to 0 in the database and give prices to items you want to be available in specific shops.
 
Joined
Sep 15, 2017
Messages
63
Reaction score
13
First Language
Telepathy
Primarily Uses
RMVXA
not in that form.

by default, items that have a gold price of 0 cannot be sold. That is the only way the engine itself can prevent selling.

This can be overridden by giving a shop a specific value for the item - but I don't know if that is what you want, beccause it is a lot of work to set everything to 0 in the database and give prices to items you want to be available in specific shops.
Hey Andar,
Yes, I read that somewhere. However, if I do that, the shop will list the item even if it's not available so it looks really bad in my opinion.
I tried by setting the price of a sword to zero for the fruit shop but then, in the list of items available for the shop, you can see the sword as well.
Which is very annoying.

I wish there was some kind of conditional branch for the shop, something like:
if weapons or armors = true
no purchase possible.

Anyway, it looks like it's not easily done without a script, unless you have another idea.
Thanks for your help anyway!
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
You need a script to make this easy.
look for Seiryuki - Hide Shop Item categories
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
you can make a quick edit of the shop's item window to filter out what you don't want.
on load, your held items are copied over to the shop's window.... that's where you hook up your filter.
I know I did something like that, but I can't remember if it was for selling or buying, let me double check.

EDIT: scratch that.
it's not at loading time, it's at selection time.
usually, you fill up the list based on the category:

Code:
class Window_ShopSell < Window_ItemList
def include?(item)
    case @category
     when :item
       item.is_a?(RPG::Item) && !item.key_item?
     when :weapon
       item.is_a?(RPG::Weapon)
     when :armor
      item.is_a?(RPG::Armor)
     when :key_item
       item.is_a?(RPG::Item) && item.key_item?
     else
       false
     end
  end
end
but if you want to show the items and not allow them for trade, you can edit the enable check

Code:
 def enable?(item)
     item && item.price > 0
  end
quickest way I can think of, is this:
Code:
class Window_ShopSell < Window_ItemList
 def enable?(item)
     $game_variables[X].include?(@category)
  end
end
where you can specify $game_variables[X] as [category1, category2, category3, etc]
if the selected shop category is not specified in the variable, the item will be greyed out.
remember to set that variable before loading the shop, and clear it afterwards.
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
I tried by setting the price of a sword to zero for the fruit shop but then, in the list of items available for the shop, you can see the sword as well.
Wrong way - the DATABASE prize needs to be zero, and the shop needs to have its price set in the weapon shop.
then it will neither be visible nor saleable in the fruit shop.
 
Joined
Sep 15, 2017
Messages
63
Reaction score
13
First Language
Telepathy
Primarily Uses
RMVXA
You need a script to make this easy.
look for Seiryuki - Hide Shop Item categories
I'm just concerned because I have a fantastic script for shop processing (Galv's shop upgrade - and I love it) so I really don't want to mess up things too much. I was trying to avoid using another script..

gstv 87,
Wow what a fantastic job you did. That's exactly what I meant!
But I'm using Galv's Shop Upgrade script which is really complicated for me but very effective so I'm worried about mixing things up!
I'll try it out when I get a bit more proficient in Ruby, at the moment I'm still learning the basics of python :dizzy:
A big thanks for your help.

Andar
If I do what you say it means that then I have to set all the prices manually for each shop because if you change the database value it will be global.... Mmmm, it seems a bit too much for my needs but thanks for teaching me a new trick!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
it means that then I have to set all the prices manually for each shop because if you change the database value it will be global.... Mmmm, it seems a bit too much for my needs
That is why I said in my original post that it is a lot of work - I completely agree with you here, but it is the only way unless you're using scripts to change the engine behaviour. And that has other problems if you already have scripts, as you also already know.
 
Joined
Sep 15, 2017
Messages
63
Reaction score
13
First Language
Telepathy
Primarily Uses
RMVXA
That is why I said in my original post that it is a lot of work - I completely agree with you here, but it is the only way unless you're using scripts to change the engine behaviour. And that has other problems if you already have scripts, as you also already know.
Bingo!
I discovered something great. So I was testing and I sold some weapons to the fruit shop and guess what? Yes, I get the money for the weapons I sold but then, if I switch back to the buy option, the weapons are not available which is exactly what I need!
PROBLEM SOLVED!
Thanks again, brainstorming is very important to learn from one another!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top