查看: 2494|回复: 2

[已经解决] 背包容量限制和金钱物品提示脚本冲突该怎么解决

[复制链接]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2014-11-27 21:05:03 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
背包脚本放上面的时候得到物品不提示了。
背包脚本放下面的时候背包脚本不起作用了。


[pre lang="ruby" line="1"]#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================  
# 注意!!!在对话后得到物品,请在对话后先用事件等待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..10
        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..10
        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..10
        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..10
        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
  
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================[/pre]


[pre lang="ruby" line="1"]#==============================================================================
# 背包可容纳最大的物品种类数。(包括物品,武器,防具)
ITEMS_MAX = 2
# 背包满后,如果再增加物品所提示的信息。
TOP_MESSAGE = "背包已满!"
#==============================================================================
class Game_Party
  #---------------------------------------------------------------------
  def items
    return @items
  end
  #---------------------------------------------------------------------
  def weapons
    return @weapons
  end
  #---------------------------------------------------------------------
  def armors
    return @armors
  end
end
#==============================================================================
class Interpreter
  #--------------------------------------------------------------------
  def full_judge?(id, n, type)
    mn = 0
    mn += $game_party.items.keys.size
    mn += $game_party.weapons.keys.size
    mn += $game_party.armors.keys.size
    return false if mn < ITEMS_MAX
    case type
    when 0
      if $game_party.items.keys.include?(id)
        return false if $game_party.item_number(id) + n <= 99
      end
    when 1
      if $game_party.weapons.keys.include?(id)
        return false if $game_party.weapon_number(id) + n <= 99
      end
    when 2
      if $game_party.armors.keys.include?(id)
        return false if $game_party.armor_number(id) + n <= 99
      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.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
  end
  #--------------------------------------------------------------------------
  # ● 增减物品
  #--------------------------------------------------------------------------
  def command_126
    # 获取要操作的值
    value = operate_value(@parameters[1], @parameters[2], @parameters[3])
    if full_judge?(@parameters[0], value, 0)
      full_top
      command_115
      return
    end
    # 增减物品
    $game_party.gain_item(@parameters[0], value)
    # 继续
    return true
  end
  #--------------------------------------------------------------------------
  # ● 增减武器
  #--------------------------------------------------------------------------
  def command_127
    # 获取要操作的值
    value = operate_value(@parameters[1], @parameters[2], @parameters[3])
    if full_judge?(@parameters[0], value, 1)
      full_top
      command_115
      return
    end
    # 增减武器
    $game_party.gain_weapon(@parameters[0], value)
    # 继续
    return true
  end
  #--------------------------------------------------------------------------
  # ● 增减防具
  #--------------------------------------------------------------------------
  def command_128
    # 获取要操作的值
    value = operate_value(@parameters[1], @parameters[2], @parameters[3])
    if full_judge?(@parameters[0], value, 2)
      full_top
      command_115
      return
    end
    # 增减防具
    $game_party.gain_armor(@parameters[0], value)
    # 继续
    return true
  end
end
#==============================================================================[/pre]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

 楼主| 发表于 2014-11-29 22:14:10 | 显示全部楼层
我自己搞定了,其实挺简单的

点评

两个脚本可以合并成一个脚本  发表于 2014-11-29 22:14
回复

使用道具 举报

梦石
0
星屑
65
在线时间
232 小时
注册时间
2014-8-1
回帖
131

开拓者

发表于 2015-1-27 21:33:20 | 显示全部楼层
yang1zhi 发表于 2014-11-29 22:14
我自己搞定了,其实挺简单的

我合起来了也不会显示获得物品啊!求解

点评

不是直接合在一起。要把重复的地方删掉。  发表于 2015-6-26 16:50
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部