Project1
标题:
求一个调整卖价的商店
[打印本页]
作者:
qknight
时间:
2014-3-20 12:15
标题:
求一个调整卖价的商店
本帖最后由 qknight 于 2014-3-20 17:42 编辑
系统默认商店只能调整买价但不能调整卖价呢,求如何也能自由调整卖价使得玩家只有在指定的商店出售物品才能卖出高价……求个这样的脚本,毕竟买卖东西多了用分歧条件就太麻烦了
作者:
喵呜喵5
时间:
2014-3-20 13:16
=begin
===============================================================================
高价回收物品的商店 By喵呜喵5
===============================================================================
【说明】
指定的开关打开时,事件指令中的商店处理会进入特定的物品回收商店
在物品回收商店中无法购买物品,只能贩卖物品
物品的售价则为商店处理中设置的物品价格(而非数据库中设置的价格)
=end
$m5script = {} if $m5script.nil?
$m5script["M5SellShop"] = true
module M5SellShop
#==============================================================================
# 设定部分
#==============================================================================
SWI = 1
#这里设置一个开关ID,当开关打开时使用商店处理将进入物品回收商店
LIMIT = true # true / false
#设置为false时,在物品回收商店也能以正常价格(原价除2)贩卖没有设置价格的物品
#==============================================================================
# 设定结束
#==============================================================================
#==============================================================================
# 脚本部分
#==============================================================================
end
class Game_Interpreter
alias m5_20140320_command_302 command_302
def command_302
if !$game_switches[M5SellShop::SWI]
m5_20140320_command_302
else
return if $game_party.in_battle
goods = [@params]
while next_event_code == 605
[url=home.php?mod=space&uid=370741]@Index[/url] += 1
goods.push(@list[@index].parameters)
end
SceneManager.call(Scene_M5SellShop)
SceneManager.scene.prepare(goods, @params[4])
Fiber.yield
end
end
end
class Window_M5SellShopCommand < Window_ShopCommand
def col_max
return 2
end
def make_command_list
add_command(Vocab::ShopSell, :sell)
add_command(Vocab::ShopCancel, :cancel)
end
end
class Window_M5SellShop < Window_ShopSell
def initialize(x, y, width, height,shop_goods)
super(x, y, width, height)
@shop_goods = shop_goods
end
def make_item_list
@data = []
@price = {}
@shop_goods.each do |goods|
case goods[0]
when 0; item = $data_items[goods[1]]
when 1; item = $data_weapons[goods[1]]
when 2; item = $data_armors[goods[1]]
end
if item
@data.push(item)
@price[item] = goods[2] == 0 ? item.price : goods[3]
end
end
@data = @data.select {|item| include?(item) }
@data.push(nil) if include?(nil)
end
end
class Scene_M5SellShop < Scene_Shop
def prepare(goods, purchase_only)
super(goods, false)
end
def create_command_window
@command_window = Window_M5SellShopCommand.new(@gold_window.x, @purchase_only)
@command_window.viewport = @viewport
@command_window.y = @help_window.height
@command_window.set_handler(:sell, method(:command_sell))
@command_window.set_handler(:cancel, method(:return_scene))
end
def create_sell_window
wy = @category_window.y + @category_window.height
wh = Graphics.height - wy
if M5SellShop::LIMIT
@sell_window = Window_M5SellShop.new(0, wy, Graphics.width, wh, @goods)
else
@sell_window = Window_ShopSell.new(0, wy, Graphics.width, wh)
end
@sell_window.viewport = @viewport
@sell_window.help_window = @help_window
@sell_window.hide
@sell_window.set_handler(:ok, method(:on_sell_ok))
@sell_window.set_handler(:cancel, method(:on_sell_cancel))
@category_window.item_window = @sell_window
end
def selling_price
return buying_price if buying_price
super
end
end
复制代码
作者:
qknight
时间:
2014-3-20 17:38
本帖最后由 qknight 于 2014-3-20 17:42 编辑
喵呜喵5 发表于 2014-3-20 13:16
已经没问题了,感谢老师的指点
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1