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

Project1

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

[已经解决] ONEWateR大进 关于你给的脚本出现的BUG求改

 关闭 [复制链接]

Lv3.寻梦者

梦石
0
星屑
4097
在线时间
1081 小时
注册时间
2008-5-17
帖子
218

开拓者

跳转到指定楼层
1
发表于 2009-7-19 10:06:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 无名小兵 于 2009-7-19 13:16 编辑

首先 《HP为0时不参加战斗》
小BUG是 当角色有2个以上HP为0时 第2个死亡的人依然会以死亡状态出现在战斗 附你给的脚本求改
  1. class Scene_Map

  2.   def call_battle

  3.   #--------------------------------------------------------------------------

  4.     $actor_id = []

  5.     for actor in $game_party.actors

  6.       $actor_id.push(actor.id)

  7.     end

  8.   for actor in $game_party.actors

  9.    $game_party.remove_actor(actor.id) if actor.dead?

  10.   end
  11.    
  12.   #--------------------------------------------------------------------------

  13.     $game_temp.battle_calling = false

  14.     $game_temp.menu_calling = false

  15.     $game_temp.menu_beep = false

  16.     $game_player.make_encounter_count

  17.     $game_temp.map_bgm = $game_system.playing_bgm

  18.     $game_system.bgm_stop

  19.     $game_system.se_play($data_system.battle_start_se)

  20.     $game_system.bgm_play($game_system.battle_bgm)

  21.     $game_player.straighten

  22.     $scene = Scene_Battle.new

  23.   end

  24. end

  25. class Scene_Battle

  26.   def battle_end(result)
  27.     Graphics.frame_rate = 40

  28.   #--------------------------------------------------------------------------

  29.     for i in 0..$actor_id.size-1

  30.       $game_party.actors[i] = $game_actors[$actor_id[i]]

  31.     end

  32.     $game_player.refresh

  33.   #--------------------------------------------------------------------------

  34.     $game_temp.in_battle = false

  35.     $game_party.clear_actions

  36.     for actor in $game_party.actors

  37.       actor.remove_states_battle

  38.     end

  39.     $game_troop.enemies.clear

  40.     if $game_temp.battle_proc != nil

  41.       $game_temp.battle_proc.call(result)

  42.       $game_temp.battle_proc = nil

  43.     end

  44.     $scene = Scene_Map.new

  45.   end

  46. end
