Advertisement
Guest User

wefgbnjmklikmjynhgtrfewq

a guest
May 26th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.21 KB | None | 0 0
  1. #==============================================================================
  2. # [ACE] Caterpillar Jump Fix v1.0
  3. #==============================================================================
  4.  
  5. class Game_Player < Game_Character
  6.  
  7. attr_accessor :player_route
  8. def init_private_members
  9. super
  10. @player_route = []
  11. end
  12.  
  13. def move_straight(d, turn_ok = true)
  14. push_straight_route(d) if passable?(@x, @y, d)
  15. super
  16. end
  17.  
  18. def move_diagonal(horz, vert)
  19. push_diagonal_route(horz, vert) if diagonal_passable?(@x, @y, horz, vert)
  20. super
  21. end
  22.  
  23. def push_straight_route(d)
  24. case d
  25. when 1 then @player_route.push([ROUTE_MOVE_LOWER_L])
  26. when 2 then @player_route.push([ROUTE_MOVE_DOWN])
  27. when 3 then @player_route.push([ROUTE_MOVE_LOWER_R])
  28. when 4 then @player_route.push([ROUTE_MOVE_LEFT])
  29. when 6 then @player_route.push([ROUTE_MOVE_RIGHT])
  30. when 7 then @player_route.push([ROUTE_MOVE_UPPER_L])
  31. when 8 then @player_route.push([ROUTE_MOVE_UP])
  32. when 9 then @player_route.push([ROUTE_MOVE_UPPER_R])
  33. end
  34. end
  35.  
  36. def push_diagonal_route(horz, vert)
  37. d = case [horz, vert]
  38. when [4, 2] then 1
  39. when [6, 2] then 3
  40. when [4, 8] then 7
  41. when [6, 8] then 9
  42. end
  43. push_straight_route(d)
  44. end
  45.  
  46. alias wecoc_fix_jump jump unless $@
  47. def jump(x_plus, y_plus)
  48. wecoc_fix_jump(x_plus, y_plus)
  49. @player_route.push([ROUTE_JUMP, x_plus, y_plus])
  50. end
  51. end
  52.  
  53. class Game_Follower < Game_Character
  54.  
  55. attr_accessor :player_route
  56. def init_private_members
  57. super
  58. @player_route = []
  59. end
  60.  
  61. def move_straight(d, turn_ok = true)
  62. push_straight_route(d) if passable?(@x, @y, d)
  63. super
  64. end
  65.  
  66. def move_diagonal(horz, vert)
  67. push_diagonal_route(horz, vert) if diagonal_passable?(@x, @y, horz, vert)
  68. super
  69. end
  70.  
  71. def push_straight_route(d)
  72. case d
  73. when 1 then @player_route.push([ROUTE_MOVE_LOWER_L])
  74. when 2 then @player_route.push([ROUTE_MOVE_DOWN])
  75. when 3 then @player_route.push([ROUTE_MOVE_LOWER_R])
  76. when 4 then @player_route.push([ROUTE_MOVE_LEFT])
  77. when 6 then @player_route.push([ROUTE_MOVE_RIGHT])
  78. when 7 then @player_route.push([ROUTE_MOVE_UPPER_L])
  79. when 8 then @player_route.push([ROUTE_MOVE_UP])
  80. when 9 then @player_route.push([ROUTE_MOVE_UPPER_R])
  81. end
  82. end
  83.  
  84. def push_diagonal_route(horz, vert)
  85. array = [horz, vert]
  86. d = case array
  87. when [4, 2] then 1
  88. when [6, 2] then 3
  89. when [4, 8] then 7
  90. when [6, 8] then 9
  91. end
  92. push_straight_route(d)
  93. end
  94.  
  95. alias wecoc_fix_jump jump unless $@
  96. def jump(x_plus, y_plus)
  97. wecoc_fix_jump(x_plus, y_plus)
  98. @player_route.push([ROUTE_JUMP, x_plus, y_plus])
  99. end
  100.  
  101. alias wecoc_fix_upd update unless $@
  102. def update
  103. unless self.moving? or self.jumping?
  104. if @preceding_character.moving? or @preceding_character.jumping?
  105. if @preceding_character.player_route.size != 0
  106. movement = @preceding_character.player_route[0]
  107. new_x = @x
  108. new_y = @y
  109. case movement[0]
  110. when ROUTE_MOVE_LOWER_L
  111. new_x -= 1
  112. new_y += 1
  113. when ROUTE_MOVE_DOWN
  114. new_y += 1
  115. when ROUTE_MOVE_LOWER_R
  116. new_x += 1
  117. new_y += 1
  118. when ROUTE_MOVE_LEFT
  119. new_x -= 1
  120. when ROUTE_MOVE_RIGHT
  121. new_x += 1
  122. when ROUTE_MOVE_UPPER_L
  123. new_x -= 1
  124. new_y -= 1
  125. when ROUTE_MOVE_UP
  126. new_y -= 1
  127. when ROUTE_MOVE_UPPER_R
  128. new_x += 1
  129. new_y -= 1
  130. when ROUTE_JUMP
  131. new_x += movement[1]
  132. new_y += movement[2]
  133. end
  134. p_cords = [@preceding_character.x, @preceding_character.y]
  135. if p_cords != [new_x, new_y]
  136. case movement[0]
  137. when ROUTE_MOVE_LOWER_L then move_diagonal(4, 2)
  138. when ROUTE_MOVE_DOWN then move_straight(2)
  139. when ROUTE_MOVE_LOWER_R then move_diagonal(6, 2)
  140. when ROUTE_MOVE_LEFT then move_straight(4)
  141. when ROUTE_MOVE_RIGHT then move_straight(6)
  142. when ROUTE_MOVE_UPPER_L then move_diagonal(4, 8)
  143. when ROUTE_MOVE_UP then move_straight(8)
  144. when ROUTE_MOVE_UPPER_R then move_diagonal(6, 8)
  145. when ROUTE_JUMP then jump(movement[1], movement[2])
  146. end
  147. @preceding_character.player_route.shift
  148. end
  149. end
  150. end
  151. end
  152. wecoc_fix_upd
  153. end
  154. end
  155.  
  156. class Game_Followers
  157. alias wecoc_syn synchronize unless $@
  158. def synchronize(x, y, d)
  159. wecoc_syn(x, y, d)
  160. restore_route
  161. end
  162.  
  163. def restore_route
  164. each do |follower|
  165. follower.player_route = []
  166. end
  167. $game_player.player_route = []
  168. end
  169. end
  170.  
  171. class Game_Interpreter
  172. #--------------------------------------------------------------------------
  173. # * Gather Followers
  174. #--------------------------------------------------------------------------
  175. alias wecoc_command_217 command_217 unless $@
  176. def command_217
  177. wecoc_command_217
  178. $game_player.followers.restore_route
  179. end
  180. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement