Project1
标题:
关于物品存储脚本。会改的帮下。
[打印本页]
作者:
419878
时间:
2009-8-21 02:57
提示:
作者被禁止或删除 内容自动屏蔽
作者:
419878
时间:
2009-8-21 21:09
提示:
作者被禁止或删除 内容自动屏蔽
作者:
越前リョーマ
时间:
2009-8-21 23:06
物品仓库脚本有两个,你这个是柳柳的?
我用的是另外一个,那个取的时候可以输入数字,要免费的话把价格改成0,具体哪改可以在脚本中搜索一下那个价格的数字(比如价格是1,你搜索1),然后自己分辨一下是不是,是的话就改成0。(分辨不出的话可以多试试)
作者:
「旅」
时间:
2009-8-23 20:56
class Window_ShopStatus_Vb < Window_Base
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 202, 32, "")
self.contents.draw_text(0, 34, 202, 32, "")
end
end
class Window_ShopCommand_Vb < Window_Selectable_Vb
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["存入物品", "取出物品", " 离开"]
refresh
self.index = 0
end
end
class Scene_Shop_Vb
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.visible = true
@status_window.item = nil
# 删除帮助文本
@help_window.set_text("")
return
end
# 按下 C 键的情况下
if Input.repeat?(Input::C)
# 获取物品
@item = @sell_window.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
# 最大卖出个数 = 物品的所持数
# 窗口状态转向个数输入模式
@sell_window.active = false
@sell_window.visible = false
@status_window.visible = true
# 卖出处理
# $game_party.lose_gold(@number_window.number)
temp = 0
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)
temp = 1
when RPG::Armor
$game_party.lose_armor(@item.id, @number_window.number)
temp = 2
end
# 刷新各窗口
goods_del(temp,@item.id,-@number_window.number)
@buy_window = Window_ShopBuy_Vb.new($game_system.goods[@shop_now])
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
# 窗口状态转向卖出模式
@sell_window.active = true
@sell_window.visible = true
end
end
def update_buy
# 设置状态窗口的物品
@status_window.item = @buy_window.item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 窗口状态转向初期模式
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = true
@status_window.item = nil
# 删除帮助文本
@help_window.set_text("")
return
end
# 按下 C 键的情况下
if Input.repeat?(Input::C)
# 获取物品
@item = @buy_window.item
# 物品无效的情况下、或者价格在所持金以上的情况下
if @item == nil# or @item.price > $game_party.gold
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 获取物品所持数
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
# 如果已经拥有了 99 个情况下
if number == 99
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 计算可以最多购买的数量
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [[max, 99 - number].min,@buy_window.item_number].min
# 窗口状态转向数值输入模式
@buy_window.active = false
@buy_window.visible = false
# 购买处理
temp = 0
case @item
when RPG::Item
$game_party.gain_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.gain_weapon(@item.id, @number_window.number)
temp = 1
when RPG::Armor
$game_party.gain_armor(@item.id, @number_window.number)
temp = 2
end
goods_del(temp,@item.id,@number_window.number)
# 刷新各窗口
@buy_window = Window_ShopBuy_Vb.new($game_system.goods[@shop_now])
@buy_window.help_window = @help_window
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
# 窗口状态转向购买模式
@buy_window.active = true
@buy_window.visible = true
end
end
end
复制代码
放到Main脚本前,不需删除原脚本。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1