复制代码
第2个《跟随脚本人物死亡不在大地图上显示其行走图》
小BUG是 第1位置的角色死了也还在那徘徊,没有消失。=。=从第2个人开始是正常的。附你给的脚本求改
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================


  4. # ————————————————————————————————————

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

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

  13. module Train_Actor




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





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





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

  31. class Game_Party_Actor < Game_Character
  32. def initialize
  33. super()
  34. @through = true
  35. end
  36. def setup(actor)
  37. # キャラクターのファイル名と色相を設定
  38. if actor != nil
  39. @character_name = actor.character_name
  40. @character_hue = actor.character_hue
  41. #========此处修改=================
  42. @animation_loop_id = actor.tz_id != -1 ? TaoZhuan::EQUIP[actor.tz_id][18] : 0
  43. #=================================
  44. else
  45. @character_name = ""
  46. @character_hue = 0
  47. end
  48. # 不透明度と合成方法を初期化
  49. @opacity = 255
  50. @blend_type = 0
  51. end
  52. def screen_z(height = 0)
  53. if $game_player.x == @x and $game_player.y == @y
  54. return $game_player.screen_z(height) - 1
  55. end
  56. super(height)
  57. end
  58. #--------------------------------------------------------------------------
  59. # ● 下に移動
  60. # turn_enabled : その場での向き変更を許可するフラグ
  61. #--------------------------------------------------------------------------
  62. def move_down(turn_enabled = true)
  63. # 下を向く
  64. if turn_enabled
  65. turn_down
  66. end
  67. # 通行可能な場合
  68. if passable?(@x, @y, Input::DOWN)
  69. # 下を向く
  70. turn_down
  71. # 座標を更新
  72. @y += 1
  73. end
  74. end
  75. #--------------------------------------------------------------------------
  76. # ● 左に移動
  77. # turn_enabled : その場での向き変更を許可するフラグ
  78. #--------------------------------------------------------------------------
  79. def move_left(turn_enabled = true)
  80. # 左を向く
  81. if turn_enabled
  82. turn_left
  83. end
  84. # 通行可能な場合
  85. if passable?(@x, @y, Input::LEFT)
  86. # 左を向く
  87. turn_left
  88. # 座標を更新
  89. @x -= 1
  90. end
  91. end
  92. #--------------------------------------------------------------------------
  93. # ● 右に移動
  94. # turn_enabled : その場での向き変更を許可するフラグ
  95. #--------------------------------------------------------------------------
  96. def move_right(turn_enabled = true)
  97. # 右を向く
  98. if turn_enabled
  99. turn_right
  100. end
  101. # 通行可能な場合
  102. if passable?(@x, @y, Input::RIGHT)
  103. # 右を向く
  104. turn_right
  105. # 座標を更新
  106. @x += 1
  107. end
  108. end
  109. #--------------------------------------------------------------------------
  110. # ● 上に移動
  111. # turn_enabled : その場での向き変更を許可するフラグ
  112. #--------------------------------------------------------------------------
  113. def move_up(turn_enabled = true)
  114. # 上を向く
  115. if turn_enabled
  116. turn_up
  117. end
  118. # 通行可能な場合
  119. if passable?(@x, @y, Input::UP)
  120. # 上を向く
  121. turn_up
  122. # 座標を更新
  123. @y -= 1
  124. end
  125. end
  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. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  137. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  138. # 座標を更新
  139. @x -= 1
  140. @y += 1
  141. end
  142. end
  143. #--------------------------------------------------------------------------
  144. # ● 右下に移動
  145. #--------------------------------------------------------------------------
  146. def move_lower_right
  147. # 向き固定でない場合
  148. unless @direction_fix
  149. # 左向きだった場合は右を、上向きだった場合は下を向く
  150. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
  151. end
  152. # 下→右、右→下 のどちらかのコースが通行可能な場合
  153. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  154. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  155. # 座標を更新
  156. @x += 1
  157. @y += 1
  158. end
  159. end
  160. #--------------------------------------------------------------------------
  161. # ● 左上に移動
  162. #--------------------------------------------------------------------------
  163. def move_upper_left
  164. # 向き固定でない場合
  165. unless @direction_fix
  166. # 右向きだった場合は左を、下向きだった場合は上を向く
  167. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
  168. end
  169. # 上→左、左→上 のどちらかのコースが通行可能な場合
  170. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  171. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  172. # 座標を更新
  173. @x -= 1
  174. @y -= 1
  175. end
  176. end
  177. #--------------------------------------------------------------------------
  178. # ● 右上に移動
  179. #--------------------------------------------------------------------------
  180. def move_upper_right
  181. # 向き固定でない場合
  182. unless @direction_fix
  183. # 左向きだった場合は右を、下向きだった場合は上を向く
  184. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
  185. end
  186. # 上→右、右→上 のどちらかのコースが通行可能な場合
  187. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  188. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  189. # 座標を更新
  190. @x += 1
  191. @y -= 1
  192. end
  193. end
  194. attr_writer :move_speed
  195. attr_writer :step_anime
  196. end
  197. module Spriteset_Map_Module
  198. def setup_actor_character_sprites?
  199. return @setup_actor_character_sprites_flag != nil
  200. end
  201. def setup_actor_character_sprites(characters)
  202. if !setup_actor_character_sprites?
  203. index_game_player = 0
  204. @character_sprites.each_index do |i|
  205. if @character_sprites[i].character.instance_of?(Game_Player)
  206. index_game_player = i
  207. break
  208. end
  209. end
  210. for character in characters.reverse
  211. @character_sprites.unshift(
  212. Sprite_Character.new(@viewport1, character)
  213. )
  214. end
  215. @setup_actor_character_sprites_flag = true
  216. end
  217. end
  218. end
  219. module Scene_Map_Module
  220. def setup_actor_character_sprites(characters)
  221. @spriteset.setup_actor_character_sprites(characters)
  222. end
  223. end
  224. module Game_Party_Module
  225. def set_transparent_actors(transparent)
  226. @transparent = transparent
  227. end
  228. def setup_actor_character_sprites
  229. if @characters == nil
  230. @characters = []
  231. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  232. @characters.push(Game_Party_Actor.new)
  233. end
  234. end
  235. new_actor = []
  236. for actor in actors
  237.   new_actor.push(actor) if !actor.dead?
  238. end

  239. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  240. @characters[i - 1].setup(new_actor[i])
  241. end


  242. if $scene.class.method_defined?('setup_actor_character_sprites')
  243. $scene.setup_actor_character_sprites(@characters)
  244. end
  245. end
  246. def update_party_actors
  247. setup_actor_character_sprites
  248. transparent = $game_player.transparent
  249. if transparent == false
  250. if TRANSPARENT_SWITCH
  251. transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
  252. end
  253. end
  254. for character in @characters
  255. character.transparent = transparent
  256. character.move_speed = $game_player.move_speed
  257. character.step_anime = $game_player.step_anime
  258. character.update
  259. end
  260. end
  261. def moveto_party_actors( x, y )
  262. setup_actor_character_sprites
  263. for character in @characters
  264. character.moveto( x, y )
  265. end
  266. if @move_list == nil
  267. @move_list = []
  268. end
  269. move_list_setup
  270. end
  271. def move_party_actors
  272. if @move_list == nil
  273. @move_list = []
  274. move_list_setup
  275. end
  276. @move_list.each_index do |i|
  277. if @characters[i] != nil
  278. case @move_list[i].type
  279. when Input::DOWN
  280. @characters[i].move_down(@move_list[i].args[0])
  281. when Input::LEFT
  282. @characters[i].move_left(@move_list[i].args[0])
  283. when Input::RIGHT
  284. @characters[i].move_right(@move_list[i].args[0])
  285. when Input::UP
  286. @characters[i].move_up(@move_list[i].args[0])
  287. when DOWN_LEFT
  288. @characters[i].move_lower_left
  289. when DOWN_RIGHT
  290. @characters[i].move_lower_right
  291. when UP_LEFT
  292. @characters[i].move_upper_left
  293. when UP_RIGHT
  294. @characters[i].move_upper_right
  295. when JUMP
  296. @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  297. end
  298. end
  299. end
  300. end
  301. class Move_List_Element
  302. def initialize(type,args)
  303. @type = type
  304. @args = args
  305. end
  306. def type() return @type end
  307. def args() return @args end
  308. end
  309. def move_list_setup
  310. for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  311. @move_list[i] = nil
  312. end
  313. end
  314. def add_move_list(type,*args)
  315. @move_list.unshift(Move_List_Element.new(type,args)).pop
  316. end
  317. def move_down_party_actors(turn_enabled = true)
  318. move_party_actors
  319. add_move_list(Input::DOWN,turn_enabled)
  320. end
  321. def move_left_party_actors(turn_enabled = true)
  322. move_party_actors
  323. add_move_list(Input::LEFT,turn_enabled)
  324. end
  325. def move_right_party_actors(turn_enabled = true)
  326. move_party_actors
  327. add_move_list(Input::RIGHT,turn_enabled)
  328. end
  329. def move_up_party_actors(turn_enabled = true)
  330. move_party_actors
  331. add_move_list(Input::UP,turn_enabled)
  332. end
  333. def move_lower_left_party_actors
  334. move_party_actors
  335. add_move_list(DOWN_LEFT)
  336. end
  337. def move_lower_right_party_actors
  338. move_party_actors
  339. add_move_list(DOWN_RIGHT)
  340. end
  341. def move_upper_left_party_actors
  342. move_party_actors
  343. add_move_list(UP_LEFT)
  344. end
  345. def move_upper_right_party_actors
  346. move_party_actors
  347. add_move_list(UP_RIGHT)
  348. end
  349. def jump_party_actors(x_plus, y_plus)
  350. move_party_actors
  351. add_move_list(JUMP,x_plus, y_plus)
  352. end
  353. end
  354. module Game_Player_Module
  355. def update
  356. $game_party.update_party_actors
  357. super
  358. end
  359. def moveto( x, y )
  360. $game_party.moveto_party_actors( x, y )
  361. super( x, y )
  362. end
  363. def move_down(turn_enabled = true)
  364. if passable?(@x, @y, Input::DOWN)
  365. $game_party.move_down_party_actors(turn_enabled)
  366. end
  367. super(turn_enabled)
  368. end
  369. def move_left(turn_enabled = true)
  370. if passable?(@x, @y, Input::LEFT)
  371. $game_party.move_left_party_actors(turn_enabled)
  372. end
  373. super(turn_enabled)
  374. end
  375. def move_right(turn_enabled = true)
  376. if passable?(@x, @y, Input::RIGHT)
  377. $game_party.move_right_party_actors(turn_enabled)
  378. end
  379. super(turn_enabled)
  380. end
  381. def move_up(turn_enabled = true)
  382. if passable?(@x, @y, Input::UP)
  383. $game_party.move_up_party_actors(turn_enabled)
  384. end
  385. super(turn_enabled)
  386. end
  387. def move_lower_left
  388. # 下→左、左→下 のどちらかのコースが通行可能な場合
  389. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  390. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  391. $game_party.move_lower_left_party_actors
  392. end
  393. super
  394. end
  395. def move_lower_right
  396. # 下→右、右→下 のどちらかのコースが通行可能な場合
  397. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  398. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  399. $game_party.move_lower_right_party_actors
  400. end
  401. super
  402. end
  403. def move_upper_left
  404. # 上→左、左→上 のどちらかのコースが通行可能な場合
  405. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  406. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  407. $game_party.move_upper_left_party_actors
  408. end
  409. super
  410. end
  411. def move_upper_right
  412. # 上→右、右→上 のどちらかのコースが通行可能な場合
  413. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  414. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  415. $game_party.move_upper_right_party_actors
  416. end
  417. super
  418. end
  419. def jump(x_plus, y_plus)
  420. # 新しい座標を計算
  421. new_x = @x + x_plus
  422. new_y = @y + y_plus
  423. # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
  424. if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
  425. $game_party.jump_party_actors(x_plus, y_plus)
  426. end
  427. super(x_plus, y_plus)
  428. end
  429. attr_reader :move_speed
  430. attr_reader :step_anime
  431. end
  432. end # module Train_Actor
  433. class Game_Party
  434. include Train_Actor::Game_Party_Module
  435. end
  436. class Game_Player
  437. include Train_Actor::Game_Player_Module
  438. end
  439. class Spriteset_Map
  440. include Train_Actor::Spriteset_Map_Module
  441. end
  442. class Scene_Map
  443. include Train_Actor::Scene_Map_Module
  444. end

  445. #==============================================================================
  446. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  447. #==============================================================================
