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

Project1

 找回密码
 注册会员
搜索
查看: 2181|回复: 7
打印 上一主题 下一主题

[已经解决] 跟随脚本出错

[复制链接]

Lv1.梦旅人

梦石
0
星屑
203
在线时间
42 小时
注册时间
2017-5-30
帖子
42
跳转到指定楼层
1
发表于 2018-4-28 19:12:43 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 RyanBern 于 2018-4-29 15:11 编辑


请问为什么我装了这个跟随脚本后就这样
RUBY 代码复制
  1. # ————————————————————————————————————
  2. # 本脚本来自[url]www.66rpg.com[/url],转载自[url]www.phylomortis.com[/url],转载请保留此信息
  3. # ————————————————————————————————————
  4.  
  5. # ▼▲▼ XRXS13. パーティ列車移動 ver.1.02 ▼▲▼
  6. # by fukuyama
  7.  
  8. #
  9. # Train_Actor
  10. #
  11. # [url]http://www4.big.or.jp/~fukuyama/rgss/Train_Actor.txt[/url]
  12. #
  13.  
  14. module Train_Actor
  15.  
  16.  
  17.  
  18.  
  19. #是否使用停止跟随的方法,也就是说,这里false改为true的时候,如果TRANSPARENT_SWITCHES_INDEX
  20. #开关打开,跟随的人物就消失了(其实只是变成透明而已)
  21. TRANSPARENT_SWITCH = true
  22. TRANSPARENT_SWITCHES_INDEX = 191
  23. #举例:第一个为true,第二个为20,则打开20号开关,后面的人都没了。
  24.  
  25.  
  26.  
  27.  
  28.  
  29. #跟随人数的最大数目,可以更改为2、3什么的。
  30. TRAIN_ACTOR_SIZE_MAX = 5
  31.  
  32.  
  33.  
  34.  
  35.  
  36. # 定数
  37. #Input::DOWN = 2
  38. #Input::LEFT = 4
  39. #Input::RIGHT = 6
  40. #Input::UP = 6
  41. DOWN_LEFT = 1
  42. DOWN_RIGHT = 3
  43. UP_LEFT = 7
  44. UP_RIGHT = 9
  45. JUMP = 5
  46.  
  47. class Game_Party_Actor < Game_Character
  48.   def initialize
  49.     super()
  50.     @through = true
  51.   end
  52.   def setup(actor)
  53. # キャラクターのファイル名と色相を設定
  54.     if actor != nil
  55.       @character_name = actor.character_name
  56.       @character_hue = actor.character_hue
  57.     else
  58.       @character_name = ""
  59.       @character_hue = 0
  60.     end
  61. # 不透明度と合成方法を初期化
  62.     @opacity = 255
  63.     @blend_type = 0
  64.   end
  65.  
  66.   def screen_z(height = 0)
  67.     if $game_player.x == @x and $game_player.y == @y
  68.  
  69.     return $game_player.screen_z(height) - 1
  70.   end
  71.  
  72.  
  73.   super(height)
  74. end
  75. #--------------------------------------------------------------------------
  76. # ● 下に移動
  77. # turn_enabled : その場での向き変更を許可するフラグ
  78. #--------------------------------------------------------------------------
  79. def move_down(turn_enabled = true)
  80.   if turn_enabled
  81.     turn_down
  82.   end
  83.  
  84.   if passable?(@x, @y, Input::DOWN)
  85.     turn_down
  86.     @y += 1
  87.   end
  88.  
  89.  
  90. end
  91.  
  92. #--------------------------------------------------------------------------
  93. # ● 左に移動
  94. # turn_enabled : その場での向き変更を許可するフラグ
  95. #--------------------------------------------------------------------------
  96.   def move_left(turn_enabled = true)
  97. # 左を向く
  98.     if turn_enabled
  99.       turn_left
  100.     end
  101. # 通行可能な場合
  102.    if passable?(@x, @y, Input::LEFT)
  103.   # 左を向く
  104.     turn_left
  105.     @x -= 1
  106.    end
  107. end
  108.  
  109. #--------------------------------------------------------------------------
  110. # ● 右に移動
  111. # turn_enabled : その場での向き変更を許可するフラグ
  112. #--------------------------------------------------------------------------
  113.   def move_right(turn_enabled = true)
  114. # 右を向く
  115.     if turn_enabled
  116.       turn_right
  117.     end
  118.  
  119. # 通行可能な場合
  120.     if passable?(@x, @y, Input::RIGHT)
  121. # 右を向く
  122.       turn_right
  123. # 座標を更新
  124.       @x += 1
  125.     end
  126.   end
  127.  
  128. #--------------------------------------------------------------------------
  129. # ● 上に移動
  130. # turn_enabled : その場での向き変更を許可するフラグ
  131. #--------------------------------------------------------------------------
  132.   def move_up(turn_enabled = true)
  133. # 上を向く
  134.     if turn_enabled
  135.       turn_up
  136.     end
  137. # 通行可能な場合
  138.     if passable?(@x, @y, Input::UP)
  139. # 上を向く
  140.       turn_up
  141. # 座標を更新
  142.       @y -= 1
  143.     end
  144.  
  145.   end
  146.  
  147. #--------------------------------------------------------------------------
  148. # ● 左下に移動
  149. #--------------------------------------------------------------------------
  150.   def move_lower_left
  151. # 向き固定でない場合
  152.     unless @direction_fix
  153. # 右向きだった場合は左を、上向きだった場合は下を向く
  154.       @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
  155.     end
  156.  
  157. # 下→左、左→下 のどちらかのコースが通行可能な場合
  158.   if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  159.   (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  160. # 座標を更新
  161.     @x -= 1
  162.     @y += 1
  163.   end
  164.  
  165. end
  166.  
  167. #--------------------------------------------------------------------------
  168. # ● 右下に移動
  169. #--------------------------------------------------------------------------
  170.   def move_lower_right
  171. # 向き固定でない場合
  172.     unless @direction_fix
  173. # 左向きだった場合は右を、上向きだった場合は下を向く
  174.       @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
  175.     end
  176.  
  177. # 下→右、右→下 のどちらかのコースが通行可能な場合
  178.     if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  179.     (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  180. # 座標を更新
  181.       @x += 1
  182.       @y += 1
  183.     end
  184.   end
  185.  
  186. #--------------------------------------------------------------------------
  187. # ● 左上に移動
  188. #--------------------------------------------------------------------------
  189.   def move_upper_left
  190. # 向き固定でない場合
  191.     unless @direction_fix
  192. # 右向きだった場合は左を、下向きだった場合は上を向く
  193.       @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
  194.     end
  195.  
  196. # 上→左、左→上 のどちらかのコースが通行可能な場合
  197.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  198.     (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  199. # 座標を更新
  200.       @x -= 1
  201.       @y -= 1
  202.     end
  203.  
  204.   end
  205.  
  206. #--------------------------------------------------------------------------
  207. # ● 右上に移動
  208. #--------------------------------------------------------------------------
  209.   def move_upper_right
  210. # 向き固定でない場合
  211.     unless @direction_fix
  212. # 左向きだった場合は右を、下向きだった場合は上を向く
  213.       @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
  214.     end
  215.  
  216. # 上→右、右→上 のどちらかのコースが通行可能な場合
  217.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  218.     (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  219. # 座標を更新
  220.        @x += 1
  221.        @y -= 1
  222.      end     
  223.    end   
  224.   attr_writer :move_speed
  225.   attr_writer :step_anime
  226. end
  227. module Spriteset_Map_Module
  228.   def setup_actor_character_sprites?
  229.     return @setup_actor_character_sprites_flag != nil
  230.   end  
  231.   def setup_actor_character_sprites(characters)
  232.     if !setup_actor_character_sprites?
  233.       index_game_player = 0
  234.       @character_sprites.each_index do |i|
  235.         if @character_sprites[i].character.instance_of?(Game_Player)
  236.           index_game_player = i
  237.           break
  238.         end        
  239.       end
  240.       for character in characters.reverse
  241.         @character_sprites.unshift(Sprite_Character.new(@viewport1, character))
  242.       end
  243.      @setup_actor_character_sprites_flag = true
  244.    end
  245. end
  246. end
  247. module Scene_Map_Module
  248.   def setup_actor_character_sprites(characters)
  249.     @spriteset.setup_actor_character_sprites(characters)
  250.   end  
  251. end
  252. module Game_Party_Module
  253.   def set_transparent_actors(transparent)
  254.     @transparent = transparent
  255.   end
  256.   def setup_actor_character_sprites
  257.     if @characters == nil
  258.       @characters = []
  259.       for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  260.         @characters.push(Game_Party_Actor.new)
  261.       end
  262.     end
  263.     for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  264.       @characters[i - 1].setup(actors[i])
  265.     end
  266.     if $scene.class.method_defined?('setup_actor_character_sprites')
  267.       $scene.setup_actor_character_sprites(@characters)
  268.     end   
  269.   end
  270.   def update_party_actors
  271.     setup_actor_character_sprites
  272.     transparent = $game_player.transparent
  273.     if transparent == false
  274.       if TRANSPARENT_SWITCH
  275.         transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
  276.       end
  277.     end
  278.     for character in @characters
  279.       character.transparent = transparent
  280.       character.move_speed = $game_player.move_speed
  281.       character.step_anime = $game_player.step_anime
  282.       character.update
  283.     end
  284.   end  
  285.   def moveto_party_actors( x, y )
  286.     setup_actor_character_sprites
  287.     for character in @characters
  288.       character.moveto( x, y )
  289.     end
  290.     if @move_list == nil
  291.       @move_list = []
  292.     end
  293.     move_list_setup
  294.   end
  295.   def move_party_actors
  296.     if @move_list == nil
  297.       @move_list = []
  298.       move_list_setup
  299.     end
  300.     @move_list.each_index do |i|
  301.     if @characters[i] != nil
  302.       case @move_list[i].type
  303.       when Input::DOWN
  304.         @characters[i].move_down(@move_list[i].args[0])
  305.       when Input::LEFT
  306.         @characters[i].move_left(@move_list[i].args[0])
  307.       when Input::RIGHT
  308.         @characters[i].move_right(@move_list[i].args[0])
  309.       when Input::UP
  310.         @characters[i].move_up(@move_list[i].args[0])
  311.       when DOWN_LEFT
  312.         @characters[i].move_lower_left
  313.       when DOWN_RIGHT
  314.         @characters[i].move_lower_right
  315.       when UP_LEFT
  316.         @characters[i].move_upper_left
  317.       when UP_RIGHT
  318.         @characters[i].move_upper_right
  319.       when JUMP
  320.         @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  321.       end
  322.     end   
  323.   end
  324. end
  325.  
  326. class Move_List_Element
  327.   def initialize(type,args)
  328.     @type = type
  329.     @args = args
  330.   end
  331.   def type() return @type end
  332.     def args() return @args end
  333.   end
  334.   def move_list_setup
  335.     for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  336.       @move_list[i] = nil
  337.     end   
  338.   end  
  339.   def add_move_list(type,*args)
  340.     @move_list.unshift(Move_List_Element.new(type,args)).pop
  341.   end
  342.   def move_down_party_actors(turn_enabled = true)
  343.     move_party_actors
  344.     add_move_list(Input::DOWN,turn_enabled)
  345.   end
  346.  
  347.   def move_left_party_actors(turn_enabled = true)
  348.     move_party_actors
  349.     add_move_list(Input::LEFT,turn_enabled)
  350.   end
  351.   def move_right_party_actors(turn_enabled = true)
  352.     move_party_actors
  353.     add_move_list(Input::RIGHT,turn_enabled)
  354.   end
  355.   def move_up_party_actors(turn_enabled = true)
  356.     move_party_actors
  357.     add_move_list(Input::UP,turn_enabled)
  358.   end
  359.   def move_lower_left_party_actors
  360.     move_party_actors
  361.     add_move_list(DOWN_LEFT)
  362.   end
  363.   def move_lower_right_party_actors
  364.     move_party_actors
  365.     add_move_list(DOWN_RIGHT)
  366.   end
  367.   def move_upper_left_party_actors
  368.     move_party_actors
  369.     add_move_list(UP_LEFT)
  370.   end
  371.   def move_upper_right_party_actors
  372.     move_party_actors
  373.     add_move_list(UP_RIGHT)
  374.   end
  375.   def jump_party_actors(x_plus, y_plus)
  376.     move_party_actors
  377.     add_move_list(JUMP,x_plus, y_plus)
  378.   end  
  379. end
  380.  
  381. module Game_Player_Module
  382.   def update
  383.     $game_party.update_party_actors
  384.     super
  385.   end
  386.   def moveto( x, y )
  387.     $game_party.moveto_party_actors( x, y )
  388.     super( x, y )
  389.   end
  390.   def move_down(turn_enabled = true)
  391.     if passable?(@x, @y, Input::DOWN)
  392.       $game_party.move_down_party_actors(turn_enabled)
  393.     end
  394.     super(turn_enabled)
  395.   end
  396.   def move_left(turn_enabled = true)
  397.     if passable?(@x, @y, Input::LEFT)
  398.       $game_party.move_left_party_actors(turn_enabled)
  399.     end
  400.     super(turn_enabled)
  401.   end
  402.   def move_right(turn_enabled = true)
  403.     if passable?(@x, @y, Input::RIGHT)
  404.       $game_party.move_right_party_actors(turn_enabled)
  405.     end
  406.     super(turn_enabled)
  407.   end
  408.   def move_up(turn_enabled = true)
  409.     if passable?(@x, @y, Input::UP)
  410.       $game_party.move_up_party_actors(turn_enabled)
  411.     end
  412.     super(turn_enabled)
  413.   end
  414.   def move_lower_left
  415.     # 下→左、左→下 のどちらかのコースが通行可能な場合
  416.     if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  417.       (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  418.       $game_party.move_lower_left_party_actors
  419.     end
  420.     super
  421.   end
  422.   def move_lower_right
  423.     # 下→右、右→下 のどちらかのコースが通行可能な場合
  424.     if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  425.       (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  426.       $game_party.move_lower_right_party_actors
  427.     end
  428.     super
  429.   end
  430.   def move_upper_left
  431.     # 上→左、左→上 のどちらかのコースが通行可能な場合
  432.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  433.       (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  434.       $game_party.move_upper_left_party_actors
  435.     end
  436.     super
  437.   end
  438.   def move_upper_right
  439.     # 上→右、右→上 のどちらかのコースが通行可能な場合
  440.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  441.       (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  442.       $game_party.move_upper_right_party_actors
  443.     end
  444.     super
  445.   end
  446.   def jump(x_plus, y_plus)
  447.     # 新しい座標を計算
  448.     new_x = @x + x_plus
  449.     new_y = @y + y_plus
  450.     # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
  451.     if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
  452.       $game_party.jump_party_actors(x_plus, y_plus)
  453.     end
  454.     super(x_plus, y_plus)
  455.   end
  456.  
  457.   attr_reader :move_speed
  458.   attr_reader :step_anime
  459. end
  460.  
  461. end # module Train_Actor
  462. class Game_Party
  463.   include Train_Actor::Game_Party_Module
  464. end
  465. class Game_Player
  466.   include Train_Actor::Game_Player_Module
  467. end
  468. class Spriteset_Map
  469.   include Train_Actor::Spriteset_Map_Module
  470. end
  471. class Scene_Map
  472.   include Train_Actor::Scene_Map_Module
  473. end

这是脚本

Lv1.梦旅人

梦石
0
星屑
203
在线时间
42 小时
注册时间
2017-5-30
帖子
42
2
 楼主| 发表于 2018-4-28 19:14:05 | 只看该作者
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载自www.phylomortis.com,转载请保留此信息
  3. # ————————————————————————————————————

  4. # ▼▲▼ XRXS13. パーティ列車移動 ver.1.02 ▼▲▼
  5. # by fukuyama

  6. #
  7. # Train_Actor
  8. #
  9. # [email protected]
  10. # http://www4.big.or.jp/~fukuyama/rgss/Train_Actor.txt
  11. #

  12. module Train_Actor




  13. #是否使用停止跟随的方法,也就是说,这里false改为true的时候,如果TRANSPARENT_SWITCHES_INDEX
  14. #开关打开,跟随的人物就消失了(其实只是变成透明而已)
  15. TRANSPARENT_SWITCH = true
  16. TRANSPARENT_SWITCHES_INDEX = 191
  17. #举例:第一个为true,第二个为20,则打开20号开关,后面的人都没了。





  18. #跟随人数的最大数目,可以更改为2、3什么的。
  19. TRAIN_ACTOR_SIZE_MAX = 5





  20. # 定数
  21. #Input::DOWN = 2
  22. #Input::LEFT = 4
  23. #Input::RIGHT = 6
  24. #Input::UP = 6
  25. DOWN_LEFT = 1
  26. DOWN_RIGHT = 3
  27. UP_LEFT = 7
  28. UP_RIGHT = 9
  29. JUMP = 5

  30. class Game_Party_Actor < Game_Character
  31.   def initialize
  32.     super()
  33.     @through = true
  34.   end
  35.   def setup(actor)
  36. # キャラクターのファイル名と色相を設定
  37.     if actor != nil
  38.       @character_name = actor.character_name
  39.       @character_hue = actor.character_hue
  40.     else
  41.       @character_name = ""
  42.       @character_hue = 0
  43.     end
  44. # 不透明度と合成方法を初期化
  45.     @opacity = 255
  46.     @blend_type = 0
  47.   end
  48.   
  49.   def screen_z(height = 0)
  50.     if $game_player.x == @x and $game_player.y == @y
  51.   
  52.     return $game_player.screen_z(height) - 1
  53.   end
  54.   

  55.   super(height)
  56. end
  57. #--------------------------------------------------------------------------
  58. # ● 下に移動
  59. # turn_enabled : その場での向き変更を許可するフラグ
  60. #--------------------------------------------------------------------------
  61. def move_down(turn_enabled = true)
  62.   if turn_enabled
  63.     turn_down
  64.   end
  65.   
  66.   if passable?(@x, @y, Input::DOWN)
  67.     turn_down
  68.     @y += 1
  69.   end
  70.   

  71. end

  72. #--------------------------------------------------------------------------
  73. # ● 左に移動
  74. # turn_enabled : その場での向き変更を許可するフラグ
  75. #--------------------------------------------------------------------------
  76.   def move_left(turn_enabled = true)
  77. # 左を向く
  78.     if turn_enabled
  79.       turn_left
  80.     end
  81. # 通行可能な場合
  82.    if passable?(@x, @y, Input::LEFT)
  83.   # 左を向く
  84.     turn_left
  85.     @x -= 1
  86.    end
  87. end

  88. #--------------------------------------------------------------------------
  89. # ● 右に移動
  90. # turn_enabled : その場での向き変更を許可するフラグ
  91. #--------------------------------------------------------------------------
  92.   def move_right(turn_enabled = true)
  93. # 右を向く
  94.     if turn_enabled
  95.       turn_right
  96.     end
  97.    
  98. # 通行可能な場合
  99.     if passable?(@x, @y, Input::RIGHT)
  100. # 右を向く
  101.       turn_right
  102. # 座標を更新
  103.       @x += 1
  104.     end
  105.   end
  106.   
  107. #--------------------------------------------------------------------------
  108. # ● 上に移動
  109. # turn_enabled : その場での向き変更を許可するフラグ
  110. #--------------------------------------------------------------------------
  111.   def move_up(turn_enabled = true)
  112. # 上を向く
  113.     if turn_enabled
  114.       turn_up
  115.     end
  116. # 通行可能な場合
  117.     if passable?(@x, @y, Input::UP)
  118. # 上を向く
  119.       turn_up
  120. # 座標を更新
  121.       @y -= 1
  122.     end
  123.    
  124.   end
  125.   
  126. #--------------------------------------------------------------------------
  127. # ● 左下に移動
  128. #--------------------------------------------------------------------------
  129.   def move_lower_left
  130. # 向き固定でない場合
  131.     unless @direction_fix
  132. # 右向きだった場合は左を、上向きだった場合は下を向く
  133.       @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
  134.     end
  135.    
  136. # 下→左、左→下 のどちらかのコースが通行可能な場合
  137.   if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  138.   (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  139. # 座標を更新
  140.     @x -= 1
  141.     @y += 1
  142.   end
  143.   
  144. end

  145. #--------------------------------------------------------------------------
  146. # ● 右下に移動
  147. #--------------------------------------------------------------------------
  148.   def move_lower_right
  149. # 向き固定でない場合
  150.     unless @direction_fix
  151. # 左向きだった場合は右を、上向きだった場合は下を向く
  152.       @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
  153.     end
  154.    
  155. # 下→右、右→下 のどちらかのコースが通行可能な場合
  156.     if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  157.     (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  158. # 座標を更新
  159.       @x += 1
  160.       @y += 1
  161.     end
  162.   end
  163.   
  164. #--------------------------------------------------------------------------
  165. # ● 左上に移動
  166. #--------------------------------------------------------------------------
  167.   def move_upper_left
  168. # 向き固定でない場合
  169.     unless @direction_fix
  170. # 右向きだった場合は左を、下向きだった場合は上を向く
  171.       @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
  172.     end
  173.    
  174. # 上→左、左→上 のどちらかのコースが通行可能な場合
  175.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  176.     (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  177. # 座標を更新
  178.       @x -= 1
  179.       @y -= 1
  180.     end
  181.    
  182.   end
  183.   
  184. #--------------------------------------------------------------------------
  185. # ● 右上に移動
  186. #--------------------------------------------------------------------------
  187.   def move_upper_right
  188. # 向き固定でない場合
  189.     unless @direction_fix
  190. # 左向きだった場合は右を、下向きだった場合は上を向く
  191.       @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
  192.     end
  193.    
  194. # 上→右、右→上 のどちらかのコースが通行可能な場合
  195.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  196.     (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  197. # 座標を更新
  198.        @x += 1
  199.        @y -= 1
  200.      end     
  201.    end   
  202.   attr_writer :move_speed
  203.   attr_writer :step_anime
  204. end
  205. module Spriteset_Map_Module
  206.   def setup_actor_character_sprites?
  207.     return @setup_actor_character_sprites_flag != nil
  208.   end  
  209.   def setup_actor_character_sprites(characters)
  210.     if !setup_actor_character_sprites?
  211.       index_game_player = 0
  212.       @character_sprites.each_index do |i|
  213.         if @character_sprites[i].character.instance_of?(Game_Player)
  214.           index_game_player = i
  215.           break
  216.         end        
  217.       end
  218.       for character in characters.reverse
  219.         @character_sprites.unshift(Sprite_Character.new(@viewport1, character))
  220.       end
  221.      @setup_actor_character_sprites_flag = true
  222.    end
  223. end
  224. end
  225. module Scene_Map_Module
  226.   def setup_actor_character_sprites(characters)
  227.     @spriteset.setup_actor_character_sprites(characters)
  228.   end  
  229. end
  230. module Game_Party_Module
  231.   def set_transparent_actors(transparent)
  232.     @transparent = transparent
  233.   end
  234.   def setup_actor_character_sprites
  235.     if @characters == nil
  236.       @characters = []
  237.       for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  238.         @characters.push(Game_Party_Actor.new)
  239.       end
  240.     end
  241.     for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  242.       @characters[i - 1].setup(actors[i])
  243.     end
  244.     if $scene.class.method_defined?('setup_actor_character_sprites')
  245.       $scene.setup_actor_character_sprites(@characters)
  246.     end   
  247.   end
  248.   def update_party_actors
  249.     setup_actor_character_sprites
  250.     transparent = $game_player.transparent
  251.     if transparent == false
  252.       if TRANSPARENT_SWITCH
  253.         transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
  254.       end
  255.     end
  256.     for character in @characters
  257.       character.transparent = transparent
  258.       character.move_speed = $game_player.move_speed
  259.       character.step_anime = $game_player.step_anime
  260.       character.update
  261.     end
  262.   end  
  263.   def moveto_party_actors( x, y )
  264.     setup_actor_character_sprites
  265.     for character in @characters
  266.       character.moveto( x, y )
  267.     end
  268.     if @move_list == nil
  269.       @move_list = []
  270.     end
  271.     move_list_setup
  272.   end
  273.   def move_party_actors
  274.     if @move_list == nil
  275.       @move_list = []
  276.       move_list_setup
  277.     end
  278.     @move_list.each_index do |i|
  279.     if @characters[i] != nil
  280.       case @move_list[i].type
  281.       when Input::DOWN
  282.         @characters[i].move_down(@move_list[i].args[0])
  283.       when Input::LEFT
  284.         @characters[i].move_left(@move_list[i].args[0])
  285.       when Input::RIGHT
  286.         @characters[i].move_right(@move_list[i].args[0])
  287.       when Input::UP
  288.         @characters[i].move_up(@move_list[i].args[0])
  289.       when DOWN_LEFT
  290.         @characters[i].move_lower_left
  291.       when DOWN_RIGHT
  292.         @characters[i].move_lower_right
  293.       when UP_LEFT
  294.         @characters[i].move_upper_left
  295.       when UP_RIGHT
  296.         @characters[i].move_upper_right
  297.       when JUMP
  298.         @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  299.       end
  300.     end   
  301.   end
  302. end

  303. class Move_List_Element
  304.   def initialize(type,args)
  305.     @type = type
  306.     @args = args
  307.   end
  308.   def type() return @type end
  309.     def args() return @args end
  310.   end
  311.   def move_list_setup
  312.     for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  313.       @move_list[i] = nil
  314.     end   
  315.   end  
  316.   def add_move_list(type,*args)
  317.     @move_list.unshift(Move_List_Element.new(type,args)).pop
  318.   end
  319.   def move_down_party_actors(turn_enabled = true)
  320.     move_party_actors
  321.     add_move_list(Input::DOWN,turn_enabled)
  322.   end
  323.   
  324.   def move_left_party_actors(turn_enabled = true)
  325.     move_party_actors
  326.     add_move_list(Input::LEFT,turn_enabled)
  327.   end
  328.   def move_right_party_actors(turn_enabled = true)
  329.     move_party_actors
  330.     add_move_list(Input::RIGHT,turn_enabled)
  331.   end
  332.   def move_up_party_actors(turn_enabled = true)
  333.     move_party_actors
  334.     add_move_list(Input::UP,turn_enabled)
  335.   end
  336.   def move_lower_left_party_actors
  337.     move_party_actors
  338.     add_move_list(DOWN_LEFT)
  339.   end
  340.   def move_lower_right_party_actors
  341.     move_party_actors
  342.     add_move_list(DOWN_RIGHT)
  343.   end
  344.   def move_upper_left_party_actors
  345.     move_party_actors
  346.     add_move_list(UP_LEFT)
  347.   end
  348.   def move_upper_right_party_actors
  349.     move_party_actors
  350.     add_move_list(UP_RIGHT)
  351.   end
  352.   def jump_party_actors(x_plus, y_plus)
  353.     move_party_actors
  354.     add_move_list(JUMP,x_plus, y_plus)
  355.   end  
  356. end

  357. module Game_Player_Module
  358.   def update
  359.     $game_party.update_party_actors
  360.     super
  361.   end
  362.   def moveto( x, y )
  363.     $game_party.moveto_party_actors( x, y )
  364.     super( x, y )
  365.   end
  366.   def move_down(turn_enabled = true)
  367.     if passable?(@x, @y, Input::DOWN)
  368.       $game_party.move_down_party_actors(turn_enabled)
  369.     end
  370.     super(turn_enabled)
  371.   end
  372.   def move_left(turn_enabled = true)
  373.     if passable?(@x, @y, Input::LEFT)
  374.       $game_party.move_left_party_actors(turn_enabled)
  375.     end
  376.     super(turn_enabled)
  377.   end
  378.   def move_right(turn_enabled = true)
  379.     if passable?(@x, @y, Input::RIGHT)
  380.       $game_party.move_right_party_actors(turn_enabled)
  381.     end
  382.     super(turn_enabled)
  383.   end
  384.   def move_up(turn_enabled = true)
  385.     if passable?(@x, @y, Input::UP)
  386.       $game_party.move_up_party_actors(turn_enabled)
  387.     end
  388.     super(turn_enabled)
  389.   end
  390.   def move_lower_left
  391.     # 下→左、左→下 のどちらかのコースが通行可能な場合
  392.     if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  393.       (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  394.       $game_party.move_lower_left_party_actors
  395.     end
  396.     super
  397.   end
  398.   def move_lower_right
  399.     # 下→右、右→下 のどちらかのコースが通行可能な場合
  400.     if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  401.       (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  402.       $game_party.move_lower_right_party_actors
  403.     end
  404.     super
  405.   end
  406.   def move_upper_left
  407.     # 上→左、左→上 のどちらかのコースが通行可能な場合
  408.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  409.       (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  410.       $game_party.move_upper_left_party_actors
  411.     end
  412.     super
  413.   end
  414.   def move_upper_right
  415.     # 上→右、右→上 のどちらかのコースが通行可能な場合
  416.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  417.       (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  418.       $game_party.move_upper_right_party_actors
  419.     end
  420.     super
  421.   end
  422.   def jump(x_plus, y_plus)
  423.     # 新しい座標を計算
  424.     new_x = @x + x_plus
  425.     new_y = @y + y_plus
  426.     # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
  427.     if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
  428.       $game_party.jump_party_actors(x_plus, y_plus)
  429.     end
  430.     super(x_plus, y_plus)
  431.   end
  432.   
  433.   attr_reader :move_speed
  434.   attr_reader :step_anime
  435. end

  436. end # module Train_Actor
  437. class Game_Party
  438.   include Train_Actor::Game_Party_Module
  439. end
  440. class Game_Player
  441.   include Train_Actor::Game_Player_Module
  442. end
  443. class Spriteset_Map
  444.   include Train_Actor::Spriteset_Map_Module
  445. end
  446. class Scene_Map
  447.   include Train_Actor::Scene_Map_Module
  448. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
203
在线时间
42 小时
注册时间
2017-5-30
帖子
42
3
 楼主| 发表于 2018-4-28 19:14:26 | 只看该作者
重发了一下

点评

如果帖子里面有错误可以使用编辑功能,避免不必要的连贴。  发表于 2018-4-29 15:12
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
213
在线时间
12 小时
注册时间
2018-4-14
帖子
4
4
发表于 2018-4-28 19:57:12 | 只看该作者
也许可以试试插入下面这段在给出的脚本后面
  1. class Sprite_Cursor
  2.     def method_missing name,*args
  3.         nil
  4.     end
  5. end
复制代码

评分

参与人数 1星屑 +70 收起 理由
RyanBern + 70 认可答案

查看全部评分

连个人电脑都没有(甚至连RM都没有)的吃土姬偶然胡言乱语难免出错,还望大家海涵。
投食请私信QAQ
回复 支持 1 反对 0

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
203
在线时间
42 小时
注册时间
2017-5-30
帖子
42
5
 楼主| 发表于 2018-4-28 20:07:28 | 只看该作者
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
203
在线时间
42 小时
注册时间
2017-5-30
帖子
42
6
 楼主| 发表于 2018-4-28 20:08:06 | 只看该作者
吃土姬 发表于 2018-4-28 19:57
也许可以试试插入下面这段在给出的脚本后面
  1. #==============================================================================
  2. # ■ Game_Actors
  3. #------------------------------------------------------------------------------
  4. #  处理角色排列的类。本类的实例请参考
  5. #  $game_actors。
  6. #==============================================================================

  7. class Game_Actors
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     @data = []
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 获取角色
  16.   #     actor_id : 角色 ID
  17.   #--------------------------------------------------------------------------
  18.   def [](actor_id)
  19.     if actor_id > 999 or $data_actors[actor_id] == nil
  20.       return nil
  21.     end
  22.     if @data[actor_id] == nil
  23.       @data[actor_id] = Game_Actor.new(actor_id)
  24.     end
  25.     return @data[actor_id]
  26.   end
  27. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
203
在线时间
42 小时
注册时间
2017-5-30
帖子
42
7
 楼主| 发表于 2018-4-28 20:16:08 | 只看该作者
吃土姬 发表于 2018-4-28 19:57
也许可以试试插入下面这段在给出的脚本后面

非常感谢,已经好了,谢谢你。
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-9-21 13:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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