设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索

装备为空 时候装备脚本出错!!

查看数: 3548 | 评论数: 9 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2013-2-10 17:25

正文摘要:

RUBY 代码复制#==============================================================================# ■ Window_Item#------------------------------------------------------------------- ...

回复

[email protected] 发表于 2013-2-10 17:54:28
再弱弱的问一句!认可在哪点啊!其实是这一句错了,#   @actor = actor 上面显示的不对
[email protected] 发表于 2013-2-10 17:51:27
[email protected] 发表于 2013-2-10 17:45
这里出错啦!!

太谢谢了,小白真是感激不尽!!!
芯☆淡茹水 发表于 2013-2-10 17:49:22
本帖最后由 芯☆淡茹水 于 2013-2-10 17:50 编辑

不会吧,我用新工程试验完全没问题啊
再试试
  1. #==============================================================================
  2. # ■ Window_EquipRight
  3. #------------------------------------------------------------------------------
  4. #  装备画面、显示角色现在装备的物品的窗口。
  5. #==============================================================================

  6. class Window_EquipRight < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor : 角色
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor)
  12.     super(250, 64, 368, 192)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  15.     refresh
  16.     self.index = 0
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 获取物品
  20.   #--------------------------------------------------------------------------
  21.   def item
  22.     return @data[self.index]
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.   def refresh
  28.     self.contents.clear
  29.     @data = []
  30.     @data.push($data_weapons[@actor.weapon_id])
  31.     @data.push($data_armors[@actor.armor1_id])
  32.     @data.push($data_armors[@actor.armor2_id])
  33.     @data.push($data_armors[@actor.armor3_id])
  34.     @data.push($data_armors[@actor.armor4_id])
  35.     @item_max = @data.size
  36.     self.contents.font.color = system_color
  37.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  38.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  39.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  40.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  41.     self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  42.     draw_item_name(@data[0], 50, 32 * 0)
  43.     draw_item_name(@data[1], 92, 32 * 1)
  44.     draw_item_name(@data[2], 92, 32 * 2)
  45.     draw_item_name(@data[3], 92, 32 * 3)
  46.     draw_item_name(@data[4], 92, 32 * 4)
  47.     # 添加空白
  48.     @data.push(nil)
  49.     # 生成位图、描绘全部项目
  50.     @item_max = @data.size
  51.     self.contents = Bitmap.new(width - 32, row_max * 132)
  52.     for i in 0...@item_max-1
  53.       draw_item(i)
  54.     end
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 描绘项目
  58.   #     index : 项目编号
  59.   #--------------------------------------------------------------------------
  60.   def draw_item(index)
  61.     item = @data[index]
  62.     case item
  63.     when RPG::Item
  64.       number = $game_party.item_number(item.id)
  65.     when RPG::Weapon
  66.       number = $game_party.weapon_number(item.id)
  67.     when RPG::Armor
  68.       number = $game_party.armor_number(item.id)
  69.     end
  70.     if item.is_a?(RPG::Item) and
  71.        $game_party.item_can_use?(item.id)
  72.       self.contents.font.color = normal_color
  73.     else
  74.       self.contents.font.color = disabled_color
  75.     end
  76.     x = index % 4 * 50
  77.     y = index / 4 * 50
  78.     if item != nil
  79.       rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  80.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  81.       bitmap = RPG::Cache.icon(item.icon_name)
  82.       opacity = self.contents.font.color == normal_color ? 255 : 255
  83.       self.contents.blt(x, y, bitmap, Rect.new(-2, -2, 50, 100), opacity)
  84.       self.contents.draw_text(x , y , 0, 0, item.name, 0)
  85.       self.contents.draw_text(x + 15, y, 0, 0, "", 1)
  86.       self.contents.draw_text(x + 25, y + 25, 24, 24, number.to_s, 2)
  87.     end
  88.   end
  89.    #--------------------------------------------------------------------------
  90.   # ● 刷新光标矩形
  91.   #--------------------------------------------------------------------------
  92.    def page_row_max
  93.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
  94.     return self.height/ 52
  95.     end
  96.   def update_cursor_rect
  97.     if  @index < 0   
  98.       self.cursor_rect.empty
  99.       self.opacity = 0
  100.     else
  101.       @selected
  102.       self.cursor_rect.set(index % 4 * 50,index / 4 * 49- self.oy , 42, 41)
  103.     end
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● 刷新帮助文本
  107.   #--------------------------------------------------------------------------
  108.   def update_help
  109.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  110.   end
  111. end