复制代码

Lv3.寻梦者

孤独守望

梦石
0
星屑
3137
在线时间
1535 小时
注册时间
2006-10-16
帖子
4321

开拓者贵宾

2
发表于 2009-7-19 11:55:41 | 只看该作者
第一个脚本是删除回滚引起的小问题,换成如下脚本即可
  1. class Scene_Map
  2.   def call_battle
  3.   #--------------------------------------------------------------------------
  4.     $actor_id = []
  5.     for actor in $game_party.actors
  6.       $actor_id.push(actor.id)
  7.     end
  8.     actor2 = $game_party.actors.clone
  9.   for actor in actor2
  10.    $game_party.remove_actor(actor.id) if actor.dead?
  11.   end
  12.   #--------------------------------------------------------------------------
  13.     $game_temp.battle_calling = false
  14.     $game_temp.menu_calling = false
  15.     $game_temp.menu_beep = false
  16.     $game_player.make_encounter_count
  17.     $game_temp.map_bgm = $game_system.playing_bgm
  18.     $game_system.bgm_stop
  19.     $game_system.se_play($data_system.battle_start_se)
  20.     $game_system.bgm_play($game_system.battle_bgm)
  21.     $game_player.straighten
  22.     $scene = Scene_Battle.new
  23.   end
  24. end
  25. class Scene_Battle
  26.   def battle_end(result)
  27.     Graphics.frame_rate = 40
  28.   #--------------------------------------------------------------------------
  29.     for i in 0..$actor_id.size-1
  30.       $game_party.actors[i] = $game_actors[$actor_id[i]]
  31.     end
  32.     $game_player.refresh
  33.   #--------------------------------------------------------------------------
  34.     $game_temp.in_battle = false
  35.     $game_party.clear_actions
  36.     for actor in $game_party.actors
  37.       actor.remove_states_battle
  38.     end
  39.     $game_troop.enemies.clear
  40.     if $game_temp.battle_proc != nil
  41.       $game_temp.battle_proc.call(result)
  42.       $game_temp.battle_proc = nil
  43.     end
  44.     $scene = Scene_Map.new
  45.   end
  46. end
