Project1
标题:
[RM脚本] 战斗回数显示
[打印本页]
作者:
九泪
时间:
2006-5-29 22:56
标题:
[RM脚本] 战斗回数显示
效果图:
#==============================================================================
# ++ 戦闘回数表示 ver. 1.00 ++
# Script by パラ犬
# http://para.j-mx.com/
#------------------------------------------------------------------------------
# 歩数ウインドウに戦闘回数、倒した敵の数、逃走回数を表示します。
#------------------------------------------------------------------------------
# 変数をイベントに使用する場合、
# $game_party.battle_count (戦闘回数)
# $game_party.defeat_count (倒した敵の数)
# $game_party.escape_count (逃走回数)
# で、それぞれの数値を取得できます。
#
# 「$game_party.~」を変数に格納するスクリプトは、
# $game_variables[変数のID] = $game_party.~
# となります。
#==============================================================================
module PARA_BATTLE_COUNT
# 表示項目( 0:すべて / 1:戦闘回数 / 2:倒した敵の数 / 3:逃走回数 )
TYPE = 1
# 各項目の名前
NAME_ENCOUNT = "戦闘回数" # 戦闘回数
NAME_DEFEAT = "敵撃破数" # 倒した敵の数
NAME_ESCAPE = "逃走回数" # 逃走回数
end
# ↑ 設定項目ここまで
#------------------------------------------------------------------------------
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :battle_count # 戦闘回数
attr_reader :defeat_count # 倒した敵の数
attr_reader :escape_count # 逃走回数
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_para_battle_count initialize
def initialize
initialize_para_battle_count
@battle_count = 0
@defeat_count = 0
@escape_count = 0
end
#--------------------------------------------------------------------------
# ○ 戦闘回数増加
#--------------------------------------------------------------------------
def increase_battle_count
@battle_count = [@battle_count + 1, 9999999].min
end
#--------------------------------------------------------------------------
# ○ 撃破数増加
#--------------------------------------------------------------------------
def increase_defeat_count(count)
@defeat_count = [@defeat_count + count, 9999999].min
end
#--------------------------------------------------------------------------
# ○ 逃走回数増加
#--------------------------------------------------------------------------
def increase_escape_count
@escape_count = [@escape_count + 1, 9999999].min
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
alias start_phase1_para_battle_count start_phase1
def start_phase1
@enemies_count = $game_troop.enemies.size
start_phase1_para_battle_count
end
#--------------------------------------------------------------------------
# ● バトル終了
# result : 結果 (0:勝利 1:逃走 2:敗北)
#--------------------------------------------------------------------------
alias battle_end_para_battle_count battle_end
def battle_end(result)
case result
when 0
$game_party.increase_battle_count
$game_party.increase_defeat_count(@enemies_count)
when 1
$game_party.increase_battle_count
$game_party.increase_escape_count
exist_enemy = 0
for enemy in $game_troop.enemies
if enemy.exist?
exist_enemy += 1
end
end
@enemies_count = @enemies_count - exist_enemy
$game_party.increase_defeat_count(@enemies_count)
end
battle_end_para_battle_count(result)
end
end
#==============================================================================
# ■ Window_Steps
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
case PARA_BATTLE_COUNT::TYPE
when 0
self.contents.font.size = 18
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 76, 20, PARA_BATTLE_COUNT::NAME_ENCOUNT)
self.contents.font.color = normal_color
self.contents.draw_text(84, 0, 40, 20, $game_party.battle_count.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 21, 76, 20, PARA_BATTLE_COUNT::NAME_DEFEAT)
self.contents.font.color = normal_color
self.contents.draw_text(84, 21, 40, 20, $game_party.defeat_count.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 42, 76, 20, PARA_BATTLE_COUNT::NAME_ESCAPE)
self.contents.font.color = normal_color
self.contents.draw_text(84, 42, 40, 20, $game_party.escape_count.to_s, 2)
when 1
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_ENCOUNT)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.battle_count.to_s, 2)
when 2
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_DEFEAT)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.defeat_count.to_s, 2)
when 3
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_ESCAPE)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.escape_count.to_s, 2)
end
end
end
复制代码
直接插入main前即可
恩,也可以制作一个与npc对话,显示已经战斗几次的功能:
事件设置如下:
[更新履歴]
2005/8/6 ver.1.00
公開。
作者:
九泪
时间:
2006-5-29 22:56
标题:
[RM脚本] 战斗回数显示
效果图:
#==============================================================================
# ++ 戦闘回数表示 ver. 1.00 ++
# Script by パラ犬
# http://para.j-mx.com/
#------------------------------------------------------------------------------
# 歩数ウインドウに戦闘回数、倒した敵の数、逃走回数を表示します。
#------------------------------------------------------------------------------
# 変数をイベントに使用する場合、
# $game_party.battle_count (戦闘回数)
# $game_party.defeat_count (倒した敵の数)
# $game_party.escape_count (逃走回数)
# で、それぞれの数値を取得できます。
#
# 「$game_party.~」を変数に格納するスクリプトは、
# $game_variables[変数のID] = $game_party.~
# となります。
#==============================================================================
module PARA_BATTLE_COUNT
# 表示項目( 0:すべて / 1:戦闘回数 / 2:倒した敵の数 / 3:逃走回数 )
TYPE = 1
# 各項目の名前
NAME_ENCOUNT = "戦闘回数" # 戦闘回数
NAME_DEFEAT = "敵撃破数" # 倒した敵の数
NAME_ESCAPE = "逃走回数" # 逃走回数
end
# ↑ 設定項目ここまで
#------------------------------------------------------------------------------
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :battle_count # 戦闘回数
attr_reader :defeat_count # 倒した敵の数
attr_reader :escape_count # 逃走回数
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_para_battle_count initialize
def initialize
initialize_para_battle_count
@battle_count = 0
@defeat_count = 0
@escape_count = 0
end
#--------------------------------------------------------------------------
# ○ 戦闘回数増加
#--------------------------------------------------------------------------
def increase_battle_count
@battle_count = [@battle_count + 1, 9999999].min
end
#--------------------------------------------------------------------------
# ○ 撃破数増加
#--------------------------------------------------------------------------
def increase_defeat_count(count)
@defeat_count = [@defeat_count + count, 9999999].min
end
#--------------------------------------------------------------------------
# ○ 逃走回数増加
#--------------------------------------------------------------------------
def increase_escape_count
@escape_count = [@escape_count + 1, 9999999].min
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
alias start_phase1_para_battle_count start_phase1
def start_phase1
@enemies_count = $game_troop.enemies.size
start_phase1_para_battle_count
end
#--------------------------------------------------------------------------
# ● バトル終了
# result : 結果 (0:勝利 1:逃走 2:敗北)
#--------------------------------------------------------------------------
alias battle_end_para_battle_count battle_end
def battle_end(result)
case result
when 0
$game_party.increase_battle_count
$game_party.increase_defeat_count(@enemies_count)
when 1
$game_party.increase_battle_count
$game_party.increase_escape_count
exist_enemy = 0
for enemy in $game_troop.enemies
if enemy.exist?
exist_enemy += 1
end
end
@enemies_count = @enemies_count - exist_enemy
$game_party.increase_defeat_count(@enemies_count)
end
battle_end_para_battle_count(result)
end
end
#==============================================================================
# ■ Window_Steps
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
case PARA_BATTLE_COUNT::TYPE
when 0
self.contents.font.size = 18
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 76, 20, PARA_BATTLE_COUNT::NAME_ENCOUNT)
self.contents.font.color = normal_color
self.contents.draw_text(84, 0, 40, 20, $game_party.battle_count.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 21, 76, 20, PARA_BATTLE_COUNT::NAME_DEFEAT)
self.contents.font.color = normal_color
self.contents.draw_text(84, 21, 40, 20, $game_party.defeat_count.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 42, 76, 20, PARA_BATTLE_COUNT::NAME_ESCAPE)
self.contents.font.color = normal_color
self.contents.draw_text(84, 42, 40, 20, $game_party.escape_count.to_s, 2)
when 1
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_ENCOUNT)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.battle_count.to_s, 2)
when 2
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_DEFEAT)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.defeat_count.to_s, 2)
when 3
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, PARA_BATTLE_COUNT::NAME_ESCAPE)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.escape_count.to_s, 2)
end
end
end
复制代码
直接插入main前即可
恩,也可以制作一个与npc对话,显示已经战斗几次的功能:
事件设置如下:
[更新履歴]
2005/8/6 ver.1.00
公開。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1