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

Project1

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

[已经过期] 跟随脚本的角色在透明菜单消失

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2008-10-27
帖子
70
跳转到指定楼层
1
发表于 2012-3-3 23:44:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 IRO 于 2012-3-3 23:47 编辑

我用了让队友跟随的列车脚本,同时也让菜单透明
这个时候一进入菜单本来跟在后面的队友便消失了...
请问这个问题有没有办法克服呢?

附上跟随脚本:
  1. # ▼▲▼ XRXS13. Train_Actor ▼▲▼
  2. # by fukuyama
  3. #
  4. # [email protected]
  5. # http://www4.big.or.jp/~fukuyama/
  6. #

  7. # ●透明状態用スイッチ設定
  8. # true だとスイッチ制御を行う
  9. # TRAIN_ACTOR_TRANSPARENT_SWITCH = true
  10. TRAIN_ACTOR_TRANSPARENT_SWITCH = true

  11. # ●透明状態用スイッチ番号
  12. # この番号のスイッチがONだと透明になる
  13. TRAIN_ACTOR_TRANSPARENT_SWITCHES_INDEX = 17

  14. # ●アクターの最大数
  15. # 将来的に多人数パーティが出来るようになったら…
  16. TRAIN_ACTOR_SIZE_MAX = 4

  17. # 定数
  18. #Input::DOWN = 2 # この辺はちゃんと定数あった…
  19. #Input::LEFT = 4
  20. #Input::RIGHT = 6
  21. #Input::UP = 8
  22. DOWN_LEFT = 1
  23. DOWN_RIGHT = 3
  24. UP_LEFT = 7
  25. UP_RIGHT = 9
  26. JUMP = 5

  27. class Game_Party_Actor < Game_Character
  28. def initialize
  29. super()
  30. @through = true
  31. end
  32. def setup(actor)
  33. # キャラクターのファイル名と色相を設定
  34. if actor != nil
  35. @character_name = actor.character_name
  36. @character_hue = actor.character_hue
  37. else
  38. @character_name = ""
  39. @character_hue = 0
  40. end
  41. # 不透明度と合成方法を初期化
  42. @opacity = 255
  43. @blend_type = 0
  44. end
  45. def screen_z(height = 0)
  46. if $game_player.x == @x and $game_player.y == @y
  47. return $game_player.screen_z(height) - 1
  48. end
  49. super(height)
  50. end
  51. #----------------------------------------------------------------

  52. ----------
  53. # ● 下に移動
  54. # turn_enabled : その場での向き変更を許可するフラグ
  55. #----------------------------------------------------------------

  56. ----------
  57. def move_down(turn_enabled = true)
  58. # 下を向く
  59. if turn_enabled
  60. turn_down
  61. end
  62. # 通行可能な場合
  63. if passable?(@x, @y, Input::DOWN)
  64. # 下を向く
  65. turn_down
  66. # 座標を更新
  67. @y += 1
  68. end
  69. end
  70. #----------------------------------------------------------------

  71. ----------
  72. # ● 左に移動
  73. # turn_enabled : その場での向き変更を許可するフラグ
  74. #----------------------------------------------------------------

  75. ----------
  76. def move_left(turn_enabled = true)
  77. # 左を向く
  78. if turn_enabled
  79. turn_left
  80. end
  81. # 通行可能な場合
  82. if passable?(@x, @y, Input::LEFT)
  83. # 左を向く
  84. turn_left
  85. # 座標を更新
  86. @x -= 1
  87. end
  88. end
  89. #----------------------------------------------------------------

  90. ----------
  91. # ● 右に移動
  92. # turn_enabled : その場での向き変更を許可するフラグ
  93. #----------------------------------------------------------------

  94. ----------
  95. def move_right(turn_enabled = true)
  96. # 右を向く
  97. if turn_enabled
  98. turn_right
  99. end
  100. # 通行可能な場合
  101. if passable?(@x, @y, Input::RIGHT)
  102. # 右を向く
  103. turn_right
  104. # 座標を更新
  105. @x += 1
  106. end
  107. end
  108. #----------------------------------------------------------------

  109. ----------
  110. # ● 上に移動
  111. # turn_enabled : その場での向き変更を許可するフラグ
  112. #----------------------------------------------------------------

  113. ----------
  114. def move_up(turn_enabled = true)
  115. # 上を向く
  116. if turn_enabled
  117. turn_up
  118. end
  119. # 通行可能な場合
  120. if passable?(@x, @y, Input::UP)
  121. # 上を向く
  122. turn_up
  123. # 座標を更新
  124. @y -= 1
  125. end
  126. end
  127. #----------------------------------------------------------------

  128. ----------
  129. # ● 左下に移動
  130. #----------------------------------------------------------------

  131. ----------
  132. def move_lower_left
  133. # 向き固定でない場合
  134. unless @direction_fix
  135. # 右向きだった場合は左を、上向きだった場合は下を向く
  136. @direction = (@direction == Input::RIGHT ? Input::LEFT :

  137. @direction == Input::UP ? Input::DOWN : @direction)
  138. end
  139. # 下→左、左→下 のどちらかのコースが通行可能な場合
  140. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1,

  141. Input::LEFT)) or
  142. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y,

  143. Input::DOWN))
  144. # 座標を更新
  145. @x -= 1
  146. @y += 1
  147. end
  148. end
  149. #----------------------------------------------------------------

  150. ----------
  151. # ● 右下に移動
  152. #----------------------------------------------------------------

  153. ----------
  154. def move_lower_right
  155. # 向き固定でない場合
  156. unless @direction_fix
  157. # 左向きだった場合は右を、上向きだった場合は下を向く
  158. @direction = (@direction == Input::LEFT ? Input::RIGHT :

  159. @direction == Input::UP ? Input::DOWN : @direction)
  160. end
  161. # 下→右、右→下 のどちらかのコースが通行可能な場合
  162. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1,

  163. Input::RIGHT)) or
  164. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y,

  165. Input::DOWN))
  166. # 座標を更新
  167. @x += 1
  168. @y += 1
  169. end
  170. end
  171. #----------------------------------------------------------------

  172. ----------
  173. # ● 左上に移動
  174. #----------------------------------------------------------------

  175. ----------
  176. def move_upper_left
  177. # 向き固定でない場合
  178. unless @direction_fix
  179. # 右向きだった場合は左を、下向きだった場合は上を向く
  180. @direction = (@direction == Input::RIGHT ? Input::LEFT :

  181. @direction == Input::DOWN ? Input::UP : @direction)
  182. end
  183. # 上→左、左→上 のどちらかのコースが通行可能な場合
  184. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1,

  185. Input::LEFT)) or
  186. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y,

  187. Input::UP))
  188. # 座標を更新
  189. @x -= 1
  190. @y -= 1
  191. end
  192. end
  193. #----------------------------------------------------------------

  194. ----------
  195. # ● 右上に移動
  196. #----------------------------------------------------------------

  197. ----------
  198. def move_upper_right
  199. # 向き固定でない場合
  200. unless @direction_fix
  201. # 左向きだった場合は右を、下向きだった場合は上を向く
  202. @direction = (@direction == Input::LEFT ? Input::RIGHT :

  203. @direction == Input::DOWN ? Input::UP : @direction)
  204. end
  205. # 上→右、右→上 のどちらかのコースが通行可能な場合
  206. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1,

  207. Input::RIGHT)) or
  208. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y,

  209. Input::UP))
  210. # 座標を更新
  211. @x += 1
  212. @y -= 1
  213. end
  214. end

  215. attr_writer :move_speed
  216. end

  217. module Train_Actor_Spriteset_Map_Module
  218. def setup_actor_character_sprites?
  219. return @setup_actor_character_sprites_flag != nil
  220. end
  221. def setup_actor_character_sprites(characters)
  222. if !setup_actor_character_sprites?
  223. index_game_player = 0
  224. @character_sprites.each_index do |i|
  225. if @character_sprites[i].character.instance_of?(Game_Player)
  226. index_game_player = i
  227. break
  228. end
  229. end
  230. for character in characters.reverse
  231. @character_sprites.unshift(
  232. Sprite_Character.new(@viewport1, character)
  233. )
  234. end
  235. @setup_actor_character_sprites_flag = true
  236. end
  237. end
  238. end

  239. module Train_Actor_Scene_Map_Module
  240. def setup_actor_character_sprites(characters)
  241. @spriteset.setup_actor_character_sprites(characters)
  242. end
  243. end

  244. module Train_Actor_Game_Party_Module
  245. def set_transparent_actors(transparent)
  246. @transparent = transparent
  247. end
  248. def setup_actor_character_sprites
  249. if @characters == nil
  250. @characters = []
  251. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  252. @characters.push(Game_Party_Actor.new)
  253. end
  254. end
  255. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  256. @characters[i - 1].setup(actors[i])
  257. end
  258. if $scene.instance_of?(Scene_Map)
  259. $scene.setup_actor_character_sprites(@characters)
  260. end
  261. end
  262. def update_party_actors
  263. setup_actor_character_sprites
  264. transparent = $game_player.transparent
  265. if transparent == false
  266. if TRAIN_ACTOR_TRANSPARENT_SWITCH
  267. transparent = $game_switches

  268. [TRAIN_ACTOR_TRANSPARENT_SWITCHES_INDEX]
  269. end
  270. end
  271. for character in @characters
  272. character.transparent = transparent
  273. character.move_speed = $game_player.move_speed
  274. character.update
  275. end
  276. end
  277. def moveto_party_actors( x, y )
  278. setup_actor_character_sprites
  279. for character in @characters
  280. character.moveto( x, y )
  281. end
  282. if @move_list == nil
  283. @move_list = []
  284. end
  285. move_list_setup
  286. end
  287. def move_party_actors
  288. if @move_list == nil
  289. @move_list = []
  290. move_list_setup
  291. end
  292. @move_list.each_index do |i|
  293. if @characters[i] != nil
  294. case @move_list[i].type
  295. when Input::DOWN
  296. @characters[i].move_down(@move_list[i].args[0])
  297. when Input::LEFT
  298. @characters[i].move_left(@move_list[i].args[0])
  299. when Input::RIGHT
  300. @characters[i].move_right(@move_list[i].args[0])
  301. when Input::UP
  302. @characters[i].move_up(@move_list[i].args[0])
  303. when DOWN_LEFT
  304. @characters[i].move_lower_left
  305. when DOWN_RIGHT
  306. @characters[i].move_lower_right
  307. when UP_LEFT
  308. @characters[i].move_upper_left
  309. when UP_RIGHT
  310. @characters[i].move_upper_right
  311. when JUMP
  312. @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  313. end
  314. end
  315. end
  316. end
  317. class Train_Actor_Move_List_Element
  318. def initialize(type,args)
  319. @type = type
  320. @args = args
  321. end
  322. def type() return @type end
  323. def args() return @args end
  324. end
  325. def move_list_setup
  326. for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  327. @move_list[i] = nil
  328. end
  329. end
  330. def add_move_list(type,*args)
  331. @move_list.unshift(Train_Actor_Move_List_Element.new

  332. (type,args)).pop
  333. end
  334. def move_down_party_actors(turn_enabled = true)
  335. move_party_actors
  336. add_move_list(Input::DOWN,turn_enabled)
  337. end
  338. def move_left_party_actors(turn_enabled = true)
  339. move_party_actors
  340. add_move_list(Input::LEFT,turn_enabled)
  341. end
  342. def move_right_party_actors(turn_enabled = true)
  343. move_party_actors
  344. add_move_list(Input::RIGHT,turn_enabled)
  345. end
  346. def move_up_party_actors(turn_enabled = true)
  347. move_party_actors
  348. add_move_list(Input::UP,turn_enabled)
  349. end
  350. def move_lower_left_party_actors
  351. move_party_actors
  352. add_move_list(DOWN_LEFT)
  353. end
  354. def move_lower_right_party_actors
  355. move_party_actors
  356. add_move_list(DOWN_RIGHT)
  357. end
  358. def move_upper_left_party_actors
  359. move_party_actors
  360. add_move_list(UP_LEFT)
  361. end
  362. def move_upper_right_party_actors
  363. move_party_actors
  364. add_move_list(UP_RIGHT)
  365. end
  366. def jump_party_actors(x_plus, y_plus)
  367. move_party_actors
  368. add_move_list(JUMP,x_plus, y_plus)
  369. end
  370. end

  371. module Train_Actor_Game_Player_Module
  372. def update
  373. $game_party.update_party_actors
  374. super
  375. end
  376. def moveto( x, y )
  377. $game_party.moveto_party_actors( x, y )
  378. super( x, y )
  379. end
  380. def move_down(turn_enabled = true)
  381. if passable?(@x, @y, Input::DOWN)
  382. $game_party.move_down_party_actors(turn_enabled)
  383. end
  384. super(turn_enabled)
  385. end
  386. def move_left(turn_enabled = true)
  387. if passable?(@x, @y, Input::LEFT)
  388. $game_party.move_left_party_actors(turn_enabled)
  389. end
  390. super(turn_enabled)
  391. end
  392. def move_right(turn_enabled = true)
  393. if passable?(@x, @y, Input::RIGHT)
  394. $game_party.move_right_party_actors(turn_enabled)
  395. end
  396. super(turn_enabled)
  397. end
  398. def move_up(turn_enabled = true)
  399. if passable?(@x, @y, Input::UP)
  400. $game_party.move_up_party_actors(turn_enabled)
  401. end
  402. super(turn_enabled)
  403. end
  404. def move_lower_left
  405. # 下→左、左→下 のどちらかのコースが通行可能な場合
  406. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1,

  407. Input::LEFT)) or
  408. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y,

  409. Input::DOWN))
  410. $game_party.move_lower_left_party_actors
  411. end
  412. super
  413. end
  414. def move_lower_right
  415. # 下→右、右→下 のどちらかのコースが通行可能な場合
  416. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1,

  417. Input::RIGHT)) or
  418. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y,

  419. Input::DOWN))
  420. $game_party.move_lower_right_party_actors
  421. end
  422. super
  423. end
  424. def move_upper_left
  425. # 上→左、左→上 のどちらかのコースが通行可能な場合
  426. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1,

  427. Input::LEFT)) or
  428. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y,

  429. Input::UP))
  430. $game_party.move_upper_left_party_actors
  431. end
  432. super
  433. end
  434. def move_upper_right
  435. # 上→右、右→上 のどちらかのコースが通行可能な場合
  436. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1,

  437. Input::RIGHT)) or
  438. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y,

  439. Input::UP))
  440. $game_party.move_upper_right_party_actors
  441. end
  442. super
  443. end
  444. def jump(x_plus, y_plus)
  445. # 新しい座標を計算
  446. new_x = @x + x_plus
  447. new_y = @y + y_plus
  448. # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
  449. if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
  450. $game_party.jump_party_actors(x_plus, y_plus)
  451. end
  452. super(x_plus, y_plus)
  453. end

  454. # -----------------------------------------------
  455. # move_speed を外から見れるように
  456. # -----------------------------------------------
  457. attr_reader :move_speed
  458. end

  459. class Game_Party
  460. include Train_Actor_Game_Party_Module
  461. end

  462. class Game_Player
  463. include Train_Actor_Game_Player_Module
  464. end

  465. class Spriteset_Map
  466. include Train_Actor_Spriteset_Map_Module
  467. end

  468. class Scene_Map
  469. include Train_Actor_Scene_Map_Module
  470. end

  471. # Train_Actor
