Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Guest RPG Advocate

Buy-Only and Sell-Only Shops

Recommended Posts

Guest RPG Advocate

Introduction

This script lets you call shops that only allow buying or selling. The default shop type is a normal shop that allows both buying and selling.

 

The Script

Buy_Only_and_Sell_Only_Shops.zip

 

Instructions

To get a shop that only allows buying or selling, you need to directly change the value of the variable $game_temp.shop_type using the "Script" event command. Valid values are 0 for a normal shop, 1 for a buy-only shop, and 2 for a sell-only shop. $game_temp.shop_type will automatically be changed back to 0 once the shop is cancelled.

Share this post


Link to post
Share on other sites

Unfortunately this script was re-posted by Marked to retain our script uploads (or something) and I am not sure you are going to be able to get a response from the original author.

 

So let me try to help:

 

Step 1: Put this script above "main"

 

# Buy-Only and Sell-Only Shops
# by RPG Advocate


#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================

class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :shop_type                # map music (for battle memory)
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias boasos_init initialize
def initialize
  boasos_init
  @shop_type = 0
end
end



#==============================================================================
# ** Window_ShopCommand
#------------------------------------------------------------------------------
#  This window is used to choose your business on the shop screen.
#==============================================================================

class Window_ShopCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
  super(0, 64, 480, 64)
  self.contents = Bitmap.new(width - 32, height - 32)
  @item_max = 3
  @column_max = 3
  @commands = ["Buy", "Sell", "Exit"]
  self.contents.font.name = "Arial"
  self.contents.font.size = 24
  refresh
  self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
  self.contents.clear
  if $game_temp.shop_type == 0
    for i in 0...@item_max
    draw_item(i)
    end
  end
  if $game_temp.shop_type == 1
    self.contents.draw_text(4, 0, 324, 32, "You can only buy at this shop.")
    self.index = -1
    update_cursor_rect
  end
  if $game_temp.shop_type == 2
    self.contents.draw_text(4, 0, 324, 32, "You can only sell at this shop.")
    self.index = -1
    update_cursor_rect
  end
end
#--------------------------------------------------------------------------
# * Draw Item
#     index : item number
#--------------------------------------------------------------------------
def draw_item(index)
  x = 4 + index * 160
  self.contents.draw_text(x, 0, 128, 32, @commands[index])
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
  if $game_temp.shop_type == 0
    super
  end
  if $game_temp.shop_type == 1 || $game_temp.shop_type == 2
    self.cursor_rect.empty
  end
end
end

 

 

Step 2:

 

Before you call the "Shop Processing" event command, you need to use a call script to set the shop type.

 

For buy only, make your call script like this:

$game_temp.shop_type = 1

 

For sell only, make your call script like this:

$game_temp.shop_type = 2

 

Once the shop has completed, it will return to the normal shop. So, the next call to Shop Processing, if $game_temp.shop_type has not been set, will be a normal shop.

 

Hope this helps.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...