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

Project1

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

[已经过期] RMXP人物跟随脚本出错....新人求指教

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2013-10-13
帖子
10
跳转到指定楼层
1
发表于 2013-11-12 00:28:41 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 myownroc 于 2013-11-12 01:08 编辑

唔....在下新人一枚,想做队友跟随效果...于是在论坛里搜到了队友跟随脚本...
不过测试总是出现这样的问题:

有的时候还会是227行....
跟随人物只有一人...
我也没有下载其他的脚本..
请问问题出在何处捏QAQ

若能解决在下感激不尽QAQ!!!!!

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

点评

脚本要用脚本框,就像你看到的样子  发表于 2013-11-12 01:09

Lv3.寻梦者

梦石
0
星屑
3570
在线时间
3064 小时
注册时间
2011-11-17
帖子
980
2
发表于 2013-11-12 00:38:29 | 只看该作者
主站上任何脚本如果你没有主观修改基于默认工程一般都是无错的  错误的原因大多在于你用了几个脚本互相冲突 碰到这种事情 最好直接发工程 你发个没有错的脚本 别人是没法帮你解决的
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
100
在线时间
211 小时
注册时间
2011-8-16
帖子
300
3
发表于 2013-11-12 10:15:05 | 只看该作者
楼上正解,不过很奇怪的说,脚本只有433行...为什么446行报错?!
显然上下文还有脚本。
RPGMaker 脚本/学习交流群:143356012
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2013-10-13
帖子
10
4
 楼主| 发表于 2013-11-12 16:30:02 | 只看该作者
yagami 发表于 2013-11-12 00:38
主站上任何脚本如果你没有主观修改基于默认工程一般都是无错的  错误的原因大多在于你用了几个脚本互相冲突 ...

QUQ谢谢回复,于是我把工程文件打包了
因为超过2m不能传附件所以传了百度盘。。。

还有还有QAQ现在倒是不提示出错了...
但是脚本好像没有生效的样子QAQ....不知问题出在哪儿...球高手指教QAQ!!!谢谢!!!
http://pan.baidu.com/s/1Ebktt
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2013-10-13
帖子
10
5
 楼主| 发表于 2013-11-12 16:31:14 | 只看该作者
774741359 发表于 2013-11-12 10:15
楼上正解,不过很奇怪的说,脚本只有433行...为什么446行报错?!
显然上下文还有脚本。 ...

谢谢回复QUQ.....我也不清楚QAQ可能是当时自带了空格的缘故?!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 04:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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