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

Project1

 找回密码
 注册会员
搜索
查看: 2849|回复: 1

[RM脚本] 战斗回数显示

 关闭 [复制链接]

Lv1.梦旅人

NewS-

梦石
0
星屑
50
在线时间
5 小时
注册时间
2005-10-23
帖子
3651

贵宾

发表于 2006-5-29 22:56:32 | 显示全部楼层 |阅读模式

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

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

x
效果图:



  1. #==============================================================================
  2. # ++ 戦闘回数表示 ver. 1.00 ++
  3. #  Script by パラ犬
  4. #  http://para.j-mx.com/
  5. #------------------------------------------------------------------------------
  6. # 歩数ウインドウに戦闘回数、倒した敵の数、逃走回数を表示します。
  7. #------------------------------------------------------------------------------
  8. # 変数をイベントに使用する場合、
  9. #  $game_party.battle_count (戦闘回数)
  10. #  $game_party.defeat_count (倒した敵の数)
  11. #  $game_party.escape_count (逃走回数)
  12. # で、それぞれの数値を取得できます。
  13. #
  14. # 「$game_party.~」を変数に格納するスクリプトは、
  15. # $game_variables[変数のID] = $game_party.~
  16. # となります。
  17. #==============================================================================

  18. module PARA_BATTLE_COUNT
  19.   
  20.   # 表示項目( 0:すべて / 1:戦闘回数 / 2:倒した敵の数 / 3:逃走回数 )
  21.   TYPE = 1

  22.   # 各項目の名前
  23.   NAME_ENCOUNT = "戦闘回数"   # 戦闘回数
  24.   NAME_DEFEAT = "敵撃破数"    # 倒した敵の数
  25.   NAME_ESCAPE = "逃走回数"    # 逃走回数

  26. end

  27. # ↑ 設定項目ここまで
  28. #------------------------------------------------------------------------------

  29. #==============================================================================
  30. # ■ Game_Party
  31. #==============================================================================

  32. class Game_Party
  33.   #--------------------------------------------------------------------------
  34.   # ● 公開インスタンス変数
  35.   #--------------------------------------------------------------------------
  36.   attr_reader   :battle_count         # 戦闘回数
  37.   attr_reader   :defeat_count         # 倒した敵の数
  38.   attr_reader   :escape_count         # 逃走回数
  39.   #--------------------------------------------------------------------------
  40.   # ● オブジェクト初期化
  41.   #--------------------------------------------------------------------------
  42.   alias initialize_para_battle_count initialize
  43.   def initialize
  44.     initialize_para_battle_count
  45.     @battle_count = 0
  46.     @defeat_count = 0
  47.     @escape_count = 0
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ○ 戦闘回数増加
  51.   #--------------------------------------------------------------------------
  52.   def increase_battle_count
  53.     @battle_count = [@battle_count + 1, 9999999].min
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ○ 撃破数増加
  57.   #--------------------------------------------------------------------------
  58.   def increase_defeat_count(count)
  59.     @defeat_count = [@defeat_count + count, 9999999].min
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ○ 逃走回数増加
  63.   #--------------------------------------------------------------------------
  64.   def increase_escape_count
  65.     @escape_count = [@escape_count + 1, 9999999].min
  66.   end
  67. end

  68. #==============================================================================
  69. # ■ Scene_Battle
  70. #==============================================================================

  71. class Scene_Battle
  72.   #--------------------------------------------------------------------------
  73.   # ● プレバトルフェーズ開始
  74.   #--------------------------------------------------------------------------
  75.   alias start_phase1_para_battle_count start_phase1
  76.   def start_phase1
  77.     @enemies_count = $game_troop.enemies.size
  78.     start_phase1_para_battle_count
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● バトル終了
  82.   #     result : 結果 (0:勝利 1:逃走 2:敗北)
  83.   #--------------------------------------------------------------------------
  84.   alias battle_end_para_battle_count battle_end
  85.   def battle_end(result)
  86.     case result
  87.       when 0
  88.         $game_party.increase_battle_count
  89.         $game_party.increase_defeat_count(@enemies_count)
  90.       when 1
  91.         $game_party.increase_battle_count
  92.         $game_party.increase_escape_count
  93.         exist_enemy = 0
  94.         for enemy in $game_troop.enemies
  95.           if enemy.exist?
  96.             exist_enemy += 1
  97.           end
  98.         end
  99.         @enemies_count = @enemies_count - exist_enemy
  100.         $game_party.increase_defeat_count(@enemies_count)
  101.     end
  102.     battle_end_para_battle_count(result)
  103.   end
  104. end


  105. #==============================================================================
  106. # ■ Window_Steps
  107. #==============================================================================

  108. class Window_Steps < Window_Base
  109.   #--------------------------------------------------------------------------
  110.   # ● リフレッシュ
  111.   #--------------------------------------------------------------------------
  112.   def refresh
  113.     self.contents.clear
  114.     case PARA_BATTLE_COUNT::TYPE
  115.       when 0
  116.         self.contents.font.size = 18
  117.         self.contents.font.color = system_color
  118.         self.contents.draw_text(4, 0, 76, 20, PARA_BATTLE_COUNT::NAME_ENCOUNT)
  119.         self.contents.font.color = normal_color
  120.         self.contents.draw_text(84, 0, 40, 20, $game_party.battle_count.to_s, 2)
  121.         self.contents.font.color = system_color
  122.         self.contents.draw_text(4, 21, 76, 20, PARA_BATTLE_COUNT::NAME_DEFEAT)
  123.         self.contents.font.color = normal_color
  124.         self.contents.draw_text(84, 21, 40, 20, $game_party.defeat_count.to_s, 2)
  125.         self.contents.font.color = system_color
  126.         self.contents.draw_text(4, 42, 76, 20, PARA_BATTLE_COUNT::NAME_ESCAPE)
  127.         self.contents.font.color = normal_color
  128.         self.contents.draw_text(84, 42, 40, 20, $game_party.escape_count.to_s, 2)
  129.       when 1
  130.         self.contents.font.color = system_color
  131.         self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_ENCOUNT)
  132.         self.contents.font.color = normal_color
  133.         self.contents.draw_text(4, 32, 120, 32, $game_party.battle_count.to_s, 2)
  134.       when 2
  135.         self.contents.font.color = system_color
  136.         self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_DEFEAT)
  137.         self.contents.font.color = normal_color
  138.         self.contents.draw_text(4, 32, 120, 32, $game_party.defeat_count.to_s, 2)
  139.       when 3
  140.         self.contents.font.color = system_color
  141.         self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_ESCAPE)
  142.         self.contents.font.color = normal_color
  143.         self.contents.draw_text(4, 32, 120, 32, $game_party.escape_count.to_s, 2)
  144.     end
  145.   end
  146. end
