Enelvon/Seiryuki Sell-Only Shop Script

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 72
RMRK Junior
Sell-Only Shop Script
Version: 1.0
Author: Enelvon/Seiryuki
Date: 2011/04/30

Version History


Version 1.0: 2011.04.30 - only version so far

Planned Future Versions

No plans yet.

Description


This script allows for sell-only shops by disabling the "buy" option. My intention was to combine that feature with Mithran's LimitShopBuy script to create a shop that would only buy certain items from your party's inventory whilst hiding all other items. E.g. Using both scripts, a Loot shop would have the ability to buy Loot, and only Loot, from your party's inventory and would be unable to sell Loot back to you.

Features

Check the instructions in the script for an example on how to easily create a sell-only shop. Using that example makes it easy to run buy/sell shops, buy-only shops and sell-only shops without problems.

Screenshots


    Notice the "Buy" option disabled. This screenshot was also taken with Mithran's LimitShopBuy script ON.

Instructions

      Uses the Script command in an event:
       To make your shops sell-only:
         $game_temp.shop_sell_only = true

       To undo it, use this:
         $game_temp.shop_sell_only = false

Script


Code: [Select]
###############################################################################
###############################################################################
# ~~~~~~~~~~~~~~~~~~~~~~SELL-ONLY SHOP SCRIPT v1.0~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~by Enelvon~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~concept, assistance by Seiryuki~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~Last Update: 2011.04.30~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# site: rpgmakervx.net~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# post: http://www.rpgmakervx.net/index.php?showtopic=45007~~~~~~~~~~~~~~~~~~~~
###############################################################################
# This script allows you to have shops that can only sell items by disabling
# the "Buy" option. Remember, you must enter at least one item to create the
# shop.
###############################################################################
#------------------------------------------------------------------------------
# COMPATIBILITY:
# This script is compatible with Mithran's LimitShopBuy script.
# This script has not been tested with other shop scripts.
#------------------------------------------------------------------------------
# INSTRUCTIONS:
# Place this script above Main and above any other scripts that modify the
# command window of Scene_Shop.
# Rather than using a switch, this uses a script command in an event.
#
#   To make your shops sell-only:
#     $game_temp.shop_sell_only = true
#
#   To undo it, use this:
#     $game_temp.shop_sell_only = false
#
#------------------------------------------------------------------------------
# EXAMPLE OF A SELL-ONLY SHOP EVENT:
#
# @> Script: $game_temp.shop_sell_only = true
# @> Shop Processing: [Potion]
# :                 : [Hi-Potion]
# @> Script: $game_temp.shop_sell_only = false
#
#------------------------------------------------------------------------------
###############################################################################
###############################################################################

class Game_Temp
  attr_accessor :shop_sell_only
  alias enelvon_seiryuki_temp_init initialize
  def initialize
    enelvon_seiryuki_temp_init
    @shop_sell_only = false
  end
end

class Scene_Shop < Scene_Base

  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  alias enelvon_seiryuki_shop_window create_command_window
    def create_command_window
      enelvon_seiryuki_shop_window
      if $game_temp.shop_sell_only
       @command_window.draw_item(0, false)
      end
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0 # buy
        if $game_temp.shop_sell_only
          Sound.play_buzzer
        else
          Sound.play_decision
          @command_window.active = false
          @dummy_window.visible = false
          @buy_window.active = true
          @buy_window.visible = true
          @buy_window.refresh
          @status_window.visible = true
        end
      when 1 # sell
        if $game_temp.shop_purchase_only
          Sound.play_buzzer
        else
          Sound.play_decision
          @command_window.active = false
          @dummy_window.visible = false
          @sell_window.active = true
          @sell_window.visible = true
          @sell_window.refresh
        end
      when 2 # Quit
        Sound.play_decision
        $scene = Scene_Map.new
      end
    end
  end
end
#END OF SCRIPT

Credit


  • Enelvon, for coding.
  • Seiryuki, for concept, coding assistance.

Thanks

Thanks to Enelvon (rpgmakervx.net) for the prompt assistance in getting my idea into code.

Support


Send me a PM and I'll try my best to assist.

Known Compatibility Issues

This code should be compatible with scripts that do not modify the command window for Scene_Shop. I haven't tested this script with any custom shop scripts.

Demo


I see no need to release a demo as the script is really easy to setup and use. However, if problems occur and a demo is needed, I will do up one.

Author's Notes


Do not forget that you can not create a shop without entering at least one item to be sold by the shop, even if the shop would not be selling anything. In any case, you would be forced to enter an item when creating the shop.

Restrictions

Do not post this script in any other forum. If you must share the script, link to this topic or to the one at this link: http://www.rpgmakervx.net/index.php?showtopic=45007
If using this script in either commercial games, please credit Enelvon and Seiryuki.
Feel free to modify the code if you got ideas; but I'd love to see it so post it here.
« Last Edit: April 30, 2011, 10:18:20 PM by Seiryuki »

*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
2014 Queen of RMRKProject of the Year 20142014 Best RPG Maker User - Story2011 Best Newbie2014 Kindest Member2014 Best RPG Maker User - Creativity2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
Great job! +rep

I tested it out and it works wells! Very easy to use. :)
« Last Edit: April 30, 2011, 09:33:04 PM by yuyubabe »
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
A very neat idea for a simple script. Nice job.
I was gonna make this script, actually. Great.
it's like a metaphor or something i don't know