复制代码
第二个就交给一水你啦……匿
菩提本非树,明镜本非台。回头自望路漫漫。不求姻缘,但求再见。
本来无一物,何处惹尘埃。风打浪吹雨不来。荒庭遍野,扶摇难接。
不知道多久更新一次的博客
回复 支持 反对

使用道具 举报

Lv1.梦旅人

B

梦石
0
星屑
50
在线时间
26 小时
注册时间
2007-8-26
帖子
3693
3
发表于 2009-7-19 13:04:40 | 只看该作者
本帖最后由 ONEWateR 于 2009-7-19 13:06 编辑

全都交给我好了……一切因我而起……

ps:给别人写脚本果然不擅长,bug居多~
还是为自己服务好了~
  1. class Game_Party
  2.   
  3.   def remove_actor(actor_id)
  4.    
  5.     if actor_id.is_a?(Array)
  6.    
  7.       for i in actor_id
  8.         
  9.         @actors.delete($game_actors[i])
  10.         
  11.       end
  12.       
  13.     else
  14.       
  15.     @actors.delete($game_actors[actor_id])
  16.         
  17.     end
  18.   
  19.   $game_player.refresh
  20.   
  21.   end
  22.   
  23. end

  24. class Scene_Map

  25.   def call_battle

  26.   #--------------------------------------------------------------------------

  27.     $actor_id = []
  28.    
  29.     a = []

  30.     for actor in $game_party.actors

  31.       $actor_id.push actor.id
  32.       
  33.       a.push actor.id if actor.dead?
  34.       
  35.     end

  36.      $game_party.remove_actor(a)
  37.    
  38.   #--------------------------------------------------------------------------

  39.     $game_temp.battle_calling = false

  40.     $game_temp.menu_calling = false

  41.     $game_temp.menu_beep = false

  42.     $game_player.make_encounter_count

  43.     $game_temp.map_bgm = $game_system.playing_bgm

  44.     $game_system.bgm_stop

  45.     $game_system.se_play($data_system.battle_start_se)

  46.     $game_system.bgm_play($game_system.battle_bgm)

  47.     $game_player.straighten

  48.     $scene = Scene_Battle.new

  49.   end

  50. end

  51. class Scene_Battle

  52.   def battle_end(result)
  53.     Graphics.frame_rate = 40

  54.   #--------------------------------------------------------------------------

  55.     for i in 0..$actor_id.size-1

  56.       $game_party.actors[i] = $game_actors[$actor_id[i]]

  57.     end

  58.     $game_player.refresh

  59.   #--------------------------------------------------------------------------

  60.     $game_temp.in_battle = false

  61.     $game_party.clear_actions

  62.     for actor in $game_party.actors

  63.       actor.remove_states_battle

  64.     end

  65.     $game_troop.enemies.clear

  66.     if $game_temp.battle_proc != nil

  67.       $game_temp.battle_proc.call(result)

  68.       $game_temp.battle_proc = nil

  69.     end

  70.     $scene = Scene_Map.new

  71.   end

  72. end