复制代码


直接插入main前即可

恩,也可以制作一个与npc对话,显示已经战斗几次的功能:



事件设置如下:



[更新履歴]
2005/8/6 ver.1.00
 公開。

66RPG,这几个简单字符,之于我代表了什么?泪泪博客:http://hi.baidu.com/rpgmakerxp

Lv1.梦旅人

NewS-

梦石
0
星屑
50
在线时间
5 小时
注册时间
2005-10-23
帖子
3651

贵宾

 楼主| 发表于 2006-5-29 22:56:32 | 显示全部楼层 |阅读模式

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

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

x
效果图:



  1. #==============================================================================
  2. # ++ 戦闘回数表示 ver. 1.00 ++
  3. #  Script by パラ犬
  4. #  http://para.j-mx.com/
  5. #------------------------------------------------------------------------------
  6. # 歩数ウインドウに戦闘回数、倒した敵の数、逃走回数を表示します。
  7. #------------------------------------------------------------------------------
  8. # 変数をイベントに使用する場合、
  9. #  $game_party.battle_count (戦闘回数)
  10. #  $game_party.defeat_count (倒した敵の数)
  11. #  $game_party.escape_count (逃走回数)
  12. # で、それぞれの数値を取得できます。
  13. #
  14. # 「$game_party.~」を変数に格納するスクリプトは、
  15. # $game_variables[変数のID] = $game_party.~
  16. # となります。
  17. #==============================================================================

  18. module PARA_BATTLE_COUNT
  19.   
  20.   # 表示項目( 0:すべて / 1:戦闘回数 / 2:倒した敵の数 / 3:逃走回数 )
  21.   TYPE = 1

  22.   # 各項目の名前
  23.   NAME_ENCOUNT = "戦闘回数"   # 戦闘回数
  24.   NAME_DEFEAT = "敵撃破数"    # 倒した敵の数
  25.   NAME_ESCAPE = "逃走回数"    # 逃走回数

  26. end

  27. # ↑ 設定項目ここまで
  28. #------------------------------------------------------------------------------

  29. #==============================================================================
  30. # ■ Game_Party
  31. #==============================================================================

  32. class Game_Party
  33.   #--------------------------------------------------------------------------
  34.   # ● 公開インスタンス変数
  35.   #--------------------------------------------------------------------------
  36.   attr_reader   :battle_count         # 戦闘回数
  37.   attr_reader   :defeat_count         # 倒した敵の数
  38.   attr_reader   :escape_count         # 逃走回数
  39.   #--------------------------------------------------------------------------
  40.   # ● オブジェクト初期化
  41.   #--------------------------------------------------------------------------
  42.   alias initialize_para_battle_count initialize
  43.   def initialize
  44.     initialize_para_battle_count
  45.     @battle_count = 0
  46.     @defeat_count = 0
  47.     @escape_count = 0
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ○ 戦闘回数増加
  51.   #--------------------------------------------------------------------------
  52.   def increase_battle_count
  53.     @battle_count = [@battle_count + 1, 9999999].min
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ○ 撃破数増加
  57.   #--------------------------------------------------------------------------
  58.   def increase_defeat_count(count)
  59.     @defeat_count = [@defeat_count + count, 9999999].min
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ○ 逃走回数増加
  63.   #--------------------------------------------------------------------------
  64.   def increase_escape_count
  65.     @escape_count = [@escape_count + 1, 9999999].min
  66.   end
  67. end

  68. #==============================================================================
  69. # ■ Scene_Battle
  70. #==============================================================================

  71. class Scene_Battle
  72.   #--------------------------------------------------------------------------
  73.   # ● プレバトルフェーズ開始
  74.   #--------------------------------------------------------------------------
  75.   alias start_phase1_para_battle_count start_phase1
  76.   def start_phase1
  77.     @enemies_count = $game_troop.enemies.size
  78.     start_phase1_para_battle_count
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● バトル終了
  82.   #     result : 結果 (0:勝利 1:逃走 2:敗北)
  83.   #--------------------------------------------------------------------------
  84.   alias battle_end_para_battle_count battle_end
  85.   def battle_end(result)
  86.     case result
  87.       when 0
  88.         $game_party.increase_battle_count
  89.         $game_party.increase_defeat_count(@enemies_count)
  90.       when 1
  91.         $game_party.increase_battle_count
  92.         $game_party.increase_escape_count
  93.         exist_enemy = 0
  94.         for enemy in $game_troop.enemies
  95.           if enemy.exist?
  96.             exist_enemy += 1
  97.           end
  98.         end
  99.         @enemies_count = @enemies_count - exist_enemy
  100.         $game_party.increase_defeat_count(@enemies_count)
  101.     end
  102.     battle_end_para_battle_count(result)
  103.   end
  104. end


  105. #==============================================================================
  106. # ■ Window_Steps
  107. #==============================================================================

  108. class Window_Steps < Window_Base
  109.   #--------------------------------------------------------------------------
  110.   # ● リフレッシュ
  111.   #--------------------------------------------------------------------------
  112.   def refresh
  113.     self.contents.clear
  114.     case PARA_BATTLE_COUNT::TYPE
  115.       when 0
  116.         self.contents.font.size = 18
  117.         self.contents.font.color = system_color
  118.         self.contents.draw_text(4, 0, 76, 20, PARA_BATTLE_COUNT::NAME_ENCOUNT)
  119.         self.contents.font.color = normal_color
  120.         self.contents.draw_text(84, 0, 40, 20, $game_party.battle_count.to_s, 2)
  121.         self.contents.font.color = system_color
  122.         self.contents.draw_text(4, 21, 76, 20, PARA_BATTLE_COUNT::NAME_DEFEAT)
  123.         self.contents.font.color = normal_color
  124.         self.contents.draw_text(84, 21, 40, 20, $game_party.defeat_count.to_s, 2)
  125.         self.contents.font.color = system_color
  126.         self.contents.draw_text(4, 42, 76, 20, PARA_BATTLE_COUNT::NAME_ESCAPE)
  127.         self.contents.font.color = normal_color
  128.         self.contents.draw_text(84, 42, 40, 20, $game_party.escape_count.to_s, 2)
  129.       when 1
  130.         self.contents.font.color = system_color
  131.         self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_ENCOUNT)
  132.         self.contents.font.color = normal_color
  133.         self.contents.draw_text(4, 32, 120, 32, $game_party.battle_count.to_s, 2)
  134.       when 2
  135.         self.contents.font.color = system_color
  136.         self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_DEFEAT)
  137.         self.contents.font.color = normal_color
  138.         self.contents.draw_text(4, 32, 120, 32, $game_party.defeat_count.to_s, 2)
  139.       when 3
  140.         self.contents.font.color = system_color
  141.         self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_ESCAPE)
  142.         self.contents.font.color = normal_color
  143.         self.contents.draw_text(4, 32, 120, 32, $game_party.escape_count.to_s, 2)
  144.     end
  145.   end
  146. end
复制代码


直接插入main前即可

恩,也可以制作一个与npc对话,显示已经战斗几次的功能:



事件设置如下:



[更新履歴]
2005/8/6 ver.1.00
 公開。

66RPG,这几个简单字符,之于我代表了什么?泪泪博客:http://hi.baidu.com/rpgmakerxp
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-3-28 19:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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