复制代码
菜单透明化:
  1. module Opacity_Menu
  2.   def create_screen
  3.     @screen = Spriteset_Map.new
  4.   end
  5.   def dispose_screen
  6.     @screen.dispose
  7.   end
  8. end

  9. class Window_Base < Window
  10.   def initialize(x, y, width, height)
  11.     super()
  12.     @windowskin_name = $game_system.windowskin_name
  13.     self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  14.     self.x = x
  15.     self.y = y
  16.     self.width = width
  17.     self.height = height
  18.     self.z = 100
  19.     if $scene.is_a?(Scene_Menu) or
  20.       $scene.is_a?(Scene_Item) or
  21.       $scene.is_a?(Scene_Skill) or
  22.       $scene.is_a?(Scene_Equip) or
  23.       $scene.is_a?(Scene_Status) or
  24.       $scene.is_a?(Scene_Save) or
  25.       $scene.is_a?(Scene_End) or
  26.       $scene.is_a?(Scene_Shop)
  27.       self.back_opacity = 160
  28.     end
  29.   end
  30. end

  31. class Scene_Menu
  32.   include Opacity_Menu
  33.   alias main_old main
  34.   def main
  35.     create_screen
  36.     main_old
  37.     dispose_screen
  38.   end
  39. end

  40. class Scene_Item
  41.   include Opacity_Menu
  42.   alias main_old main
  43.   def main
  44.     create_screen
  45.     main_old
  46.     dispose_screen
  47.   end
  48. end

  49. class Scene_Skill
  50.   include Opacity_Menu
  51.   alias main_old main
  52.   def main
  53.     create_screen
  54.     main_old
  55.     dispose_screen
  56.   end
  57. end

  58. class Scene_Equip
  59.   include Opacity_Menu
  60.   alias main_old main
  61.   def main
  62.     create_screen
  63.     main_old
  64.     dispose_screen
  65.   end
  66. end

  67. class Scene_Status
  68.   include Opacity_Menu
  69.   alias main_old main
  70.   def main
  71.     create_screen
  72.     main_old
  73.     dispose_screen
  74.   end
  75. end

  76. class Scene_Save
  77.   include Opacity_Menu
  78.   alias main_old main
  79.   def main
  80.     create_screen
  81.     main_old
  82.     dispose_screen
  83.   end
  84. end

  85. class Scene_End
  86.   include Opacity_Menu
  87.   alias main_old main
  88.   def main
  89.     create_screen
  90.     main_old
  91.     dispose_screen
  92.   end
  93. end

  94. class Scene_Shop
  95.   include Opacity_Menu
  96.   alias main_old main
  97.   def main
  98.     create_screen
  99.     main_old
  100.     dispose_screen
  101.   end
  102. end
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
49 小时
注册时间
2010-9-10
帖子
7
2
发表于 2014-4-13 22:36:17 | 只看该作者
解决办法:在Scene_Menu的主处理
  1.   def main
复制代码
后插上一行
  1. $game_party.update_party_actors
复制代码

点评

请勿挖坟。这是违反版规的。  发表于 2014-4-14 19:11
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-25 10:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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