04-04-2022, 10:46 AM
(This post was last modified: 04-04-2022, 10:59 AM by Kain Nobel.)
Shop : Command Help
Version: 3.5
Version: 3.5
Written by Kain Nobel
Introduction
This is a system which adds help messages to the Buy, Sell and Exit commands.
Features
- Custom "Buy" message.
- Custom "Sell" message.
- Custom "Exit" message.
Script
SDK Complaint
Code:
#===============================================================================
# ** Shop : Command Help
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
SDK.log('Shop.CommandHelp', 'Kain Nobel ©', 3.5, '2009.09.09')
#-------------------------------------------------------------------------------
# * SDK Enabled Test : Begin
#-------------------------------------------------------------------------------
if SDK.enabled?('Shop.CommandHelp')
#===============================================================================
# ** Scene_Shop
#===============================================================================
class Scene_Shop
#-----------------------------------------------------------------------------
# * Help Text for Making Purchases
#-----------------------------------------------------------------------------
HelpBuy = {
:itm => 'We\'ve got all your general goods, potions \'n such...',
:arm => 'Needing to suit up? You\'ll find something heavy around here...',
:wpn => 'Got somebody or something to kill? You\'ve come to the right place!',
:itm2 => 'Take what you can! All items are free!',
:arm2 => 'Take what you can! All armors are free!',
:wpn2 => 'Take what you can! All weapons are free!'
}
HelpBuy.default = 'Welcome, would you like to look at our goods?'
#-----------------------------------------------------------------------------
# * Help Text for Selling Goods
#-----------------------------------------------------------------------------
HelpSell = {
:itm => 'Although we only sell items, we\'ll buy your weapons and armors.',
:arm => 'Sure, we\'re an armor shop, but we\'ll buy your other goods too!',
:wpn => 'Even though we sell weapons, we buy anything you throw at us.',
:itm2 => 'You can leave it here, but you won\'t get any money for it...',
:arm2 => 'You can leave it here, but you won\'t get any money for it...',
:wpn2 => 'You can leave it here, but you won\'t get any money for it...'
}
HelpSell.default = 'Yes, we buy too! You got something to trade in?'
#-----------------------------------------------------------------------------
# * Help Text for Leaving Shop
#-----------------------------------------------------------------------------
HelpExit = {
:itm => 'Stocked up on Potions already? Don\'t use them all in one place...',
:arm => 'You look heavier already! Be safe dude, try not to get hurt!',
:wpn => 'If you cause trouble with that thing, don\'t tell \'em you got it here!',
:itm2 => 'Hurry along!!!',
:arm2 => 'Hurry along!!!',
:wpn2 => 'Hurry along!!!'
}
HelpExit.default = 'Leaving already? Thank you, come again soon!'
end
#===============================================================================
# ** Game_Temp
#===============================================================================
class Game_Temp
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :shop_help_id # Used for setting modes
attr_accessor :shop_help_buy # Used for help text when buying
attr_accessor :shop_help_sell # Used for help text when selling
attr_accessor :shop_sell_exit # Used for help text when exiting
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :shophelptext_gmtemp_initialize, :initialize
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
shophelptext_gmtemp_initialize
shop_reset_help
end
#-----------------------------------------------------------------------------
# * Shop Help?
#-----------------------------------------------------------------------------
def shop_help?(command)
help_text = case command
when 0, SDK::Scene_Commands::Scene_Shop::Buy then @shop_help_buy
when 1, SDK::Scene_Commands::Scene_Shop::Sell then @shop_help_sell
when 2, SDK::Scene_Commands::Scene_Shop::Exit then @shop_help_exit
else ; ''
end
(help_text.nil? ? '' : help_text)
end
#-----------------------------------------------------------------------------
# * Shop Help ID = (id)
#-----------------------------------------------------------------------------
def shop_help_id=(id)
shop_reset_help(id)
end
#-----------------------------------------------------------------------------
# * Shop Reset Help
#-----------------------------------------------------------------------------
def shop_reset_help(id = nil)
# Reset help ID
@shop_help_id = id
# Reset help text
@shop_help_buy = Scene_Shop::HelpBuy[@shop_help_id]
@shop_help_sell = Scene_Shop::HelpSell[@shop_help_id]
@shop_help_exit = Scene_Shop::HelpExit[@shop_help_id]
end
end
#===============================================================================
# ** Scene_Shop
#===============================================================================
class Scene_Shop
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :shophelptext_snshop_main, :main
alias_method :shophelptext_snshop_updatecommand, :update_command
#-----------------------------------------------------------------------------
# * Main
#-----------------------------------------------------------------------------
def main
# The usual
shophelptext_snshop_main
# Reset
$game_temp.shop_reset_help
end
#-----------------------------------------------------------------------------
# * Update Command
#-----------------------------------------------------------------------------
def update_command
# The usual
shophelptext_snshop_updatecommand
# If help window responsive
if @help_window.respond_to?(:set_text)
# Set help text
help_text = @command_window.command
help_text = $game_temp.shop_help?(help_text)
@help_window.set_text(help_text, 1)
end
end
end
#-------------------------------------------------------------------------------
# * SDK Enabled Test : End
#-------------------------------------------------------------------------------
end
Non-SDK Complaint
Code:
# Non SDK Version
#===============================================================================
# ** Shop : Command Help
#===============================================================================
class Scene_Shop
#-----------------------------------------------------------------------------
# * Help Text for Making Purchases
#-----------------------------------------------------------------------------
HelpBuy = {
:itm => 'We\'ve got all your general goods, potions and breads \'n such...',
:arm => 'Needing to suit up? You\'ll find something heavy around here...',
:wpn => 'Got somebody or something to kill? You\'ve come to the right place!'
}
HelpBuy.default = 'Welcome, would you like to look at our goods?'
#-----------------------------------------------------------------------------
# * Help Text for Selling Goods
#-----------------------------------------------------------------------------
HelpSell = {
:itm => 'Although we only sell items, we\'ll buy your weapons and armors.',
:arm => 'Sure, we\'re an armor shop, but we\'ll buy your other goods too!',
:wpn => 'Even though we sell weapons, we buy anything you throw at us.'
}
HelpSell.default = 'Yes, we buy too! You got something to trade in?'
#-----------------------------------------------------------------------------
# * Help Text for Leaving Shop
#-----------------------------------------------------------------------------
HelpExit = {
:itm => 'Stocked up on Potions already? Don\'t use them all in one place...',
:arm => 'You look heavier already! Be safe dude, try not to get hurt!',
:wpn => 'If you cause trouble with that thing, don\'t tell \'em you got it here!'
}
HelpExit.default = 'Leaving already? Thank you, come again soon!'
end
#===============================================================================
# ** Game_Temp
#===============================================================================
class Game_Temp
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :shop_help_id # Used for setting modes
attr_accessor :shop_help_buy # Used for help text when buying
attr_accessor :shop_help_sell # Used for help text when selling
attr_accessor :shop_sell_exit # Used for help text when exiting
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :shophelptext_gmtemp_initialize, :initialize
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
shophelptext_gmtemp_initialize
shop_reset_help
end
#-----------------------------------------------------------------------------
# * Shop Help?
#-----------------------------------------------------------------------------
def shop_help?(index)
help_text = case index
when 0 then @shop_help_buy
when 1 then @shop_help_sell
when 2 then @shop_help_exit
else ; ''
end
(help_text.nil? ? '' : help_text)
end
#-----------------------------------------------------------------------------
# * Shop Help ID = (id)
#-----------------------------------------------------------------------------
def shop_help_id=(id)
shop_reset_help(id)
end
#-----------------------------------------------------------------------------
# * Shop Reset Help
#-----------------------------------------------------------------------------
def shop_reset_help(id = nil)
@shop_help_id = id
@shop_help_buy = Scene_Shop::HelpBuy[@shop_help_id]
@shop_help_sell = Scene_Shop::HelpSell[@shop_help_id]
@shop_help_exit = Scene_Shop::HelpExit[@shop_help_id]
end
end
#===============================================================================
# ** Scene_Shop
#===============================================================================
class Scene_Shop
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :shophelptext_snshop_main, :main
alias_method :shophelptext_snshop_updatecommand, :update_command
#-----------------------------------------------------------------------------
# * Main
#-----------------------------------------------------------------------------
def main
shophelptext_snshop_main
$game_temp.shop_reset_help
end
#-----------------------------------------------------------------------------
# * Update Command
#-----------------------------------------------------------------------------
def update_command
shophelptext_snshop_updatecommand
if @help_window.respond_to?(:set_text)
help_text = @command_window.index
help_text = $game_temp.shop_help?(help_text)
@help_window.set_text(help_text, 1)
end
end
end
Instructions
Place below Main or anything that modifies the Shop system.
Compatibility
System was written for RMXP, not tested in other 'Makers'.
Something tells me this should work in VX or VX Ace (non-SDK version), but I never tested that theory. If you try it and it works, PM me and I'll update the topic
Author's Notes
To use the system, put a call script in before you call your shop.
Code:
$game_temp.shop_help_id = VALUE
The VALUE can be anything, be it a Symbol, a String, an Integer, so long as it's a proper setting within your hash.
Once the shop closes, the value should be cleared so you don't have to worry about setting it back to nil.
I might update this script one day to have a better configuration, but for now WYSIWYG.
Terms and Conditions
Free to use in commercial and non-commercial games. Credits much appreciated but optional.