Main Menu
  • Welcome to The RPG Maker Resource Kit.

[RESOLVED] Remove the "Sell" option

Started by Wafflekid, January 22, 2007, 11:28:30 PM

0 Members and 1 Guest are viewing this topic.

Wafflekid

Is there a script where you can remove the "Sell" option in your game and have the store atomaticly jump to buy?
Hi...

italianstal1ion

Here's SandGolem's ever useful Limited Shop script.


#==========================================================================
# ** SG Limited Shop Selling
#==========================================================================
# sandgolem
# Version 3
# 26.04.06
#==========================================================================

# Instruct: http://www.gamebaker.com/rmxp/scripts/limited-shop-selling.htm
=begin
or get instructions...RIGHT HERE!!!
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.
=end
#==========================================================================
#
# 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


And for the instructions; (I have also placed em in the script)

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.

Wafflekid

Thank you, I needed that script for a vending machine kind of thing, you really can't sell back an item to the vending machine. But thank you.
Hi...

:)

since your question has been awnsered, change the {REQUEST] in your title to [RESOLVED]
Watch out for: HaloOfTheSun

Wafflekid

Hi...