查看: 944|回复: 2

[已经解决] 前冲脚本在用事件加EXP的时候出错

  [复制链接]
梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
回帖
914
发表于 2009-10-29 13:23:25 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 幻耶 于 2009-10-29 14:49 编辑

以下脚本是实现按D键让角色前冲一段距离,另外在Scene_Title的132行添加一句:
$game_player.move_speed = $game_party.actors[0].agi/200.0 + 2.5

问题是:在游戏中用事件给角色增加经验的时候出错了,如下图,但如果在加经验前按D键先冲一次就不会出错,这是为什么。。。
  1. class Game_Player
  2.   attr_accessor :move_speed
  3.   #--------------------------------------------------------------------------
  4.   # ● フレーム更新
  5.   #--------------------------------------------------------------------------
  6.   alias old_update update
  7.   def update
  8.     unless $game_system.map_interpreter.running? or
  9.       @move_route_forcing or $game_temp.message_window_showing
  10.       if Kboard.trigger?($R_Key_D)
  11.         if @move_speed != 6
  12.           @move_speed = 6
  13.           move_route = RPG::MoveRoute.new
  14.           move_route.repeat = false
  15.           move_route.list.clear
  16.           move_command = RPG::MoveCommand.new
  17.           move_command.code = @direction / 2
  18.           5.times{move_route.list.push(move_command.clone)}
  19.           move_command.code = 0
  20.           move_route.list.push(move_command)
  21.           force_move_route(move_route)
  22.           @character_name_run = @character_name
  23.           @character_name = @character_name# + "rush"
  24.           Audio.se_play("Audio/SE/"+"013-Move01",80,100)
  25.         end
  26.       else
  27.         if @move_speed != $game_party.actors[0].agi/200.0 + 2.5
  28.           @move_speed = $game_party.actors[0].agi/200.0 + 2.5
  29.           @character_name = @character_name_run
  30.         end
  31.       end  
  32.     end
  33.     old_update
  34.     if @move_route_forcing
  35.       if not @move_route.skippable and not moving? and not jumping?
  36.         @move_route_index = @move_route.list.size - 1
  37.         return
  38.       end
  39.     end
  40.   end
  41. end
复制代码
附上工程
00.jpg

Project9再测试.rar

191.07 KB, 下载次数: 25

囡囚囨囚囨図囨囧
梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
回帖
914
 楼主| 发表于 2009-10-30 09:10:32 | 显示全部楼层
可以顶了吧
回复

使用道具 举报

梦石
0
星屑
60
在线时间
61 小时
注册时间
2006-9-15
回帖
864
发表于 2009-10-30 13:10:24 | 显示全部楼层
  1. class Game_Player
  2.   attr_accessor :move_speed
  3.   #--------------------------------------------------------------------------
  4.   # ● フレーム更新
  5.   #--------------------------------------------------------------------------
  6.   alias old_update update
  7.   def update
  8.     unless $game_system.map_interpreter.running? or
  9.       @move_route_forcing or $game_temp.message_window_showing
  10.       #if Kboard.keyb($R_Key_D) == 1
  11.       if Kboard.trigger?($R_Key_D)
  12.         if @move_speed != 6
  13.           @move_speed = 6
  14.           move_route = RPG::MoveRoute.new
  15.           move_route.repeat = false
  16.           move_route.list.clear
  17.           move_command = RPG::MoveCommand.new
  18.           move_command.code = @direction / 2
  19.           5.times{move_route.list.push(move_command.clone)}
  20.           move_command.code = 0
  21.           move_route.list.push(move_command)
  22.           force_move_route(move_route)
  23.           @character_name_run = @character_name
  24.           @character_name = @character_name + "rush"
  25.           Audio.se_play("Audio/SE/"+"013-Move01",80,100)
  26.           $game_temp.common_event_id = 1
  27.         end
  28.       else
  29.         if @move_speed != $game_party.actors[0].agi/200.0 + 2.5
  30.           @move_speed = $game_party.actors[0].agi/200.0 + 2.5
  31.           @character_name = @character_name_run
  32.         end
  33.       end  
  34.     end
  35.     old_update
  36.     if @move_route_forcing
  37.       if not @move_route.skippable and not moving? and not jumping?
  38.         @move_route_index = @move_route.list.size - 1
  39.         return
  40.       end
  41.     end
  42.   end
  43.   def refresh_start
  44.     @character_name_run = @character_name
  45.   end
  46. end
复制代码
在Scene_title  

137行

    # 刷新主角
    $game_player.refresh

之后插入
    $game_player.refresh_start
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部