复制代码
还是把15 行 改成:@actor = actor      不要把  refresh  删掉了

评分

参与人数 1梦石 +1 收起 理由
hys111111 + 1 认可答案

查看全部评分

芯☆淡茹水 发表于 2013-2-10 17:42:55
把 15 行 改成:@actor= actor
怎么编辑还是去不掉那些码
芯☆淡茹水 发表于 2013-2-10 17:40:46
[email protected] 发表于 2013-2-10 17:34
下面那个脚本就是啊 我重新发了一个


    脚本已改好,试试
  1. #==============================================================================
  2. # ■ Window_EquipRight
  3. #------------------------------------------------------------------------------
  4. #  装备画面、显示角色现在装备的物品的窗口。
  5. #==============================================================================

  6. class Window_EquipRight < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor : 角色
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor)
  12.     super(250, 64, 368, 192)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  15.     refresh
  16.     self.index = 0
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 获取物品
  20.   #--------------------------------------------------------------------------
  21.   def item
  22.     return @data[self.index]
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.   def refresh
  28.     self.contents.clear
  29.     @data = []
  30.     @data.push($data_weapons[@actor.weapon_id])
  31.     @data.push($data_armors[@actor.armor1_id])
  32.     @data.push($data_armors[@actor.armor2_id])
  33.     @data.push($data_armors[@actor.armor3_id])
  34.     @data.push($data_armors[@actor.armor4_id])
  35.     @item_max = @data.size
  36.     self.contents.font.color = system_color
  37.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  38.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  39.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  40.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  41.     self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  42.     draw_item_name(@data[0], 50, 32 * 0)
  43.     draw_item_name(@data[1], 92, 32 * 1)
  44.     draw_item_name(@data[2], 92, 32 * 2)
  45.     draw_item_name(@data[3], 92, 32 * 3)
  46.     draw_item_name(@data[4], 92, 32 * 4)
  47.     # 添加空白
  48.     @data.push(nil)
  49.     # 生成位图、描绘全部项目
  50.     @item_max = @data.size
  51.     self.contents = Bitmap.new(width - 32, row_max * 132)
  52.     for i in 0...@item_max-1
  53.       draw_item(i)
  54.     end
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 描绘项目
  58.   #     index : 项目编号
  59.   #--------------------------------------------------------------------------
  60.   def draw_item(index)
  61.     item = @data[index]
  62.     case item
  63.     when RPG::Item
  64.       number = $game_party.item_number(item.id)
  65.     when RPG::Weapon
  66.       number = $game_party.weapon_number(item.id)
  67.     when RPG::Armor
  68.       number = $game_party.armor_number(item.id)
  69.     end
  70.     if item.is_a?(RPG::Item) and
  71.        $game_party.item_can_use?(item.id)
  72.       self.contents.font.color = normal_color
  73.     else
  74.       self.contents.font.color = disabled_color
  75.     end
  76.     x = index % 4 * 50
  77.     y = index / 4 * 50
  78.     if item != nil
  79.       rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  80.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  81.       bitmap = RPG::Cache.icon(item.icon_name)
  82.       opacity = self.contents.font.color == normal_color ? 255 : 255
  83.       self.contents.blt(x, y, bitmap, Rect.new(-2, -2, 50, 100), opacity)
  84.       self.contents.draw_text(x , y , 0, 0, item.name, 0)
  85.       self.contents.draw_text(x + 15, y, 0, 0, "", 1)
  86.       self.contents.draw_text(x + 25, y + 25, 24, 24, number.to_s, 2)
  87.     end
  88.   end
  89.    #--------------------------------------------------------------------------
  90.   # ● 刷新光标矩形
  91.   #--------------------------------------------------------------------------
  92.    def page_row_max
  93.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
  94.     return self.height/ 52
  95.     end
  96.   def update_cursor_rect
  97.     if  @index < 0   
  98.       self.cursor_rect.empty
  99.       self.opacity = 0
  100.     else
  101.       @selected
  102.       self.cursor_rect.set(index % 4 * 50,index / 4 * 49- self.oy , 42, 41)
  103.     end
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● 刷新帮助文本
  107.   #--------------------------------------------------------------------------
  108.   def update_help
  109.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  110.   end
  111. end
