Project1

标题: 在地图上显示等级 [打印本页]

作者: 79904396    时间: 2011-4-25 16:46
标题: 在地图上显示等级
就是需要一个小窗口,显示角色的等级
“您现在的等级为:*”
就是这样……
以前获得过一个脚本:
#==============================================================================
# ■ Window_Actorlevel
#------------------------------------------------------------------------------
#  显示角色等级的窗口。
#==============================================================================

class Window_Actorlevel < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor : 角色
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 100)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 160
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160
      draw_actor_level(actor, actor_x, 10)
    end
  end
end

class Scene_Map
  alias old_main main
  def main
    @Window_Actorlevel = Window_Actorlevel.new
    old_main
    @Window_Actorlevel.dispose
  end
end



但是这个脚本一不可以更改显示的文字“您现在的等级为……”,第二我发现即使我人物的等级变了它还是显示为1……
所以……求教新脚本或> <更正方法dsu_plus_rewardpost_czw
作者: 沙漠点灰    时间: 2011-4-25 17:19
本帖最后由 沙漠点灰 于 2011-4-25 17:40 编辑

回复 79904396 的帖子
  1. #==============================================================================
  2. # ■ Window_Actorlevel
  3. #------------------------------------------------------------------------------
  4. #  显示角色等级的窗口。
  5. #==============================================================================

  6. class Window_Actorlevel < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor : 角色
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(0, 0, 640, 100)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     self.opacity = 160
  15.     refresh
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● 刷新
  19.   #--------------------------------------------------------------------------
  20.   def refresh
  21.     @lv = $game_party.actors.inject([]){|a,i|a<<i.level}
  22.     self.contents.clear ; x = 0
  23.     $game_party.actors.each {|i|
  24.       self.contents.draw_text(x % 2* 320, x/2 * 32, 200, 32, "#{i.name}  等级:#{i.level}" , 0)
  25.        x += 1
  26.     }
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● 刷新
  30.   #--------------------------------------------------------------------------
  31.   def update
  32.     super
  33.     refresh if @lv != $game_party.actors.inject([]){|a,i|a<<i.level}
  34.   end
  35. end

  36. class Scene_Map
  37.   alias old_main main unless Scene_Map.method_defined? "old_main"
  38.   def main
  39.     @Window_Actorlevel = Window_Actorlevel.new
  40.     old_main
  41.     @Window_Actorlevel.dispose
  42.   end
  43.   alias old_update_ update unless Scene_Map.method_defined? "old_update_"
  44.   def update
  45.     old_update_
  46.     @Window_Actorlevel.visible = $game_switches[99]
  47.     @Window_Actorlevel.update
  48.   end
  49. end
复制代码
修改完毕,这个窗口怎么没有出现?
把游戏开关99打开就会出现窗口,关掉99号开关就消失了





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1