How to make shops refuse certain items

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
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.
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!
You need a script to make this easy.
look for Seiryuki - Hide Shop Item categories
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.
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.
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!
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.
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!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-shops-refuse-certain-items.104689/