复制代码
[email protected] 发表于 2013-2-10 17:34:26
芯☆淡茹水 发表于 2013-2-10 17:32
LZ 应该把 window_equipright 的脚本发上来,而不是上面的,window_item

下面那个脚本就是啊 我重新发了一个
芯☆淡茹水 发表于 2013-2-10 17:32:30
LZ 应该把 window_equipright 的脚本发上来,而不是上面的,window_item
[email protected] 发表于 2013-2-10 17:29:47
  1. #==============================================================================
  2. # ■ Window_EquipRight
  3. #------------------------------------------------------------------------------
  4. #  装备画面、显示角色现在装备的物品的窗口。
  5. #==============================================================================

  6. class Window_EquipRight < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor : 角色
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor)
  12.     super(250, 64, 368, 192)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  15.     refresh
  16.     self.index = 0
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 获取物品
  20.   #--------------------------------------------------------------------------
  21.   def item
  22.     return @data[self.index]
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.   def refresh
  28.     self.contents.clear
  29.     @data = []
  30.     @data.push($data_weapons[@actor.weapon_id])
  31.     @data.push($data_armors[@actor.armor1_id])
  32.     @data.push($data_armors[@actor.armor2_id])
  33.     @data.push($data_armors[@actor.armor3_id])
  34.     @data.push($data_armors[@actor.armor4_id])
  35.     @item_max = @data.size
  36.     self.contents.font.color = system_color
  37.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  38.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  39.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  40.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  41.     self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  42.     draw_item_name(@data[0], 50, 32 * 0)
  43.     draw_item_name(@data[1], 92, 32 * 1)
  44.     draw_item_name(@data[2], 92, 32 * 2)
  45.     draw_item_name(@data[3], 92, 32 * 3)
  46.     draw_item_name(@data[4], 92, 32 * 4)
  47.     # 添加空白
  48.     @data.push(nil)
  49.     # 生成位图、描绘全部项目
  50.     @item_max = @data.size
  51.     self.contents = Bitmap.new(width - 32, row_max * 132)
  52.     for i in 0...@item_max-1
  53.       draw_item(i)
  54.     end
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 描绘项目
  58.   #     index : 项目编号
  59.   #--------------------------------------------------------------------------
  60.   def draw_item(index)
  61.     item = @data[index]
  62.     case item
  63.     when RPG::Item
  64.       number = $game_party.item_number(item.id)
  65.     when RPG::Weapon
  66.       number = $game_party.weapon_number(item.id)
  67.     when RPG::Armor
  68.       number = $game_party.armor_number(item.id)
  69.     end
  70.     if item.is_a?(RPG::Item) and
  71.        $game_party.item_can_use?(item.id)
  72.       self.contents.font.color = normal_color
  73.     else
  74.       self.contents.font.color = disabled_color
  75.     end
  76.     x = index % 4 * 50
  77.     y = index / 4 * 50
  78.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  79.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  80.     bitmap = RPG::Cache.icon(item.icon_name)
  81.     opacity = self.contents.font.color == normal_color ? 255 : 255
  82.     self.contents.blt(x, y, bitmap, Rect.new(-2, -2, 50, 100), opacity)
  83.     self.contents.draw_text(x , y , 0, 0, item.name, 0)
  84.     self.contents.draw_text(x + 15, y, 0, 0, "", 1)
  85.     self.contents.draw_text(x + 25, y + 25, 24, 24, number.to_s, 2)
  86.   end
  87.    #--------------------------------------------------------------------------
  88.   # ● 刷新光标矩形
  89.   #--------------------------------------------------------------------------
  90.    def page_row_max
  91.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
  92.     return self.height/ 52
  93.     end
  94.   def update_cursor_rect
  95.     if  @index < 0   
  96.       self.cursor_rect.empty
  97.       self.opacity = 0
  98.     else
  99.       @selected
  100.       self.cursor_rect.set(index % 4 * 50,index / 4 * 49- self.oy , 42, 41)
  101.     end
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 刷新帮助文本
  105.   #--------------------------------------------------------------------------
  106.   def update_help
  107.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  108.   end
  109. end
复制代码
是这个不好意思呵呵
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-6-27 10:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表