RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
"Buy Only" in Shops

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 88
All work will stop and the ground will releive...
I'm working on a system in my game that has several variables that can be spent as money. In RM2K and 2K3, there was a "Buy Only" option for shops, which I really need, but its not there anymore. How would I go about preventing selling for certain shops?
Secret of the Summit: [Working Title]
Scripts: nearly complete (need skill shop)
Storyline: complete
Database: 50%
Game Progress: 10%


***
Rep:
Level 88
Smarter than the average bear
here you go:

Made by Sandgolem at gamebaker.com

Quote
This script allows you to prevent shops from buying types of items, or only buying certain items of a type. Can be mixed, you can make one shop that will only buy armors #1-10 and no items/weapons for example. Each shop can have their own settings, with no script editing required.

Code: [Select]
#==========================================================================
# ** SG Limited Shop Selling
#==========================================================================
# sandgolem
# Version 3
# 26.04.06
#==========================================================================

# Instruct: http://www.gamebaker.com/rmxp/scripts/limited-shop-selling.htm

#==========================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# To use this script, copy it and insert it in a new section above "Main",
# but under the default scripts and the SDK if you're using it.
#
# Have problems? Official topic:
#   http://forums.gamebaker.com/showthread.php?t=146
#
#==========================================================================

begin
  SDK.log('SG Limited Shop Selling', 'sandgolem', 3, '26.04.06')
  if SDK.state('SG Limited Shop Selling') != true
    @sg_limshopsell_disabled = true
  end
  rescue
end

if !@sg_limshopsell_disabled
#--------------------------------------------------------------------------

class Game_Party
  def sg_limited_shop_start
    if $sg_doesntbuy_weapon or $sg_onlybuys_weapon
      @sg_limsell_weapons = @weapons.clone
      @weapons = {}
      if $sg_onlybuys_weapon
        for i in 0...$sg_onlybuys_weapon.size
          if @sg_limsell_weapons[$sg_onlybuys_weapon[i]] != nil
            @weapons[$sg_onlybuys_weapon[i]] =
            @sg_limsell_weapons[$sg_onlybuys_weapon[i]]
          end
        end
      end
    end
    if $sg_doesntbuy_armor or $sg_onlybuys_armor
      @sg_limsell_armors = @armors.clone
      @armors = {}
      if $sg_onlybuys_armor
        for i in 0...$sg_onlybuys_armor.size
          if @sg_limsell_armors[$sg_onlybuys_armor[i]] != nil
            @armors[$sg_onlybuys_armor[i]] =
            @sg_limsell_armors[$sg_onlybuys_armor[i]]
          end
        end
      end
    end
    if $sg_doesntbuy_item or $sg_onlybuys_item
      @sg_limsell_items = @items.clone
      @items = {}
      if $sg_onlybuys_item
        for i in 0...$sg_onlybuys_item.size
          if @sg_limsell_items[$sg_onlybuys_item[i]] != nil
            @items[$sg_onlybuys_item[i]] =
            @sg_limsell_items[$sg_onlybuys_item[i]]
          end
        end
      end
    end
  end

  def sg_limited_shop_end
    if @sg_limsell_weapons
      @weapons = @sg_limsell_weapons.clone
      @sg_limsell_weapons = nil
    end
    if @sg_limsell_armors
      @armors = @sg_limsell_armors.clone
      @sg_limsell_armors = nil
    end
    if @sg_limsell_items
      @items = @sg_limsell_items.clone
      @sg_limsell_items = nil
    end
  end
end

class Window_ShopSell
  alias sandgolem_limshopsell_shopsell_refr refresh
  def refresh
    $game_party.sg_limited_shop_start
    sandgolem_limshopsell_shopsell_refr
    $game_party.sg_limited_shop_end
  end
end

class Scene_Shop
  alias sandgolem_limshopsell_shop_main main 
  def main
    sandgolem_limshopsell_shop_main
    $sg_onlybuys_armor = nil
    $sg_doesntbuy_armor = nil
    $sg_onlybuys_item = nil
    $sg_doesntbuy_item = nil
    $sg_onlybuys_weapon = nil
    $sg_doesntbuy_weapon = nil
  end
end

#--------------------------------------------------------------------------
end

Quote
Simply put it in your game, no assembly required.

To keep a shop from buying certain types of items, use these in a call script right before the shop processing:
$sg_doesntbuy_item = true
$sg_doesntbuy_armor = true
$sg_doesntbuy_weapon = true
To have a shop buy only certain items from that set, use these (not the one for that type above):
$sg_onlybuys_item = [#,#]
$sg_onlybuys_armor = [#,#]
$sg_onlybuys_weapon = [#,#]
Those are arrays, use [#,#,#] and [#,#,#,#,#] to add more items to the list. Replace the #s with the item #'s from the database. Make sure you disable the other types of items from being sold if you want the shop to only buy those items.

You can mix and match them however you want. All of these settings are automatically removed after the shop has been called.

*****
Ancient Mummy
Rep:
Level 90
I thought he said Rm2k3
That doesnt support scripts..

**
Rep: +0/-0Level 88
All work will stop and the ground will releive...
Thank you! I was going to go crazy if I had to work around it. It's doable, but it would cost me hours of work.

Quote
I thought he said Rm2k3
That doesnt support scripts..

Nope. I said that they had the option built into the editor in RM2K3. I'm using XP.
Secret of the Summit: [Working Title]
Scripts: nearly complete (need skill shop)
Storyline: complete
Database: 50%
Game Progress: 10%


***
Rep:
Level 88
Smarter than the average bear
Thank you! I was going to go crazy if I had to work around it. It's doable, but it would cost me hours of work.

no problem, glad I could help  :) ^-^ :) ^-^