Project1

标题: VX有队员跟随的脚本吗? [打印本页]

作者: 小鼠标    时间: 2008-2-5 20:26
提示: 作者被禁止或删除 内容自动屏蔽
作者: 越前リョーマ    时间: 2008-2-5 20:39
暂时没有。

于招S大叔定作。
作者: 小星子    时间: 2008-2-5 21:19
已经在亿万现在做的游戏里看到了,不过据说功能很简单
作者: 小鼠标    时间: 2008-2-5 21:58
提示: 作者被禁止或删除 内容自动屏蔽
作者: 雪流星    时间: 2008-2-15 15:56
来源:
http://www.rpgrevolution.com/forums/?showtopic=8040

脚本:
  1. class Game_Player
  2. #--------------------------------------------------------------------------
  3. # * Move Down
  4. # turn_enabled : a flag permits direction change on that spot
  5. #--------------------------------------------------------------------------
  6. def move_down(turn_enabled = true)
  7. super(turn_enabled)
  8. end
  9. #--------------------------------------------------------------------------
  10. # * Move Left
  11. # turn_enabled : a flag permits direction change on that spot
  12. #--------------------------------------------------------------------------
  13. def move_left(turn_enabled = true)
  14. super(turn_enabled)
  15. end
  16. #--------------------------------------------------------------------------
  17. # * Move Right
  18. # turn_enabled : a flag permits direction change on that spot
  19. #--------------------------------------------------------------------------
  20. def move_right(turn_enabled = true)
  21. super(turn_enabled)
  22. end
  23. #--------------------------------------------------------------------------
  24. # * Move up
  25. # turn_enabled : a flag permits direction change on that spot
  26. #--------------------------------------------------------------------------
  27. def move_up(turn_enabled = true)
  28. super(turn_enabled)
  29. end
  30. #--------------------------------------------------------------------------
  31. # * Move Lower Left
  32. #--------------------------------------------------------------------------
  33. def move_lower_left
  34. super
  35. end
  36. #--------------------------------------------------------------------------
  37. # * Move Lower Right
  38. #--------------------------------------------------------------------------
  39. def move_lower_right
  40. super
  41. end
  42. #--------------------------------------------------------------------------
  43. # * Move Upper Left
  44. #--------------------------------------------------------------------------
  45. def move_upper_left
  46. super
  47. end
  48. #--------------------------------------------------------------------------
  49. # * Move Upper Right
  50. #--------------------------------------------------------------------------
  51. def move_upper_right
  52. super
  53. end
  54. end

  55. class Game_Follower < Game_Character
  56. #--------------------------------------------------------------------------
  57. # * Public Instance Variables
  58. #--------------------------------------------------------------------------
  59. attr_reader :actor
  60. attr_accessor :move_speed
  61. #--------------------------------------------------------------------------
  62. # * Object Initialization
  63. #--------------------------------------------------------------------------
  64. def initialize(actor)
  65. super()
  66. @through = true
  67. @actor = actor
  68. end
  69. #--------------------------------------------------------------------------
  70. # * Set Actor
  71. #--------------------------------------------------------------------------
  72. def actor=(actor)
  73. @actor = actor
  74. setup
  75. end
  76. #--------------------------------------------------------------------------
  77. # * Setup
  78. #--------------------------------------------------------------------------
  79. def setup
  80. if @actor != nil
  81. @character_name = $game_actors[@actor].character_name
  82. @character_index = $game_actors[@actor].character_index
  83. else
  84. @character_name = ""
  85. @character_index = 0
  86. end
  87. @opacity = 255
  88. @blend_type = 0
  89. @priority_type = 0
  90. end

  91. #--------------------------------------------------------------------------
  92. # * Screen Z
  93. #--------------------------------------------------------------------------
  94. def screen_z
  95. if $game_player.x == @x and $game_player.y == @y
  96. return $game_player.screen_z - 1
  97. end
  98. super
  99. end
  100. #--------------------------------------------------------------------------
  101. # * Same Position Starting Determinant (Disabled)
  102. #--------------------------------------------------------------------------
  103. def check_event_trigger_here(triggers)
  104. result = false
  105. return result
  106. end
  107. #--------------------------------------------------------------------------
  108. # * Front Envent Starting Determinant (Disabled)
  109. #--------------------------------------------------------------------------
  110. def check_event_trigger_there(triggers)
  111. result = false
  112. return result
  113. end
  114. #--------------------------------------------------------------------------
  115. # * Touch Event Starting Determinant (Disabled)
  116. #--------------------------------------------------------------------------
  117. def check_event_trigger_touch(x, y)
  118. result = false
  119. return result
  120. end
  121. end

  122. class Spriteset_Map
  123. alias_method :spriteset_map_create_characters, :create_characters
  124. def create_characters
  125. spriteset_map_create_characters
  126. $game_party.followers.each do |char|
  127. @character_sprites << Sprite_Character.new(@viewport1, char)
  128. end
  129. end
  130. end

  131. class Game_Party
  132. #--------------------------------------------------------------------------
  133. # * Constants
  134. #--------------------------------------------------------------------------
  135. MAX_SIZE = 8
  136. CATERPILLAR = 2
  137. #--------------------------------------------------------------------------
  138. # * Public Instance Variables
  139. #--------------------------------------------------------------------------
  140. attr_reader :followers
  141. #--------------------------------------------------------------------------
  142. # * Object Initialization
  143. #--------------------------------------------------------------------------
  144. alias_method :trick_caterpillar_party_initialize, :initialize
  145. def initialize
  146. trick_caterpillar_party_initialize
  147. @followers = Array.new(MAX_SIZE - 1) {Game_Follower.new(nil)}
  148. @move_list = []
  149. end
  150. #--------------------------------------------------------------------------
  151. # * Update Followers
  152. #--------------------------------------------------------------------------
  153. def update_followers
  154. flag = $game_player.transparent || $game_switches[CATERPILLAR]
  155. @followers.each_with_index do |char, i|
  156. char.actor = @actors[i + 1]
  157. char.move_speed = $game_player.move_speed
  158. if $game_player.dash?
  159. char.move_speed += 1
  160. end
  161. char.update
  162. char.transparent = flag
  163. end
  164. end
  165. #--------------------------------------------------------------------------
  166. # * Move To Party
  167. #--------------------------------------------------------------------------
  168. def moveto_party(x, y)
  169. @followers.each {|char| char.moveto(x, y)}
  170. @move_list.clear
  171. end
  172. #--------------------------------------------------------------------------
  173. # * Move Party
  174. #--------------------------------------------------------------------------
  175. def move_party
  176. @move_list.each_index do |i|
  177. if @followers[i] == nil
  178. @move_list[i...@move_list.size] = nil
  179. next
  180. end
  181. case @move_list[i].type
  182. when 2
  183. @followers[i].move_down(*@move_list[i].args)
  184. when 4
  185. @followers[i].move_left(*@move_list[i].args)
  186. when 6
  187. @followers[i].move_right(*@move_list[i].args)
  188. when 8
  189. @followers[i].move_up(*@move_list[i].args)
  190. when j
  191. @followers[i].move_lower_left
  192. when 3
  193. @followers[i].move_lower_right
  194. when 7
  195. @followers[i].move_upper_left
  196. when 9
  197. @followers[i].move_upper_right
  198. when 5
  199. @followers[i].jump(*@move_list[i].args)
  200. end
  201. end
  202. end
  203. #--------------------------------------------------------------------------
  204. # * Add Move List
  205. #--------------------------------------------------------------------------
  206. def update_move(type, *args)
  207. move_party
  208. @move_list.unshift(Game_MoveListElement.new(type, args))
  209. end
  210. end

  211. class Game_MoveListElement
  212. #--------------------------------------------------------------------------
  213. # * Object Initialization
  214. #--------------------------------------------------------------------------
  215. def initialize(type, args)
  216. @type = type
  217. @args = args
  218. end
  219. #--------------------------------------------------------------------------
  220. # * Type
  221. #--------------------------------------------------------------------------
  222. def type
  223. return @type
  224. end
  225. #--------------------------------------------------------------------------
  226. # * Args
  227. #--------------------------------------------------------------------------
  228. def args
  229. return @args
  230. end
  231. end

  232. class Game_Player
  233. #--------------------------------------------------------------------------
  234. # * Public Instance Variables
  235. #--------------------------------------------------------------------------
  236. attr_reader :move_speed

  237. #--------------------------------------------------------------------------
  238. # * Update
  239. #--------------------------------------------------------------------------
  240. alias_method :trick_caterpillar_player_update, :update
  241. def update
  242. $game_party.update_followers
  243. trick_caterpillar_player_update
  244. end
  245. #--------------------------------------------------------------------------
  246. # * Moveto
  247. #--------------------------------------------------------------------------
  248. alias_method :trick_caterpillar_player_moveto, :moveto
  249. def moveto(x, y)
  250. $game_party.moveto_party(x, y)
  251. trick_caterpillar_player_moveto(x, y)
  252. end
  253. #--------------------------------------------------------------------------
  254. # * Move Down
  255. #--------------------------------------------------------------------------
  256. alias_method :trick_caterpillar_player_move_down, :move_down
  257. def move_down(turn_enabled = true)
  258. if passable?(@x, @y+1)
  259. $game_party.update_move(2, turn_enabled)
  260. end
  261. trick_caterpillar_player_move_down(turn_enabled)
  262. end
  263. #--------------------------------------------------------------------------
  264. # * Move Left
  265. #--------------------------------------------------------------------------
  266. alias_method :trick_caterpillar_player_move_left, :move_left
  267. def move_left(turn_enabled = true)
  268. if passable?(@x-1, @y)
  269. $game_party.update_move(4, turn_enabled)
  270. end
  271. trick_caterpillar_player_move_left(turn_enabled)
  272. end
  273. #--------------------------------------------------------------------------
  274. # * Move Right
  275. #--------------------------------------------------------------------------
  276. alias_method :trick_caterpillar_player_move_right, :move_right
  277. def move_right(turn_enabled = true)
  278. if passable?(@x+1, @y)
  279. $game_party.update_move(6, turn_enabled)
  280. end
  281. trick_caterpillar_player_move_right(turn_enabled)
  282. end
  283. #--------------------------------------------------------------------------
  284. # * Move Up
  285. #--------------------------------------------------------------------------
  286. alias_method :trick_caterpillar_player_move_up, :move_up
  287. def move_up(turn_enabled = true)
  288. if passable?(@x, @y-1)
  289. $game_party.update_move(8, turn_enabled)
  290. end
  291. trick_caterpillar_player_move_up(turn_enabled)
  292. end
  293. #--------------------------------------------------------------------------
  294. # * Move Lower Left
  295. #--------------------------------------------------------------------------
  296. alias_method :trick_caterpillar_player_move_lower_left, :move_lower_left
  297. def move_lower_left
  298. if passable?(@x - 1, @y) and passable?(@x, @y + 1)
  299. $game_party.update_move(1)
  300. end
  301. trick_caterpillar_player_move_lower_left
  302. end
  303. #--------------------------------------------------------------------------
  304. # * Move Lower Right
  305. #--------------------------------------------------------------------------
  306. alias_method :trick_caterpillar_player_move_lower_right, :move_lower_right
  307. def move_lower_right
  308. if passable?(@x + 1, @y) and passable?(@x, @y + 1)
  309. $game_party.update_move(3)
  310. end
  311. trick_caterpillar_player_move_lower_right
  312. end
  313. #--------------------------------------------------------------------------
  314. # * Move Upper Left
  315. #--------------------------------------------------------------------------
  316. alias_method :trick_caterpillar_player_move_upper_left, :move_upper_left
  317. def move_upper_left
  318. if passable?(@x - 1, @y) and passable?(@x, @y - 1)
  319. $game_party.update_move(7)
  320. end
  321. trick_caterpillar_player_move_upper_left
  322. end
  323. #--------------------------------------------------------------------------
  324. # * Move Upper Right
  325. #--------------------------------------------------------------------------
  326. alias_method :trick_caterpillar_player_move_upper_right, :move_upper_right
  327. def move_upper_right
  328. if passable?(@x + 1, @y) and passable?(@x, @y - 1)
  329. $game_party.update_move(9)
  330. end
  331. trick_caterpillar_player_move_upper_right
  332. end
  333. #--------------------------------------------------------------------------
  334. # * Jump
  335. #--------------------------------------------------------------------------
  336. alias_method :trick_caterpillar_player_jump, :jump
  337. def jump(x_plus, y_plus)
  338. new_x = @x + x_plus
  339. new_y = @y + y_plus
  340. if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y)
  341. $game_party.update_move(5, x_plus, y_plus)
  342. end
  343. trick_caterpillar_player_jump(x_plus, y_plus)
  344. end
  345. end###########
  346. ###########
  347. ###########
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1