复制代码
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================


  4. # ————————————————————————————————————

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

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

  13. module Train_Actor




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





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





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

  31. class Game_Party_Actor < Game_Character
  32. def initialize
  33. super()
  34. @through = true
  35. end
  36. def setup(actor)
  37. # キャラクターのファイル名と色相を設定
  38. if actor != nil
  39. @character_name = actor.character_name
  40. @character_hue = actor.character_hue
  41. #========此处修改=================
  42. @animation_loop_id = actor.tz_id != -1 ? TaoZhuan::EQUIP[actor.tz_id][18] : 0
  43. #=================================
  44. else
  45. @character_name = ""
  46. @character_hue = 0
  47. end
  48. # 不透明度と合成方法を初期化
  49. @opacity = 255
  50. @blend_type = 0
  51. end
  52. def screen_z(height = 0)
  53. if $game_player.x == @x and $game_player.y == @y
  54. return $game_player.screen_z(height) - 1
  55. end
  56. super(height)
  57. end
  58. #--------------------------------------------------------------------------
  59. # ● 下に移動
  60. # turn_enabled : その場での向き変更を許可するフラグ
  61. #--------------------------------------------------------------------------
  62. def move_down(turn_enabled = true)
  63. # 下を向く
  64. if turn_enabled
  65. turn_down
  66. end
  67. # 通行可能な場合
  68. if passable?(@x, @y, Input::DOWN)
  69. # 下を向く
  70. turn_down
  71. # 座標を更新
  72. @y += 1
  73. end
  74. end
  75. #--------------------------------------------------------------------------
  76. # ● 左に移動
  77. # turn_enabled : その場での向き変更を許可するフラグ
  78. #--------------------------------------------------------------------------
  79. def move_left(turn_enabled = true)
  80. # 左を向く
  81. if turn_enabled
  82. turn_left
  83. end
  84. # 通行可能な場合
  85. if passable?(@x, @y, Input::LEFT)
  86. # 左を向く
  87. turn_left
  88. # 座標を更新
  89. @x -= 1
  90. end
  91. end
  92. #--------------------------------------------------------------------------
  93. # ● 右に移動
  94. # turn_enabled : その場での向き変更を許可するフラグ
  95. #--------------------------------------------------------------------------
  96. def move_right(turn_enabled = true)
  97. # 右を向く
  98. if turn_enabled
  99. turn_right
  100. end
  101. # 通行可能な場合
  102. if passable?(@x, @y, Input::RIGHT)
  103. # 右を向く
  104. turn_right
  105. # 座標を更新
  106. @x += 1
  107. end
  108. end
  109. #--------------------------------------------------------------------------
  110. # ● 上に移動
  111. # turn_enabled : その場での向き変更を許可するフラグ
  112. #--------------------------------------------------------------------------
  113. def move_up(turn_enabled = true)
  114. # 上を向く
  115. if turn_enabled
  116. turn_up
  117. end
  118. # 通行可能な場合
  119. if passable?(@x, @y, Input::UP)
  120. # 上を向く
  121. turn_up
  122. # 座標を更新
  123. @y -= 1
  124. end
  125. end
  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. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  137. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  138. # 座標を更新
  139. @x -= 1
  140. @y += 1
  141. end
  142. end
  143. #--------------------------------------------------------------------------
  144. # ● 右下に移動
  145. #--------------------------------------------------------------------------
  146. def move_lower_right
  147. # 向き固定でない場合
  148. unless @direction_fix
  149. # 左向きだった場合は右を、上向きだった場合は下を向く
  150. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
  151. end
  152. # 下→右、右→下 のどちらかのコースが通行可能な場合
  153. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  154. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  155. # 座標を更新
  156. @x += 1
  157. @y += 1
  158. end
  159. end
  160. #--------------------------------------------------------------------------
  161. # ● 左上に移動
  162. #--------------------------------------------------------------------------
  163. def move_upper_left
  164. # 向き固定でない場合
  165. unless @direction_fix
  166. # 右向きだった場合は左を、下向きだった場合は上を向く
  167. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
  168. end
  169. # 上→左、左→上 のどちらかのコースが通行可能な場合
  170. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  171. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  172. # 座標を更新
  173. @x -= 1
  174. @y -= 1
  175. end
  176. end
  177. #--------------------------------------------------------------------------
  178. # ● 右上に移動
  179. #--------------------------------------------------------------------------
  180. def move_upper_right
  181. # 向き固定でない場合
  182. unless @direction_fix
  183. # 左向きだった場合は右を、下向きだった場合は上を向く
  184. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
  185. end
  186. # 上→右、右→上 のどちらかのコースが通行可能な場合
  187. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  188. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  189. # 座標を更新
  190. @x += 1
  191. @y -= 1
  192. end
  193. end
  194. attr_writer :move_speed
  195. attr_writer :step_anime
  196. end
  197. module Spriteset_Map_Module
  198. def setup_actor_character_sprites?
  199. return @setup_actor_character_sprites_flag != nil
  200. end
  201. def setup_actor_character_sprites(characters)
  202. if !setup_actor_character_sprites?
  203. index_game_player = 0
  204. @character_sprites.each_index do |i|
  205. if @character_sprites[i].character.instance_of?(Game_Player)
  206. index_game_player = i
  207. break
  208. end
  209. end
  210. for character in characters.reverse
  211. @character_sprites.unshift(
  212. Sprite_Character.new(@viewport1, character)
  213. )
  214. end
  215. @setup_actor_character_sprites_flag = true
  216. end
  217. end
  218. end
  219. module Scene_Map_Module
  220. def setup_actor_character_sprites(characters)
  221. @spriteset.setup_actor_character_sprites(characters)
  222. end
  223. end
  224. module Game_Party_Module
  225. def set_transparent_actors(transparent)
  226. @transparent = transparent
  227. end
  228. def setup_actor_character_sprites
  229. if @characters == nil
  230. @characters = []
  231. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  232. @characters.push(Game_Party_Actor.new)
  233. end
  234. end

  235. new_actor = []
  236. for actor in actors
  237.   new_actor.push(actor) if !actor.dead?
  238. end

  239. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  240. @characters[i-1].setup(new_actor[i])
  241. end


  242. if $scene.class.method_defined?('setup_actor_character_sprites')
  243. $scene.setup_actor_character_sprites(@characters)
  244. end
  245. end
  246. def update_party_actors
  247. setup_actor_character_sprites
  248. transparent = $game_player.transparent
  249. if transparent == false
  250. if TRANSPARENT_SWITCH
  251. transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
  252. end
  253. end
  254. for character in @characters
  255. character.transparent = transparent
  256. character.move_speed = $game_player.move_speed
  257. character.step_anime = $game_player.step_anime
  258. character.update
  259. end
  260. end
  261. def moveto_party_actors( x, y )
  262. setup_actor_character_sprites
  263. for character in @characters
  264. character.moveto( x, y )
  265. end
  266. if @move_list == nil
  267. @move_list = []
  268. end
  269. move_list_setup
  270. end
  271. def move_party_actors
  272. if @move_list == nil
  273. @move_list = []
  274. move_list_setup
  275. end
  276. @move_list.each_index do |i|
  277. if @characters[i] != nil
  278. case @move_list[i].type
  279. when Input::DOWN
  280. @characters[i].move_down(@move_list[i].args[0])
  281. when Input::LEFT
  282. @characters[i].move_left(@move_list[i].args[0])
  283. when Input::RIGHT
  284. @characters[i].move_right(@move_list[i].args[0])
  285. when Input::UP
  286. @characters[i].move_up(@move_list[i].args[0])
  287. when DOWN_LEFT
  288. @characters[i].move_lower_left
  289. when DOWN_RIGHT
  290. @characters[i].move_lower_right
  291. when UP_LEFT
  292. @characters[i].move_upper_left
  293. when UP_RIGHT
  294. @characters[i].move_upper_right
  295. when JUMP
  296. @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  297. end
  298. end
  299. end
  300. end
  301. class Move_List_Element
  302. def initialize(type,args)
  303. @type = type
  304. @args = args
  305. end
  306. def type() return @type end
  307. def args() return @args end
  308. end
  309. def move_list_setup
  310. for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  311. @move_list[i] = nil
  312. end
  313. end
  314. def add_move_list(type,*args)
  315. @move_list.unshift(Move_List_Element.new(type,args)).pop
  316. end
  317. def move_down_party_actors(turn_enabled = true)
  318. move_party_actors
  319. add_move_list(Input::DOWN,turn_enabled)
  320. end
  321. def move_left_party_actors(turn_enabled = true)
  322. move_party_actors
  323. add_move_list(Input::LEFT,turn_enabled)
  324. end
  325. def move_right_party_actors(turn_enabled = true)
  326. move_party_actors
  327. add_move_list(Input::RIGHT,turn_enabled)
  328. end
  329. def move_up_party_actors(turn_enabled = true)
  330. move_party_actors
  331. add_move_list(Input::UP,turn_enabled)
  332. end
  333. def move_lower_left_party_actors
  334. move_party_actors
  335. add_move_list(DOWN_LEFT)
  336. end
  337. def move_lower_right_party_actors
  338. move_party_actors
  339. add_move_list(DOWN_RIGHT)
  340. end
  341. def move_upper_left_party_actors
  342. move_party_actors
  343. add_move_list(UP_LEFT)
  344. end
  345. def move_upper_right_party_actors
  346. move_party_actors
  347. add_move_list(UP_RIGHT)
  348. end
  349. def jump_party_actors(x_plus, y_plus)
  350. move_party_actors
  351. add_move_list(JUMP,x_plus, y_plus)
  352. end
  353. end
  354. module Game_Player_Module
  355. def update
  356. $game_party.update_party_actors


  357. for i in 0..$game_party.actors.size
  358.   actor = $game_party.actors[i]
  359.    if !actor.dead?
  360.     @character_name = actor.character_name
  361.     @character_hue = actor.character_hue
  362.     break
  363.    end
  364. end


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

  453. #==============================================================================
  454. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  455. #==============================================================================
复制代码
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4097
在线时间
1081 小时
注册时间
2008-5-17
帖子
218

开拓者

4
 楼主| 发表于 2009-7-19 13:16:27 | 只看该作者
:lol ONEWateR大 非常感谢 就是第1个脚本跟 人物仓库插件的脚本有冲突 我换成了II桑修正的那个 这样2个一起用就OK拉。。。。。非常感谢。。。6R万塞。。。。。。ONEWateR大 万塞。。。II桑万塞。。。。找认可贴去。。。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-1-11 16:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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