03-05-2007, 01:00 PM
Leon Blade's Shop Enhancers
BY Leon Blade
Mar 5 2007
Hello again, here is the list of script and addons I am including in this post.
-Sell Shop(No SDK Required)
-Free Buy(Explained Below)
The sell shop is a very small feature which you call up by using this code.
$scene = Scene_Sell_Shop.new
Here is the window you will need to addon somewhere above the main script.
And here is the main scene, not very much of a hassle so no credit required just leave my name in the script comments.
Thanks for reading and I also need more shop ideas just post some here and Ill get right on it.
-Leon Blade-
BY Leon Blade
Mar 5 2007
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Hello again, here is the list of script and addons I am including in this post.
-Sell Shop(No SDK Required)
-Free Buy(Explained Below)
The sell shop is a very small feature which you call up by using this code.
$scene = Scene_Sell_Shop.new
Here is the window you will need to addon somewhere above the main script.
Shop Command 2
Code:
#==============================================================================
# ■ Window_ShopCommand
#------------------------------------------------------------------------------
# Goes with my (Leon Blade's) Sell Shop
#==============================================================================
class Window_ShopCommand2 < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Shop Commands" window font
self.contents.font.size = $defaultfontsize
@item_max = 2
@column_max = 2
@commands = ["Sell", "Leave"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index * 240
self.contents.draw_text(x, 0, 128, 32, @commands[index])
end
end
And here is the main scene, not very much of a hassle so no credit required just leave my name in the script comments.
Scene_Sell_Shop
Code:
#==============================================================================
# ■ Scene_Shop
#------------------------------------------------------------------------------
# Not very hard, you can still give me some credit right?
#
# Leon Blade
#==============================================================================
class Scene_Sell_Shop
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# ヘルプウィンドウを作成
@help_window = Window_Help.new
# コマンドウィンドウを作成
@command_window = Window_ShopCommand2.new
# ゴールドウィンドウを作成
@gold_window = Window_Gold.new
@gold_window.x = 480
@gold_window.y = 64
# ダミーウィンドウを作成
@dummy_window = Window_Base.new(0, 128, 640, 352)
# 売却ウィンドウを作成
@sell_window = Window_ShopSell.new
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
# 個数入力ウィンドウを作成
@number_window = Window_ShopNumber.new
@number_window.active = false
@number_window.visible = false
# ステータスウィンドウを作成
@status_window = Window_ShopStatus.new
@status_window.visible = false
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@dummy_window.dispose
@sell_window.dispose
@number_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@sell_window.update
@number_window.update
@status_window.update
# コマンドウィンドウがアクティブの場合: update_command を呼ぶ
if @command_window.active
update_command
return
end
# 売却ウィンドウがアクティブの場合: update_sell を呼ぶ
if @sell_window.active
update_sell
return
end
# 個数入力ウィンドウがアクティブの場合: update_number を呼ぶ
if @number_window.active
update_number
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_command
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 0 # 売却する
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# ウィンドウの状態を売却モードへ
@command_window.active = false
@dummy_window.visible = false
@sell_window.active = true
@sell_window.visible = true
@sell_window.refresh
when 1 # やめる
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# マップ画面に切り替え
$scene = Scene_Map.new
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (売却ウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_sell
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# ウィンドウの状態を初期モードへ
@command_window.active = true
@dummy_window.visible = true
@sell_window.active = false
@sell_window.visible = false
@status_window.item = nil
# ヘルプテキストを消去
@help_window.set_text("")
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムを取得
@item = @sell_window.item
# ステータスウィンドウのアイテムを設定
@status_window.item = @item
# アイテムが無効の場合、または価格が 0 (売却不可) の場合
if @item == nil or @item.price == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アイテムの所持数を取得
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# 最大売却個数 = アイテムの所持数
max = number
# ウィンドウの状態を個数入力モードへ
@sell_window.active = false
@sell_window.visible = false
@number_window.set(@item, max, @item.price / 2)
@number_window.active = true
@number_window.visible = true
@status_window.visible = true
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (個数入力ウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_number
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# 個数入力ウィンドウを非アクティブ・不可視に設定
@number_window.active = false
@number_window.visible = false
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 0 # 売却する
# ウィンドウの状態を売却モードへ
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# ショップ SE を演奏
$game_system.se_play($data_system.shop_se)
# 個数入力ウィンドウを非アクティブ・不可視に設定
@number_window.active = false
@number_window.visible = false
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 0 # 売却する
# 売却処理
$game_party.gain_gold(@number_window.number * (@item.price / 2))
case @item
when RPG::Item
$game_party.lose_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.lose_weapon(@item.id, @number_window.number)
when RPG::Armor
$game_party.lose_armor(@item.id, @number_window.number)
end
# 各ウィンドウをリフレッシュ
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
# ウィンドウの状態を売却モードへ
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
return
end
end
end
Thanks for reading and I also need more shop ideas just post some here and Ill get right on it.
-Leon Blade-