问个令我十分纠结的脚本问题
rmxp吧
全部回复
仅看楼主
level 2
HDT_3S 楼主
我新建了两个脚本:
第一个脚本Window_MapStatus
#==============================================================================
# ■ Window_MapStatus
#------------------------------------------------------------------------------
#    地图画面显示金钱、步数与积分的窗口。
#==============================================================================
class Window_MapStatus < Window_Base
   #--------------------------------------------------------------------------
   # ● 初始化对像
   #--------------------------------------------------------------------------
   def initialize
     super(0, 0, 640, 64)
     self.contents = Bitmap.new(width - 32, height - 32)
     refresh
   end
   #--------------------------------------------------------------------------
   # ● 刷新
   #--------------------------------------------------------------------------
   def refresh
     self.contents.clear
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 0, 60, 32, $game_party.gold.to_s, 2)
     self.contents.font.color = system_color
     self.contents.draw_text(4, 0, 150, 32, $data_system.words.gold, 2)
     self.contents.font.color = system_color
     self.contents.draw_text(4, 0, 360, 32, "                              步数")
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 0, 400, 32, $game_party.steps.to_s, 2)
     self.contents.font.color = system_color
     self.contents.draw_text(4, 0, 512, 32, "                                                           积分")
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 0, 576, 32, ($game_party.steps + $game_variables[5]).to_s, 2)
   end
end
第二个脚本Scene_MapStatus
#==============================================================================
# ■ Scene_MapStatus
#------------------------------------------------------------------------------
#    处理地图画面中状态的类。
#==============================================================================
class Scene_MapStatus
   #---------------------------------------------------------------------------

2010年08月01日 03点08分 1
level 2
HDT_3S 楼主
   # ● 主处理
   #---------------------------------------------------------------------------
   def main
     @mapstatus_window = Window_MapStatus.new   
     @mapstatus_window.x = 0
     @mapstatus_window.y = 0
     @mapstatus_window.z = 5
    # 循环
     loop do
       Graphics.update
       Input.update
       update
       if $scene != self
         break
       end
     end
     # 按下 B 键的情况下
     if Input.trigger?(Input::B)
       # 演奏取消 SE
       $game_system.se_play($data_system.cancel_se)
       # 切换的地图画面
       $scene = Scene_Map.new
       return
     end
   end
   #---------------------------------------------------------------------------
   # ● 刷新画面
   #---------------------------------------------------------------------------
   def update
     # 循环
     loop do
       @mapstatus_window.update
       unless $game_temp.player_transferring
         break
       end
     end
   end
end
在Scene_Map中添加:
if Input.trigger?(Input::Y)
   # 不是在事件执行中或菜单禁止中
   unless $game_system.map_interpreter.running? or
          $game_system.menu_disabled
     $scene = Scene_MapStatus.new
   end
end
结果每次都卡,但没有错误报告,并且可以关闭,这到底怎么回事啊?哪位高手能帮帮我?
2010年08月01日 03点08分 2
level 2
HDT_3S 楼主
注:脚本中
      self.contents.draw_text(4, 0, 512, 32, "                                                            积分")
这一句其实是在同一行中的
2010年08月01日 03点08分 3
level 6
你这个是window不能用$scene=呼出的,只能用注释
比如
@var_window = Window_MapVar.new
=后面的就是脚本所指的在什么之下运行
2010年08月01日 04点08分 4
level 6
还有.new也不能少
2010年08月01日 04点08分 5
level 2
HDT_3S 楼主
我不是用$scene=呼出Window_MapStatus,而是呼出Scene_MapStatus
然后在Scene_MapStatus中使用@mapstatus = Window_MapStatus.new
2010年08月01日 04点08分 6
level 2
HDT_3S 楼主
我在哪里漏了.new?好像没有
2010年08月01日 04点08分 7
level 2
HDT_3S 楼主
我曾经在Scene_Map中用
@mapstatus_window = Window_MapStatus.new,当时还没有用loop do,刚才又试了一下,还是不行
2010年08月01日 04点08分 8
level 2
HDT_3S 楼主
呼出场景终于成功了,是因为漏写Graphics.transition
但是还有问题:退出Scene_MapStatus后Window_MapStatus还在,并且再次呼出Scene_MapStatus时又有重影,请问谁懂得到底是怎么回事啊?
2010年08月03日 13点08分 9
level 6
参考其他窗口中的删除窗口指令
2010年08月14日 12点08分 10
1