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

Project1

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

[已经过期] 关于即时战斗脚本CP条显示问题,求脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
102 小时
注册时间
2016-5-9
帖子
58
跳转到指定楼层
1
发表于 2016-5-25 12:01:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用的是在图书馆里找的那个樱雅在土,和希的CP制战斗脚本,然后我自己又加了横版和窗口美化的脚本,但是问题出现了,游戏虽然能运行,也确实有即时战斗的模式,但是CP条却没有显示。我想要显示一个CP条可以把敌我双方行动顺序或将要行动都表示出来的脚本。
最好能直接替换掉这个即时战斗脚本新人跪求QAQ
(这是我目前用的脚本,感觉不太好,CP制好像已经被其他脚本改的所剩无几了)
  1. # ▼▲▼ XRXS_BP 1. CP制導入 ver..23 ▼▲▼
  2. # by 桜雅 在土, 和希

  3. #==============================================================================
  4. # □ カスタマイズポイント
  5. #==============================================================================
  6. module XRXS_BP1
  7. #
  8. # 对齐方式。0:左 1:中央 2:右
  9. #
  10. ALIGN = 2
  11. #
  12. # 人数
  13. #
  14. MAX = 4
  15. end
  16. class Scene_Battle_CP
  17. #
  18. # 战斗速度
  19. #
  20. BATTLE_SPEED = 2.0
  21. #
  22. # 战斗开始的时候气槽百分比
  23. #
  24. START_CP_PERCENT = 100
  25. end

  26. class Scene_Battle

  27. # 效果音效,可以自己添加
  28. DATA_SYSTEM_COMMAND_UP_SE = ""

  29. # 各项数值功能消耗的CP值
  30. CP_COST_BASIC_ACTIONS = 0 # 基础共同
  31. CP_COST_SKILL_ACTION = 65535 # 技能
  32. CP_COST_ITEM_ACTION = 65535 # 物品
  33. CP_COST_BASIC_ATTACK = 65535 # 攻撃
  34. CP_COST_BASIC_GUARD = 32768 # 防御
  35. CP_COST_BASIC_NOTHING = 65535 # 不做任何事情
  36. CP_COST_BASIC_ESCAPE = 65535 # 逃跑
  37. end

  38. #==============================================================================
  39. # --- XRXS.コマンドウィンドウ?コマンド追加機構 ---
  40. #------------------------------------------------------------------------------
  41. # Window_Commandクラスに add_command メソッドを追加します。
  42. #==============================================================================
  43. module XRXS_Window_Command_Add_Command
  44. #--------------------------------------------------------------------------
  45. # ○ コマンドを追加
  46. #--------------------------------------------------------------------------
  47. def add_command(command)
  48. # 初期化されていない場合、無効化判別用の配列 @disabled の初期化
  49. #
  50. if @disabled == nil
  51. @disabled = []
  52. end
  53. if @commands.size != @disabled.size
  54. for i in [email protected]
  55. @disabled[i] = false
  56. end
  57. end
  58. #
  59. # 追加
  60. #
  61. @commands.push(command)
  62. @disabled.push(false)
  63. @item_max = @commands.size
  64. self.y -= 32
  65. self.height += 32
  66. self.contents.dispose
  67. self.contents = nil
  68. self.contents = Bitmap.new(self.width - 32, @item_max * 32)
  69. refresh
  70. for i in [email protected]
  71. if @disabled[i]
  72. disable_item(i)
  73. end
  74. end
  75. end
  76. #--------------------------------------------------------------------------
  77. # ○ 項目の無効化
  78. # index : 項目番号
  79. #--------------------------------------------------------------------------
  80. def disable_item(index)
  81. if @disabled == nil
  82. @disabled = []
  83. end
  84. @disabled[index] = true
  85. draw_item(index, disabled_color)
  86. end
  87. end
  88. class Window_Command < Window_Selectable
  89. #--------------------------------------------------------------------------
  90. # ○ インクルード
  91. #--------------------------------------------------------------------------
  92. include XRXS_Window_Command_Add_Command
  93. #--------------------------------------------------------------------------
  94. # ● 項目の無効化
  95. # index : 項目番号
  96. #--------------------------------------------------------------------------
  97. def disable_item(index)
  98. super
  99. end
  100. end
  101. #==============================================================================
  102. # □ Scene_Battle_CP
  103. #==============================================================================
  104. class Scene_Battle_CP
  105. #--------------------------------------------------------------------------
  106. # ○ 公開インスタンス変数
  107. #--------------------------------------------------------------------------
  108. attr_accessor :stop # CP加算ストップ
  109. #----------------------------------------------------------------------------
  110. # ○ オブジェクトの初期化
  111. #----------------------------------------------------------------------------
  112. def initialize
  113. @battlers = []
  114. @cancel = false
  115. @stop = false
  116. @agi_total = 0
  117. # 配列 count_battlers を初期化
  118. count_battlers = []
  119. # エネミーを配列 count_battlers に追加
  120. for enemy in $game_troop.enemies
  121. count_battlers.push(enemy)
  122. end
  123. # アクターを配列 count_battlers に追加
  124. for actor in $game_party.actors
  125. count_battlers.push(actor)
  126. end
  127. for battler in count_battlers
  128. @agi_total += battler.agi
  129. end
  130. for battler in count_battlers
  131. battler.cp = [[65535 * START_CP_PERCENT * (rand(15) + 85) * 4 * battler.agi / @agi_total / 10000, 0].max, 65535].min
  132. end
  133. end
  134. #----------------------------------------------------------------------------
  135. # ○ CPカウントアップ
  136. #----------------------------------------------------------------------------
  137. def update
  138. # ストップされているならリターン
  139. return if @stop
  140. #
  141. for battler in $game_party.actors + $game_troop.enemies
  142. # 行動出来なければ無視
  143. if battler.dead? == true
  144. battler.cp = 0
  145. next
  146. end
  147. battler.cp = [[battler.cp + BATTLE_SPEED * 4096 * battler.agi / @agi_total, 0].max, 65535].min
  148. end
  149. end
  150. #----------------------------------------------------------------------------
  151. # ○ CPカウントの開始
  152. #----------------------------------------------------------------------------
  153. def stop
  154. @cancel = true
  155. if @cp_thread != nil then
  156. @cp_thread.join
  157. @cp_thread = nil
  158. end
  159. end
  160. end

  161. #==============================================================================
  162. # ■ Game_Battler
  163. #==============================================================================
  164. class Game_Battler
  165. attr_accessor :now_guarding # 現在防御中フラグ
  166. attr_accessor :cp # 現在CP
  167. attr_accessor :slip_state_update_ban # スリップ?ステート自動処理の禁止
  168. #--------------------------------------------------------------------------
  169. # ○ CP の変更
  170. #--------------------------------------------------------------------------
  171. def cp=(p)
  172. @cp = [[p, 0].max, 65535].min
  173. end
  174. #--------------------------------------------------------------------------
  175. # ● 防御中判定 [ 再定義 ]
  176. #--------------------------------------------------------------------------
  177. def guarding?
  178. return @now_guarding
  179. end
  180. #--------------------------------------------------------------------------
  181. # ● コマンド入力可能判定
  182. #--------------------------------------------------------------------------
  183. alias xrxs_bp1_inputable? inputable?
  184. def inputable?
  185. bool = xrxs_bp1_inputable?
  186. return (bool and (@cp >= 65535))
  187. end
  188. #--------------------------------------------------------------------------
  189. # ● ステート [スリップダメージ] 判定
  190. #--------------------------------------------------------------------------
  191. alias xrxs_bp1_slip_damage? slip_damage?
  192. def slip_damage?
  193. return false if @slip_state_update_ban
  194. return xrxs_bp1_slip_damage?
  195. end
  196. #--------------------------------------------------------------------------
  197. # ● ステート自然解除 (ターンごとに呼び出し)
  198. #--------------------------------------------------------------------------
  199. alias xrxs_bp1_remove_states_auto remove_states_auto
  200. def remove_states_auto
  201. return if @slip_state_update_ban
  202. xrxs_bp1_remove_states_auto
  203. end
  204. end
  205. #==============================================================================
  206. # ■ Game_Actor
  207. #==============================================================================
  208. class Game_Actor < Game_Battler
  209. #--------------------------------------------------------------------------
  210. # ● セットアップ
  211. #--------------------------------------------------------------------------
  212. alias xrxs_bp1_setup setup
  213. def setup(actor_id)
  214. xrxs_bp1_setup(actor_id)
  215. @cp = 0
  216. @now_guarding = false
  217. @slip_state_update_ban = false
  218. end
  219. end
  220. #==============================================================================
  221. # ■ Game_Enemy
  222. #==============================================================================
  223. class Game_Enemy < Game_Battler
  224. #--------------------------------------------------------------------------
  225. # ● オブジェクト初期化
  226. #--------------------------------------------------------------------------
  227. alias xrxs_bp1_initialize initialize
  228. def initialize(troop_id, member_index)
  229. xrxs_bp1_initialize(troop_id, member_index)
  230. @cp = 0
  231. @now_guarding = false
  232. @slip_state_update_ban = false
  233. end
  234. end
  235. #==============================================================================
  236. # ■ Window_BattleStatus
  237. #==============================================================================
  238. class Window_BattleStatus < Window_Base
  239. #--------------------------------------------------------------------------
  240. # ○ 公開インスタンス変数
  241. #--------------------------------------------------------------------------
  242. attr_accessor :update_cp_only # CPメーターのみの更新
  243. #--------------------------------------------------------------------------
  244. # ● オブジェクト初期化
  245. #--------------------------------------------------------------------------
  246. alias xrxs_bp1_initialize initialize
  247. def initialize
  248. @update_cp_only = false
  249. xrxs_bp1_initialize
  250. end
  251. #--------------------------------------------------------------------------
  252. # ● リフレッシュ
  253. #--------------------------------------------------------------------------
  254. alias xrxs_bp1_refresh refresh
  255. def refresh
  256. unless @update_cp_only
  257. xrxs_bp1_refresh
  258. end
  259. refresh_cp
  260. end
  261. #--------------------------------------------------------------------------
  262. # ○ リフレッシュ(CPのみ)
  263. #--------------------------------------------------------------------------
  264. def refresh_cp
  265. for i in 0...$game_party.actors.size
  266. actor = $game_party.actors[i]
  267. width = [self.width*3/4 / XRXS_BP1::MAX, 80].max
  268. space = self.width / XRXS_BP1::MAX
  269. case XRXS_BP1::ALIGN
  270. when 0
  271. actor_x = i * space + 4
  272. when 1
  273. actor_x = (space * ((XRXS_BP1::MAX - $game_party.actors.size)/2.0 + i)).floor
  274. when 2
  275. actor_x = (i + XRXS_BP1::MAX - $game_party.actors.size) * space + 4
  276. end
  277. actor_x += self.x
  278. draw_actor_cp_meter(actor, actor_x, 96, width, 0)
  279. end
  280. end
  281. #--------------------------------------------------------------------------
  282. # ○ CPメーター の描画
  283. #--------------------------------------------------------------------------
  284. def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)
  285. self.contents.font.color = system_color
  286. self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  287. if actor.cp == nil
  288. actor.cp = 0
  289. end
  290. w = width * [actor.cp,65535].min / 65535
  291. self.contents.fill_rect(x, y+28, w,1, Color.new(255, 255, 128, 255))
  292. self.contents.fill_rect(x, y+29, w,1, Color.new(255, 255, 0, 255))
  293. self.contents.fill_rect(x, y+30, w,1, Color.new(192, 192, 0, 255))
  294. self.contents.fill_rect(x, y+31, w,1, Color.new(128, 128, 0, 255))
  295. end
  296. end
  297. #==============================================================================
  298. # ■ Scene_Battle
  299. #==============================================================================
  300. class Scene_Battle
  301. #--------------------------------------------------------------------------
  302. # ● フレーム更新
  303. #--------------------------------------------------------------------------
  304. alias xrxs_bp1_update update
  305. def update
  306. xrxs_bp1_update
  307. # CP更新
  308. @cp_thread.update
  309. end
  310. #--------------------------------------------------------------------------
  311. # ● バトル終了
  312. # result : 結果 (0:勝利 1:敗北 2:逃走)
  313. #--------------------------------------------------------------------------
  314. alias xrxs_bp1_battle_end battle_end
  315. def battle_end(result)
  316. # CPカウントを停止する
  317. @cp_thread.stop
  318. # 呼び戻す
  319. xrxs_bp1_battle_end(result)
  320. end
  321. #--------------------------------------------------------------------------
  322. # ● プレバトルフェーズ開始
  323. #--------------------------------------------------------------------------
  324. alias xrxs_bp1_start_phase1 start_phase1
  325. def start_phase1
  326. @agi_total = 0
  327. # CP加算を開始する
  328. @cp_thread = Scene_Battle_CP.new
  329. # インデックスを計算
  330. @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  331. # アクターコマンドウィンドウに追加
  332. @actor_command_window.add_command("逃跑")
  333. if !$game_temp.battle_can_escape
  334. @actor_command_window.disable_item(@cp_escape_actor_command_index)
  335. end
  336. # 呼び戻す
  337. xrxs_bp1_start_phase1
  338. end
  339. #--------------------------------------------------------------------------
  340. # ● パーティコマンドフェーズ開始
  341. #--------------------------------------------------------------------------
  342. alias xrxs_bp1_start_phase2 start_phase2
  343. def start_phase2
  344. xrxs_bp1_start_phase2
  345. @party_command_window.active = false
  346. @party_command_window.visible = false
  347. # CP加算を再開する
  348. @cp_thread.stop = false
  349. # 次へ
  350. start_phase3
  351. end
  352. #--------------------------------------------------------------------------
  353. # ● アクターコマンドウィンドウのセットアップ
  354. #--------------------------------------------------------------------------
  355. alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_window
  356. def phase3_setup_command_window
  357. # CPスレッドを一時停止する
  358. @cp_thread.stop = true
  359. # ウィンドウのCP更新
  360. @status_window.refresh_cp
  361. # @active_battlerの防御を解除
  362. @active_battler.now_guarding = false
  363. # 効果音の再生
  364. Audio.se_play(DATA_SYSTEM_COMMAND_UP_SE) if DATA_SYSTEM_COMMAND_UP_SE != ""
  365. # 呼び戻す
  366. xrxs_bp1_phase3_setup_command_window
  367. end
  368. #--------------------------------------------------------------------------
  369. # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  370. #--------------------------------------------------------------------------
  371. alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  372. def update_phase3_basic_command
  373. # C ボタンが押された場合
  374. if Input.trigger?(Input::C)
  375. # アクターコマンドウィンドウのカーソル位置で分岐
  376. case @actor_command_window.index
  377. when @cp_escape_actor_command_index # 逃げる
  378. if $game_temp.battle_can_escape
  379. # 決定 SE を演奏
  380. $game_system.se_play($data_system.decision_se)
  381. # アクションを設定
  382. @active_battler.current_action.kind = 0
  383. @active_battler.current_action.basic = 4
  384. # 次のアクターのコマンド入力へ
  385. phase3_next_actor
  386. else
  387. # ブザー SE を演奏
  388. $game_system.se_play($data_system.buzzer_se)
  389. end
  390. return
  391. end
  392. end
  393. xrxs_bsp1_update_phase3_basic_command
  394. end
  395. #--------------------------------------------------------------------------
  396. # ● メインフェーズ開始
  397. #--------------------------------------------------------------------------
  398. alias xrxs_bp1_start_phase4 start_phase4
  399. def start_phase4
  400. # 呼び戻す
  401. xrxs_bp1_start_phase4
  402. # CPスレッドを一時停止する
  403. unless @action_battlers.empty?
  404. @cp_thread.stop = true
  405. end
  406. end
  407. #--------------------------------------------------------------------------
  408. # ● 行動順序作成
  409. #--------------------------------------------------------------------------
  410. alias xrxs_bp1_make_action_orders make_action_orders
  411. def make_action_orders
  412. xrxs_bp1_make_action_orders
  413. # 全員のCPを確認
  414. exclude_battler = []
  415. for battler in @action_battlers
  416. # CPが不足している場合は @action_battlers から除外する
  417. if battler.cp < 65535
  418. exclude_battler.push(battler)
  419. end
  420. end
  421. @action_battlers -= exclude_battler
  422. end
  423. #--------------------------------------------------------------------------
  424. # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  425. #--------------------------------------------------------------------------
  426. alias xrxs_bp1_update_phase4_step1 update_phase4_step1
  427. def update_phase4_step1
  428. # 初期化
  429. @phase4_act_continuation = 0
  430. # 勝敗判定
  431. if judge
  432. @cp_thread.stop
  433. # 勝利または敗北の場合 : メソッド終了
  434. return
  435. end
  436. # 未行動バトラー配列の先頭から取得
  437. @active_battler = @action_battlers[0]
  438. # ステータス更新をCPだけに限定。
  439. @status_window.update_cp_only = true
  440. # ステート更新を禁止。
  441. @active_battler.slip_state_update_ban = true if @active_battler != nil
  442. # 戻す
  443. xrxs_bp1_update_phase4_step1
  444. # @status_windowがリフレッシュされなかった場合は手動でリフレッシュ(CPのみ)
  445. if @phase4_step != 2
  446. # リフレッシュ
  447. @status_window.refresh
  448. # 軽量化:たったコレだけΣ(?w?
  449. Graphics.frame_reset
  450. end
  451. # 禁止を解除
  452. @status_window.update_cp_only = false
  453. @active_battler.slip_state_update_ban = false if @active_battler != nil
  454. end
  455. #--------------------------------------------------------------------------
  456. # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  457. #--------------------------------------------------------------------------
  458. alias xrxs_bp1_update_phase4_step2 update_phase4_step2
  459. def update_phase4_step2
  460. # 強制アクションでなければ
  461. unless @active_battler.current_action.forcing
  462. # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  463. if @active_battler.restriction == 2 or @active_battler.restriction == 3
  464. # アクションに攻撃を設定
  465. @active_battler.current_action.kind = 0
  466. @active_battler.current_action.basic = 0
  467. end
  468. # 制約が [行動できない] の場合
  469. if @active_battler.restriction == 4
  470. # アクション強制対象のバトラーをクリア
  471. $game_temp.forcing_battler = nil
  472. if @phase4_act_continuation == 0 and @active_battler.cp >= 65535
  473. # ステート自然解除
  474. @active_battler.remove_states_auto
  475. # CP消費
  476. @active_battler.cp -= 65535
  477. # ステータスウィンドウをリフレッシュ
  478. @status_window.refresh
  479. end
  480. # ステップ 1 に移行
  481. @phase4_step = 1
  482. return
  483. end
  484. end
  485. # アクションの種別で分岐
  486. case @active_battler.current_action.kind
  487. when 0
  488. # 攻撃?防御?逃げる?何もしない時の共通消費CP
  489. @active_battler.cp -= CP_COST_BASIC_ACTIONS if @phase4_act_continuation == 0
  490. when 1
  491. # スキル使用時の消費CP
  492. @active_battler.cp -= CP_COST_SKILL_ACTION if @phase4_act_continuation == 0
  493. when 2
  494. # アイテム使用時の消費CP
  495. @active_battler.cp -= CP_COST_ITEM_ACTION if @phase4_act_continuation == 0
  496. end
  497. # ステート自然解除
  498. @active_battler.remove_states_auto
  499. # 呼び戻す
  500. xrxs_bp1_update_phase4_step2
  501. end
  502. #--------------------------------------------------------------------------
  503. # ● 基本アクション 結果作成
  504. #--------------------------------------------------------------------------
  505. alias xrxs_bp1_make_basic_action_result make_basic_action_result
  506. def make_basic_action_result
  507. # 攻撃の場合
  508. if @active_battler.current_action.basic == 0 and @phase4_act_continuation == 0
  509. @active_battler.cp -= CP_COST_BASIC_ATTACK # 攻撃時のCP消費
  510. end
  511. # 防御の場合
  512. if @active_battler.current_action.basic == 1 and @phase4_act_continuation == 0
  513. @active_battler.cp -= CP_COST_BASIC_GUARD # 防御時のCP消費
  514. # @active_battlerの防御をON
  515. @active_battler.now_guarding = true
  516. end
  517. # 敵の逃げるの場合
  518. if @active_battler.is_a?(Game_Enemy) and
  519. @active_battler.current_action.basic == 2 and @phase4_act_continuation == 0
  520. @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  521. end
  522. # 何もしないの場合
  523. if @active_battler.current_action.basic == 3 and @phase4_act_continuation == 0
  524. @active_battler.cp -= CP_COST_BASIC_NOTHING # 何もしない時のCP消費
  525. end
  526. # 逃げるの場合
  527. if @active_battler.current_action.basic == 4 and @phase4_act_continuation == 0
  528. @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  529. # 逃走可能ではない場合
  530. if $game_temp.battle_can_escape == false
  531. # ブザー SE を演奏
  532. $game_system.se_play($data_system.buzzer_se)
  533. return
  534. end
  535. # 逃走処理
  536. update_phase2_escape
  537. return
  538. end
  539. # 呼び戻す
  540. xrxs_bp1_make_basic_action_result
  541. end
  542. #--------------------------------------------------------------------------
  543. # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  544. #--------------------------------------------------------------------------
  545. alias xrxs_bp1_update_phase4_step6 update_phase4_step6
  546. def update_phase4_step6
  547. # スリップダメージ
  548. if @active_battler.hp > 0 and @active_battler.slip_damage?
  549. @active_battler.slip_damage_effect
  550. @active_battler.damage_pop = true
  551. # ステータスウィンドウをリフレッシュ
  552. @status_window.refresh
  553. end
  554. # 呼び戻す
  555. xrxs_bp1_update_phase4_step6
  556. end
  557. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-23 18:11

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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