赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 6924 |
最后登录 | 2019-3-9 |
在线时间 | 124 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 64
- 在线时间
- 124 小时
- 注册时间
- 2015-1-30
- 帖子
- 61
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
RT,哪个放前面哪个没用。搜到以前有过个一模一样的帖子,可楼主自己解决了,还不说他是如何解决的。
#============================================================================== # 背包可容纳最大的物品种类数。(包括物品,武器,防具) ITEMS_MAX = 30 # 背包满后,如果再增加物品所提示的信息。 TOP_MESSAGE = "背包已满!" #============================================================================== class Game_Party #-------------------------------------------------------------------- def full_judge?(id, n, type) mn = 0 @items.keys.each{|i| mn += 1 if item_number(i) > 0} @weapons.keys.each{|i| mn += 1 if weapon_number(i) > 0} @armors.keys.each{|i| mn += 1 if armor_number(i) > 0} return false if mn < ITEMS_MAX case type when 0 if @items.keys.include?(id) and item_number(id) > 0 return false if item_number(id) + n <= 30 end when 1 if @weapons.keys.include?(id) and weapon_number(id) > 0 return false if weapon_number(id) + n <= 30 end when 2 if @armors.keys.include?(id) and armor_number(id) > 0 return false if armor_number(id) + n <= 30 end end return true end #--------------------------------------------------------------------- def full_top $game_system.se_play($data_system.buzzer_se) top = Window_Base.new(200, 100, 240, 64) top.z = 999 top.contents = Bitmap.new(top.width - 32, top.height - 32) top.contents.draw_text(0, 0, 200, 32, TOP_MESSAGE, 1) for i in 1..30 Graphics.update end for i in 1..20 top.opacity -= 13 top.contents_opacity -= 13 Graphics.update end top.dispose $judges=true end #-------------------------------------------------------------------------- def gain_item(item_id, n) # 更新 hash 的个数数据 if item_id > 0 if n > 0 and full_judge?(item_id, n, 0) full_top return end @items[item_id] = [[item_number(item_id) + n, 0].max, 30].min end end #-------------------------------------------------------------------------- # ● 增加武器 (减少) # weapon_id : 武器 ID # n : 个数 #-------------------------------------------------------------------------- def gain_weapon(weapon_id, n) # 更新 hash 的个数数据 if weapon_id > 0 if n > 0 and full_judge?(weapon_id, n, 1) full_top return end @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 30].min end end #-------------------------------------------------------------------------- # ● 增加防具 (减少) # armor_id : 防具 ID # n : 个数 #-------------------------------------------------------------------------- def gain_armor(armor_id, n) # 更新 hash 的个数数据 if armor_id > 0 if n > 0 and full_judge?(armor_id, n, 2) full_top return end @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 30].min end end end #---------------------------------------------------------------------------- class Scene_Shop #-------------------------------------------------------------------------- # ● 刷新画面 (个数输入窗口激活的情况下) #-------------------------------------------------------------------------- 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 # 购买 # 窗口状态转向购买模式 @buy_window.active = true @buy_window.visible = true when 1 # 卖出 # 窗口状态转向卖出模式 @sell_window.active = true @sell_window.visible = true @status_window.visible = false end return end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 设置个数输入窗口为不活动·非可视状态 @number_window.active = false @number_window.visible = false # 命令窗口光标位置分支 case @command_window.index when 0 # 购买 type = @item.is_a?(RPG::Item) ? 0 : (@item.is_a?(RPG::Weapon) ? 1 : 2) if $game_party.full_judge?(@item.id, @number_window.number, type) $game_party.full_top @buy_window.active = true @buy_window.visible = true return end # 演奏商店 SE $game_system.se_play($data_system.shop_se) # 购买处理 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) when RPG::Armor $game_party.gain_armor(@item.id, @number_window.number) end $game_party.lose_gold(@number_window.number * @item.price) # 刷新各窗口 @gold_window.refresh @buy_window.refresh @status_window.refresh # 窗口状态转向购买模式 @buy_window.active = true @buy_window.visible = true when 1 # 卖出 # 演奏商店 SE $game_system.se_play($data_system.shop_se) # 卖出处理 $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 #==============================================================================
#==============================================================================
# 背包可容纳最大的物品种类数。(包括物品,武器,防具)
ITEMS_MAX = 30
# 背包满后,如果再增加物品所提示的信息。
TOP_MESSAGE = "背包已满!"
#==============================================================================
class Game_Party
#--------------------------------------------------------------------
def full_judge?(id, n, type)
mn = 0
@items.keys.each{|i| mn += 1 if item_number(i) > 0}
@weapons.keys.each{|i| mn += 1 if weapon_number(i) > 0}
@armors.keys.each{|i| mn += 1 if armor_number(i) > 0}
return false if mn < ITEMS_MAX
case type
when 0
if @items.keys.include?(id) and item_number(id) > 0
return false if item_number(id) + n <= 30
end
when 1
if @weapons.keys.include?(id) and weapon_number(id) > 0
return false if weapon_number(id) + n <= 30
end
when 2
if @armors.keys.include?(id) and armor_number(id) > 0
return false if armor_number(id) + n <= 30
end
end
return true
end
#---------------------------------------------------------------------
def full_top
$game_system.se_play($data_system.buzzer_se)
top = Window_Base.new(200, 100, 240, 64)
top.z = 999
top.contents = Bitmap.new(top.width - 32, top.height - 32)
top.contents.draw_text(0, 0, 200, 32, TOP_MESSAGE, 1)
for i in 1..30
Graphics.update
end
for i in 1..20
top.opacity -= 13
top.contents_opacity -= 13
Graphics.update
end
top.dispose
$judges=true
end
#--------------------------------------------------------------------------
def gain_item(item_id, n)
# 更新 hash 的个数数据
if item_id > 0
if n > 0 and full_judge?(item_id, n, 0)
full_top
return
end
@items[item_id] = [[item_number(item_id) + n, 0].max, 30].min
end
end
#--------------------------------------------------------------------------
# ● 增加武器 (减少)
# weapon_id : 武器 ID
# n : 个数
#--------------------------------------------------------------------------
def gain_weapon(weapon_id, n)
# 更新 hash 的个数数据
if weapon_id > 0
if n > 0 and full_judge?(weapon_id, n, 1)
full_top
return
end
@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 30].min
end
end
#--------------------------------------------------------------------------
# ● 增加防具 (减少)
# armor_id : 防具 ID
# n : 个数
#--------------------------------------------------------------------------
def gain_armor(armor_id, n)
# 更新 hash 的个数数据
if armor_id > 0
if n > 0 and full_judge?(armor_id, n, 2)
full_top
return
end
@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 30].min
end
end
end
#----------------------------------------------------------------------------
class Scene_Shop
#--------------------------------------------------------------------------
# ● 刷新画面 (个数输入窗口激活的情况下)
#--------------------------------------------------------------------------
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 # 购买
# 窗口状态转向购买模式
@buy_window.active = true
@buy_window.visible = true
when 1 # 卖出
# 窗口状态转向卖出模式
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 设置个数输入窗口为不活动·非可视状态
@number_window.active = false
@number_window.visible = false
# 命令窗口光标位置分支
case @command_window.index
when 0 # 购买
type = @item.is_a?(RPG::Item) ? 0 : (@item.is_a?(RPG::Weapon) ? 1 : 2)
if $game_party.full_judge?(@item.id, @number_window.number, type)
$game_party.full_top
@buy_window.active = true
@buy_window.visible = true
return
end
# 演奏商店 SE
$game_system.se_play($data_system.shop_se)
# 购买处理
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)
when RPG::Armor
$game_party.gain_armor(@item.id, @number_window.number)
end
$game_party.lose_gold(@number_window.number * @item.price)
# 刷新各窗口
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
# 窗口状态转向购买模式
@buy_window.active = true
@buy_window.visible = true
when 1 # 卖出
# 演奏商店 SE
$game_system.se_play($data_system.shop_se)
# 卖出处理
$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
#==============================================================================
#============================================================================== # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息 #============================================================================== # 注意!!!在对话后得到物品,请在对话后先用事件等待3帧,否则对话框来不及消失。 # 开关定义: $不显示金钱窗口 = 41 $不显示物品窗口 = 42 $不显示武器窗口 = 43 $不显示防具窗口 = 44 # 以上开关,当打开的时候,获得物品将不会提示,比如默认打开41号开关,获得金钱不再提示 # ———————————————————————————————————— class Interpreter #-------------------------------------------------------------------------- # ● 增减金钱 #-------------------------------------------------------------------------- def command_125 value = operate_value(@parameters[0], @parameters[1], @parameters[2]) $game_party.gain_gold(value) if $game_switches[$不显示金钱窗口]==false carol3_66RPG = Window_Base.new((640-160)/2,128,180,100) carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32) if value >= 0 carol3_66RPG.contents.draw_text(0,0,240,32,"获得金钱:") #——声效,可以自己改 Audio.se_play("Audio/SE/"+"006-System06",80,100) else carol3_66RPG.contents.draw_text(0,0,240,32,"支付金钱:") #——声效,可以自己改 Audio.se_play("Audio/SE/"+"005-System05",80,100) end carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s) carol3_66RPG.contents.draw_text(0,32,140,32, $data_system.words.gold,2) carol3_66RPG.opacity = 160 for i in 0..30 Graphics.update end for i in 0..10 carol3_66RPG.opacity -= 30 carol3_66RPG.contents_opacity -= 30 Graphics.update end carol3_66RPG.dispose end return true end #-------------------------------------------------------------------------- # ● 增减物品 #-------------------------------------------------------------------------- def command_126 value = operate_value(@parameters[1], @parameters[2], @parameters[3]) $game_party.gain_item(@parameters[0], value) if $game_switches[$不显示物品窗口]==false carol3_66RPG_item = $data_items[@parameters[0]] carol3_66RPG = Window_Base.new((640-300)/2,128,300,100) carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32) if value >= 0 carol3_66RPG.contents.draw_text(0,0,240,32,"获得物品:") #——声效,可以自己改 Audio.se_play("Audio/SE/"+"006-System06",80,100) else carol3_66RPG.contents.draw_text(0,0,240,32,"失去物品:") #——声效,可以自己改 Audio.se_play("Audio/SE/"+"005-System05",80,100) end carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name) carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255) carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0) carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2) carol3_66RPG.opacity = 160 for i in 0..30 Graphics.update end for i in 0..10 carol3_66RPG.opacity -= 30 carol3_66RPG.contents_opacity -= 30 Graphics.update end carol3_66RPG.dispose end return true end #-------------------------------------------------------------------------- # ● 增减武器 #-------------------------------------------------------------------------- def command_127 value = operate_value(@parameters[1], @parameters[2], @parameters[3]) $game_party.gain_weapon(@parameters[0], value) if $game_switches[$不显示武器窗口]==false carol3_66RPG_item = $data_weapons[@parameters[0]] carol3_66RPG = Window_Base.new((640-300)/2,128,300,100) carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32) if value >= 0 carol3_66RPG.contents.draw_text(0,0,240,32,"获得武器:") #——声效,可以自己改 Audio.se_play("Audio/SE/"+"006-System06",80,100) else carol3_66RPG.contents.draw_text(0,0,240,32,"失去武器:") #——声效,可以自己改 Audio.se_play("Audio/SE/"+"005-System05",80,100) end carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name) carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255) carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0) carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2) carol3_66RPG.opacity = 160 for i in 0..30 Graphics.update end for i in 0..10 carol3_66RPG.opacity -= 30 carol3_66RPG.contents_opacity -= 30 Graphics.update end carol3_66RPG.dispose end return true end #-------------------------------------------------------------------------- # ● 增减防具 #-------------------------------------------------------------------------- def command_128 value = operate_value(@parameters[1], @parameters[2], @parameters[3]) $game_party.gain_armor(@parameters[0], value) if $game_switches[$不显示防具窗口]==false carol3_66RPG_item = $data_armors[@parameters[0]] carol3_66RPG = Window_Base.new((640-300)/2,128,300,100) carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32) if value >= 0 carol3_66RPG.contents.draw_text(0,0,240,32,"获得:") #——声效,可以自己改 Audio.se_play("Audio/SE/"+"006-System06",80,100) else carol3_66RPG.contents.draw_text(0,0,240,32,"失去:") #——声效,可以自己改 Audio.se_play("Audio/SE/"+"005-System05",80,100) end carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name) carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255) carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0) carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2) carol3_66RPG.opacity = 160 for i in 0..30 Graphics.update end for i in 0..10 carol3_66RPG.opacity -= 30 carol3_66RPG.contents_opacity -= 30 Graphics.update end carol3_66RPG.dispose end return true end end #============================================================================== # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息 #==============================================================================
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
# 注意!!!在对话后得到物品,请在对话后先用事件等待3帧,否则对话框来不及消失。
# 开关定义:
$不显示金钱窗口 = 41
$不显示物品窗口 = 42
$不显示武器窗口 = 43
$不显示防具窗口 = 44
# 以上开关,当打开的时候,获得物品将不会提示,比如默认打开41号开关,获得金钱不再提示
# ————————————————————————————————————
class Interpreter
#--------------------------------------------------------------------------
# ● 增减金钱
#--------------------------------------------------------------------------
def command_125
value = operate_value(@parameters[0], @parameters[1], @parameters[2])
$game_party.gain_gold(value)
if $game_switches[$不显示金钱窗口]==false
carol3_66RPG = Window_Base.new((640-160)/2,128,180,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得金钱:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"支付金钱:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)
carol3_66RPG.contents.draw_text(0,32,140,32, $data_system.words.gold,2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
#--------------------------------------------------------------------------
# ● 增减物品
#--------------------------------------------------------------------------
def command_126
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_item(@parameters[0], value)
if $game_switches[$不显示物品窗口]==false
carol3_66RPG_item = $data_items[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得物品:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去物品:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
#--------------------------------------------------------------------------
# ● 增减武器
#--------------------------------------------------------------------------
def command_127
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_weapon(@parameters[0], value)
if $game_switches[$不显示武器窗口]==false
carol3_66RPG_item = $data_weapons[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得武器:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去武器:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
#--------------------------------------------------------------------------
# ● 增减防具
#--------------------------------------------------------------------------
def command_128
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_armor(@parameters[0], value)
if $game_switches[$不显示防具窗口]==false
carol3_66RPG_item = $data_armors[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
|
|