Project1
标题:
如何设置两类商店
[打印本页]
作者:
yhyh0910
时间:
2007-8-4 19:56
提示:
作者被禁止或删除 内容自动屏蔽
作者:
yhyh0910
时间:
2007-8-4 19:56
提示:
作者被禁止或删除 内容自动屏蔽
作者:
jy02590143
时间:
2007-8-4 20:07
建议,使用柳柳的“真实商店脚本”,自己设制。
作者:
yhyh0910
时间:
2007-8-4 20:10
提示:
作者被禁止或删除 内容自动屏蔽
作者:
K’
时间:
2007-8-4 21:42
########################################################
=begin
作用 :只能卖出指定类型的商店。
物品类型的定义: 在物品说明后面加上 @真实 或者 @虚幻
每次商店处理前令1号变量等于 0 1 或者 2
0 : 可以卖出所有物品
1 : 只能卖出 @真实 的物品
2 : 只能卖出 @虚幻 的物品
修改的地方话 搜索 #kk
=end
#########################################################
#==============================================================================
# ■ RPG原装定义
#==============================================================================
module RPG
class Item
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def k_kind
k_kind = @description.split(/@/)[1]
return k_kind != nil ? k_kind : ''
end
end
class Weapon
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def k_kind
k_kind = @description.split(/@/)[1]
return k_kind != nil ? k_kind : ''
end
end
class Armor
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def k_kind
k_kind = @description.split(/@/)[1]
return k_kind != nil ? k_kind : ''
end
end
end
class Window_ShopSell < Window_Selectable
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目标号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
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
# 可以卖掉的显示为普通文字颜色、除此之外设置成无效文字颜色
if item.price > 0
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
#kk-----------------------------------------------------
case $game_variables[1]
when 1
self.contents.font.color = disabled_color if item.k_kind != "真实"
when 2
self.contents.font.color = disabled_color if item.k_kind != "虚幻"
end
#kk-----------------------------------------------------
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
class Scene_Shop
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 (不能卖出) 的情况下
#kk----------------------------------------------------------
if @item == nil or @item.price == 0 or ($game_variables[1] == 1 and @item.k_kind != "真实" ) or ($game_variables[1] == 2 and @item.k_kind != "虚幻")
#kk----------------------------------------------------------
# 演奏冻结 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
end
复制代码
使用方法见开头帮助。 [LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者:
yhyh0910
时间:
2007-8-4 22:18
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1