幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1140|回复: 4

[RMVX] [求助]怎么让人跟在后面走...

[复制链接]

6

主题

7

帖子

79

积分

②入门

积分
79
发表于 2007-1-3 12:51:33 | 显示全部楼层 |阅读模式
行路时...
回复

使用道具 举报

好人卡的 该用户已被删除
发表于 2007-1-3 12:52:39 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

88

主题

5419

帖子

214748万

积分

版主

S素世上最伟大最华丽

Rank: 7Rank: 7Rank: 7

积分
2147483647
QQ
发表于 2007-1-3 12:59:37 | 显示全部楼层
没记错的话那脚本是有问题的....不是指
  1. [i]
复制代码
的问题.....
回复 支持 反对

使用道具 举报

6

主题

129

帖子

616

积分

⑤进阶

↑苦力

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

改好鸟……
呜呼六歌兮歌思迟 溪壑为我回春姿
回复 支持 反对

使用道具 举报

88

主题

5419

帖子

214748万

积分

版主

S素世上最伟大最华丽

Rank: 7Rank: 7Rank: 7

积分
2147483647
QQ
发表于 2007-1-3 15:15:11 | 显示全部楼层
LS那样贴脚本就会出现我上面说的错误...
请用 回复帖子 的 # ...来贴代码....
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2025-6-27 06:33 , Processed in 0.013881 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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