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

Project1

 找回密码
 注册会员
搜索

新手求助:脚本问题!!!!

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

正文摘要:

今天按照网上的方法复制了一段代码到脚本里,可是却发生问题了(如图),大家帮我看看!!!

回复

永远的新手 发表于 2009-8-25 23:08:15
提示: 作者被禁止或删除 内容自动屏蔽
永远的新手 发表于 2009-8-25 17:54:18
提示: 作者被禁止或删除 内容自动屏蔽
夏季冰川 发表于 2009-8-25 17:47:57
论坛搜索"人物跟随"就能搜出XP版的和VX版的.
要脚本还是来6R吧.
kakarot 发表于 2009-8-25 17:47:10
好像是脚本本身的问题,换下面这个试试吧:

  1. class Game_Character
  2. attr_accessor :move_speed
  3. end

  4. class Game_Map
  5. attr_accessor :oldroute
  6. attr_accessor :oldeventsnums
  7. attr_reader   :map
  8. alias initialize_old initialize
  9. def initialize
  10.    initialize_old
  11.    @oldroute = []
  12.    @oldeventsnums = 0
  13. end
  14. end

  15. class Game_Player < Game_Character
  16. alias update_old update
  17. def update
  18.    last_moving = moving?
  19.    unless moving? or $game_system.map_interpreter.running? or
  20.           @move_route_forcing or $game_temp.message_window_showing
  21.      case Input.dir4
  22.      when 2
  23.        if passable?(@x, @y, 2)
  24.          $game_map.oldroute.push([@x,@y,2])
  25.          if $game_map.oldroute.size == $game_party.actors.size
  26.            $game_map.oldroute.shift
  27.          end
  28.        end
  29.        move_down
  30.      when 4
  31.        if passable?(@x, @y, 4)
  32.          $game_map.oldroute.push([@x,@y,4])
  33.          if $game_map.oldroute.size == $game_party.actors.size
  34.            $game_map.oldroute.shift
  35.          end
  36.        end
  37.        move_left
  38.      when 6
  39.        if passable?(@x, @y, 6)
  40.          $game_map.oldroute.push([@x,@y,6])
  41.          if $game_map.oldroute.size == $game_party.actors.size
  42.            $game_map.oldroute.shift
  43.          end
  44.        end
  45.        move_right
  46.      when 8
  47.        if passable?(@x, @y, 8)
  48.          $game_map.oldroute.push([@x,@y,8])
  49.          if $game_map.oldroute.size == $game_party.actors.size
  50.            $game_map.oldroute.shift
  51.          end
  52.        end
  53.        move_up
  54.      end
  55.    end
  56.    update_old
  57. end
  58. end

  59. class Interpreter
  60. def command_129
  61.    actor = $game_actors[@parameters[0]]
  62.    if actor != nil
  63.      if @parameters[1] == 0
  64.        if @parameters[2] == 1
  65.          $game_actors[@parameters[0]].setup(@parameters[0])
  66.        end
  67.        $game_party.add_actor(@parameters[0])
  68.        $scene.del_follow
  69.        $scene.follow_system
  70.      else
  71.        $game_party.remove_actor(@parameters[0])
  72.        $scene.del_follow
  73.        $scene.follow_system
  74.      end
  75.    end
  76.    return true
  77. end
  78. end

  79. class Scene_Map
  80. alias main_old main
  81. def main
  82.    @spriteset = Spriteset_Map.new
  83.    if $game_variables[1000] == 0
  84.      follow_system
  85.      $game_variables[1000] = 1
  86.    end
  87.    main_old
  88. end

  89. alias update_old update
  90. def update
  91.    follow_system_update
  92.    update_old
  93. end

  94. alias transfer_player_old transfer_player
  95. def transfer_player
  96.    $game_temp.player_transferring = false
  97.    if $game_map.map_id != $game_temp.player_new_map_id
  98.      del_follow
  99.      $game_map.setup($game_temp.player_new_map_id)
  100.    end
  101.    $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
  102.    follow_system
  103.    transfer_player_old
  104. end

  105. def follow_system
  106.    $game_map.oldeventsnums = $game_map.events.size
  107.    if $game_party.actors.size>=2
  108.      for i in 2..$game_party.actors.size
  109.        # 为事件加上名字考虑做srpg用
  110.        name = "我军,"+i.to_s
  111.        character_name = $game_party.actors[i-1].character_name
  112.        party_event($game_player.x,$game_player.y,name,character_name)
  113.        $game_map.oldroute.push([$game_player.x,$game_player.y,$game_player.direction])
  114.      end
  115.    end
  116. end

  117. def del_follow
  118.    $game_map.oldroute.clear
  119.    for i in 1..($game_map.events.size-$game_map.oldeventsnums)
  120.      $game_map.events.delete($game_map.oldeventsnums+i)
  121.    end
  122. end

  123. def party_event(x,y,name,character_name)
  124.    $game_map.events[$game_map.events.size+1] = Game_Event.new($game_map.map_id,produce_party_event(x,y,name,character_name))
  125.    $game_map.map.events[$game_map.events.size] = produce_party_event(x,y,name,character_name)
  126.    @spriteset.dispose
  127.    @spriteset = Spriteset_Map.new
  128. end

  129. def produce_party_event(x,y,name,character_name)
  130.    e = RPG::Event.new(x,y)
  131.    e.id = $game_map.events.size
  132.    e.name = name
  133.    e.pages = [RPG::Event::Page.new]   
  134.    e.pages[0].graphic = RPG::Event::Page::Graphic.new
  135.    e.pages[0].graphic.character_name = character_name   
  136.    e.pages[0].through = true
  137.    return e
  138. end

  139. def follow_system_update
  140.    num = $game_map.oldeventsnums
  141.    n = $game_player.move_speed
  142.    s=$game_map.oldroute.size-1
  143.    if s>=0
  144.      $game_map.events[num+1].move_speed = n
  145.      if $game_map.events[num+1].x>$game_map.oldroute[s][0]
  146.        $game_map.events[num+1].move_left
  147.      elsif $game_map.events[num+1].x<$game_map.oldroute[s][0]
  148.        $game_map.events[num+1].move_right
  149.      elsif $game_map.events[num+1].y>$game_map.oldroute[s][1]
  150.        $game_map.events[num+1].move_up
  151.      elsif $game_map.events[num+1].y<$game_map.oldroute[s][1]
  152.        $game_map.events[num+1].move_down
  153.      end
  154.    end
  155.    if s>=1
  156.      $game_map.events[num+2].move_speed = n
  157.      if $game_map.events[num+2].x>$game_map.oldroute[s-1][0]
  158.        $game_map.events[num+2].move_left
  159.      elsif $game_map.events[num+2].x<$game_map.oldroute[s-1][0]
  160.        $game_map.events[num+2].move_right
  161.      elsif $game_map.events[num+2].y>$game_map.oldroute[s-1][1]
  162.        $game_map.events[num+2].move_up
  163.      elsif $game_map.events[num+2].y<$game_map.oldroute[s-1][1]
  164.        $game_map.events[num+2].move_down
  165.      end
  166.    end
  167.    if s>=2
  168.      $game_map.events[num+3].move_speed = n
  169.      if $game_map.events[num+3].x>$game_map.oldroute[s-2][0]
  170.        $game_map.events[num+3].move_left
  171.      elsif $game_map.events[num+3].x<$game_map.oldroute[s-2][0]
  172.        $game_map.events[num+3].move_right
  173.      elsif $game_map.events[num+3].y>$game_map.oldroute[s-2][1]
  174.        $game_map.events[num+3].move_up
  175.      elsif $game_map.events[num+3].y<$game_map.oldroute[s-2][1]
  176.        $game_map.events[num+3].move_down
  177.      end
  178.    end
  179. end
  180. end
复制代码
凌辰 发表于 2009-8-25 17:43:38
http://rpg.blue/web/index.php?doc-view-4003
用这个就不会出错了。
唉……宁愿信任百度也不信任6R,真是的……
永远的新手 发表于 2009-8-25 17:34:18
提示: 作者被禁止或删除 内容自动屏蔽
夏季冰川 发表于 2009-8-25 17:32:23
鬼知道你复制了什么脚本?至少得上传一下吧.
凌辰 发表于 2009-8-25 17:12:19
今天按照网上的方法复制了一段代码到脚本里

你复制了什么啊- -b
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2025-1-10 16:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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