Kain Nobel
Member
Game : Battle Logger
Version: 2.0
By: Kain Nobel
Introduction
This quite simply is a Tool for Eventers/Scripters, which collects data between all actors & enemies which have participated in at least one battle. Anything that normally happens within a battle is logged, including a battler's stats when they entered that battle and their actions towards other members of the fight.
There are two systems that I've designed that especially utilize this tool, either as an plug-in or a requirement. One system is my Bestiary scene (not posted yet), and since somebody could be changing their enemies' stats (via my Auto-Level Enemies script, in example) that is the reason of logging attributes, which the Bestiary looks for.
Features
Script
Instructions
Place below 'SDK' and above 'main'. Anything that utilizes the Battle Log system should, in theory, work above or below the script but if you encounter any problems paste this script above systems that use it.
FAQ
Coming Soon...
Compatibility
Author's Notes
Feel free to post ideas for what you could use this for, I might post a couple myself so people can get a better feel of what you'd use this system for. I might make a demo with instructions later, but until then its easy to look through the script and figure out what it does, and the syntax used to refer to certain logs.
If there is anything that you think I might've forgotten to log (I already know I forgot to log item usage, I'll put that in there in a little bit), then please tell me. If you have any major issues related to another script, or you're looking for a non-SDK or VX conversion, please handle that in a seperate topic in Script Support. You can feel free to post a link to the topic here, or via PM and I'll definately try to help you out the best I can!
Lastly, anything neat you happen to do with this, I'd love to check it out!
Terms and Conditions
Free to use in 'commercial' and 'non-commercial' games, so long as you credit me for creation of the basic battle logger.
Version: 2.0
By: Kain Nobel
Introduction
This quite simply is a Tool for Eventers/Scripters, which collects data between all actors & enemies which have participated in at least one battle. Anything that normally happens within a battle is logged, including a battler's stats when they entered that battle and their actions towards other members of the fight.
There are two systems that I've designed that especially utilize this tool, either as an plug-in or a requirement. One system is my Bestiary scene (not posted yet), and since somebody could be changing their enemies' stats (via my Auto-Level Enemies script, in example) that is the reason of logging attributes, which the Bestiary looks for.
Features
- All features apply to both types of battlers; actor or enemy
- Automatically logs each battler's current and max HP/SP, and other attributes
- Automatically logs each battler's extra attributes (non-standard, user-made attributes)
- Automatically logs each battler's hit count
- Automatically logs each battler's miss count
- Automatically logs each battler's critical count
- Automatically logs each battler's defeat count
- Automatically logs each battler's victory count
- Automatically logs each battler's healed count
- Automatically logs each batter's raised count
- Automatically logs each battler's killed count
- Automatically logs each battler's last battleback (for Bestiary :wink
- Automatically logs and lists each battler's Map ID
- Automatically logs and lists each battler's Skill Usage
- Automatically logs and lists each battler's State Inflictions
- Automatically logs and lists each battler's healed battlers
- Automatically logs and lists each battler's raised battlers
- Automatically logs and lists each battler's killed battlers
Script
Code:
#===============================================================================
# * Game : Battle Log
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
SDK.log('Game.BattleLog', 'Kain Nobel ©', 3.5, '2009.06.16')
#-------------------------------------------------------------------------------
# * SDK Enabled Test : Begin
#-------------------------------------------------------------------------------
if SDK.enabled?('Game.BattleLog')
#===============================================================================
# ** Game_BattleLog
#===============================================================================
class Game_BattleLog
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :maxhp
attr_accessor :maxsp
attr_accessor :hp
attr_accessor :sp
attr_accessor :atk
attr_accessor :pdef
attr_accessor :mdef
attr_accessor :eva
attr_accessor :str
attr_accessor :dex
attr_accessor :agi
attr_accessor :int
attr_accessor :hit_count
attr_accessor :miss_count
attr_accessor :critical_count
attr_accessor :encounter_count
attr_accessor :escape_count
attr_accessor :defeat_count
attr_accessor :victor_count
attr_accessor :healed_count
attr_accessor :raised_count
attr_accessor :killed_count
attr_accessor :battleback
attr_accessor :logged_mapids
attr_accessor :logged_skills
attr_accessor :logged_states
attr_accessor :actor_healed_log
attr_accessor :actor_raised_log
attr_accessor :actor_killed_log
attr_accessor :enemy_healed_log
attr_accessor :enemy_raised_log
attr_accessor :enemy_killed_log
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
@maxhp = 0 # Last logged in battle : Max HP
@maxsp = 0 # Last logged in battle : Max SP
@hp = 0 # Last logged in battle : Current HP
@sp = 0 # Last logged in battle : Current SP
@atk = 0 # Last logged in battle : Attack
@pdef = 0 # Last logged in battle : P. Defense
@mdef = 0 # Last logged in battle : M. Defense
@eva = 0 # Last logged in battle : Evade
@str = 0 # Last logged in battle : Strength
@dex = 0 # Last logged in battle : Dexterity
@agi = 0 # Last logged in battle : Agility
@int = 0 # Last logged in battle : Intelligence
@hit_count = 0 # Last logged in battle : Hit Count
@miss_count = 0 # Last logged in battle : Miss Count
@critical_count = 0 # Last logged in battle : Critical Count
@encounter_count = 0 # Last logged in battle : Encounter Count
@escape_count = 0 # Last logged in battle : Escape Count
@defeat_count = 0 # Last logged in battle : Defeat Count
@victor_count = 0 # Last logged in battle : Victory Count
@healed_count = 0 # Last logged in battle : Healed Count
@raised_count = 0 # Last logged in battle : Raised Count
@killed_count = 0 # Last logged in battle : Killed Count
@battleback = String.new # Last logged in battle : Battleback
@logged_mapids = Hash.new # Last logged in battle : Maps encountered
@logged_skills = Hash.new # Last logged in battle : Skill Usage
@logged_states = Hash.new # Last logged in battle : State Infliction
@actor_healed_log = Hash.new # Detailed log of Actors battler healed
@actor_raised_log = Hash.new # Detailed log of Actors battler raised
@actor_killed_log = Hash.new # Detailed log of Actors battler killed
@enemy_healed_log = Hash.new # Detailed log of Enemies battler healed
@enemy_raised_log = Hash.new # Detailed log of Enemies battler raised
@enemy_killed_log = Hash.new # Detailed log of Enemies battler killed
@logged_mapids.default = 0
@logged_skills.default = 0
@logged_states.default = 0
@actor_healed_log.default = 0
@actor_raised_log.default = 0
@actor_killed_log.default = 0
@enemy_healed_log.default = 0
@enemy_raised_log.default = 0
@enemy_killed_log.default = 0
end
#-----------------------------------------------------------------------------
# * Print List
#-----------------------------------------------------------------------------
def print_list
arr = Array.new
arr << "Max HP" ; arr << @maxhp
arr << "HP" ; arr << @hp
arr << "Max SP" ; arr << @maxsp
arr << "SP" ; arr << @sp
arr << "Attack" ; arr << @atk
arr << "P. Defense" ; arr << @pdef
arr << "M. Defense" ; arr << @mdef
arr << "Evade" ; arr << @eva
arr << "Strength" ; arr << @str
arr << "Dexterity" ; arr << @dex
arr << "Agility" ; arr << @agi
arr << "Intelligence" ; arr << @int
arr << "Hit Count" ; arr << @hit_count
arr << "Miss Count" ; arr << @miss_count
arr << "Critical Count" ; arr << @critical_count
arr << "Encounter Count" ; arr << @encounter_count
arr << "Victor Count" ; arr << @victor_count
arr << "Defeat Count" ; arr << @defeat_count
arr << "Escape Count" ; arr << @escape_count
arr << "Healed Count" ; arr << @healed_count
arr << "Raised Count" ; arr << @raised_count
arr << "Killed Count" ; arr << @killed_count
arr << "Last Battleback" ; arr << @battleback
arr << "Logged Map IDs" ; arr << @logged_mapids
arr << "Logged Skills" ; arr << @logged_skills
arr << "Logged States" ; arr << @logged_states
arr << "Actor Healed Log" ; arr << @actor_healed_log
arr << "Actor Raised Log" ; arr << @actor_raised_log
arr << "Actor Killed Log" ; arr << @actor_killed_log
arr << "Enemy Healed Log" ; arr << @enemy_healed_log
arr << "Enemy Raised Log" ; arr << @enemy_raised_log
arr << "Enemy Killed Log" ; arr << @enemy_killed_log
p *arr
end
end
#===============================================================================
# ** Game_BattleLogs
#===============================================================================
class Game_BattleLogs
#-----------------------------------------------------------------------------
# * Customizable Constants
#-----------------------------------------------------------------------------
Actor_Attributes = []
Enemy_Attributes = []
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
@actor_data = Hash.new
@enemy_data = Hash.new
for i in 0...$data_actors.size
@actor_data[i] = Game_BattleLog.new
end
for i in 0...$data_enemies.size
@enemy_data[i] = Game_BattleLog.new
end
end
#-----------------------------------------------------------------------------
# * Actor
#-----------------------------------------------------------------------------
def actor(id)
@actor_data[id]
end
#-----------------------------------------------------------------------------
# * Enemy
#-----------------------------------------------------------------------------
def enemy(id)
@enemy_data[id]
end
#-----------------------------------------------------------------------------
# * Actor Attributes
#-----------------------------------------------------------------------------
def actor_attributes
return Actor_Attributes
end
#-----------------------------------------------------------------------------
# * Enemy Attributes
#-----------------------------------------------------------------------------
def enemy_attributes
return Enemy_Attributes
end
#-----------------------------------------------------------------------------
# * Battler to ID
#-----------------------------------------------------------------------------
def battler_to_id(battler)
return actor_to_id(battler) if battler.is_a?(Game_Actor)
return enemy_to_id(battler) if battler.is_a?(Game_Battler)
return battler if battler.is_a?(Integer)
return 0
end
#-----------------------------------------------------------------------------
# * Actor to ID
#-----------------------------------------------------------------------------
def actor_to_id(actor)
if actor.is_a?(Game_Actor)
return actor.id
end
if actor.is_a?(Integer)
return actor
end
return 0
end
#-----------------------------------------------------------------------------
# * Enemy to ID
#-----------------------------------------------------------------------------
def enemy_to_id(enemy)
if enemy.is_a?(Game_Enemy)
return enemy.id
end
if enemy.is_a?(Integer)
return enemy
end
return 0
end
#-----------------------------------------------------------------------------
# * Clear Actor Logs
#-----------------------------------------------------------------------------
def clear_actor_logs(actor_ids = 0)
if actor_ids.is_a?(Numeric)
if actor_ids.zero?
@actor_data.each_key {|key| @actor_data[key] = Game_BattleLog.new}
else
if @actor_data.has_key?(id)
@actor_data[id] = Game_BattleLog.new
end
end
elsif actor_ids.is_a?(Array)
actor_ids.each {|id| @actor_data[id] = Game_BattleLog.new}
end
end
#-----------------------------------------------------------------------------
# * Clear Enemy Logs
#-----------------------------------------------------------------------------
def clear_enemy_logs(enemy_ids = 0)
if enemy_ids.is_a?(Numeric)
if enemy_ids.zero?
@enemy_data.each_key {|key| @enemy_data[key] = Game_BattleLog.new}
else
if @enemy_data.has_key?(id)
@enemy_data[id] = Game_BattleLog.new
end
end
elsif enemy_ids.is_a?(Array)
enemy_ids.each {|id| @enemy_data[id] = Game_BattleLog.new}
end
end
end
#===============================================================================
# ** Game_Battler
#===============================================================================
class Game_Battler
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battlelog_gmbtlr_atkeff, :attack_effect
alias_method :battlelog_gmbtlr_2hitresult, :attack_effect_second_hit_result
alias_method :battlelog_gmbtlr_atkeffdamage,:attack_effect_damage
alias_method :battlelog_gmbtlr_atkeffmiss, :attack_effect_miss
alias_method :battlelog_gmbtlr_skleff, :skill_effect
alias_method :battlelog_gmbtlr_skleffdamage,:skill_effect_damage
alias_method :battlelog_gmbtlr_skleffmiss, :skill_effect_miss
alias_method :battlelog_gmbtlr_addstate, :add_state
#-----------------------------------------------------------------------------
# * Attack Effect
#-----------------------------------------------------------------------------
def attack_effect(attacker)
@offense = attacker
battlelog_gmbtlr_atkeff(attacker)
end
#-----------------------------------------------------------------------------
# * Attack Effect : Second Hit Result
#-----------------------------------------------------------------------------
def attack_effect_second_hit_result(attacker)
result = battlelog_gmbtlr_2hitresult(attacker)
attacker.battlelog.critical_count += 1 if self.critical && result
return result
end
#-----------------------------------------------------------------------------
# * Attack Effect : Damage
#-----------------------------------------------------------------------------
def attack_effect_damage
battlelog_gmbtlr_atkeffdamage
if self.hp0?
self.log_killed_by(@offense)
end
@offense.battlelog.hit_count += 1
end
#-----------------------------------------------------------------------------
# * Attack Effect : Miss
#-----------------------------------------------------------------------------
def attack_effect_miss
battlelog_gmbtlr_atkeffmiss
@offense.battlelog.miss_count += 1
end
#-----------------------------------------------------------------------------
# * Skill Effect
#-----------------------------------------------------------------------------
def skill_effect(user, skill)
@offense = user
@offense.log_skill(skill)
battlelog_gmbtlr_skleff(user, skill)
end
#-----------------------------------------------------------------------------
# * Skill Effect : Damage
#-----------------------------------------------------------------------------
def skill_effect_damage
already_dead = self.hp0?
if self.damage < 0
if self.hp0?
self.log_raised_by(@offense)
else
self.log_healed_by(@offense)
end
end
if self.hp0? && !already_dead
self.log_killed_by(@offense)
end
@offense.battlelog.hit_count += 1
return battlelog_gmbtlr_skleffdamage
end
#-----------------------------------------------------------------------------
# * Skill Effect : Miss
#-----------------------------------------------------------------------------
def skill_effect_miss
battlelog_gmbtlr_skleffmiss
@offense.battlelog.miss_count += 1
end
#-----------------------------------------------------------------------------
# * BattleLog
#-----------------------------------------------------------------------------
def battlelog
case self.class.to_s
when "Game_Actor" then return $game_battlelog.actor(id)
when "Game_Enemy" then return $game_battlelog.enemy(id)
end
end
#-----------------------------------------------------------------------------
# * Add State
#-----------------------------------------------------------------------------
def add_state(state_id, force = false)
already_inflicted = @states.include?(state_id)
battlelog_gmbtlr_addstate(state_id, force)
if @states.include?(state_id) && !already_inflicted
battlelog.logged_states[state_id] += 1
end
end
#-----------------------------------------------------------------------------
# * Get Logged Attributes
#-----------------------------------------------------------------------------
def get_logged_attributes
attrs = ['hp', 'maxhp', 'sp', 'maxsp', 'str', 'dex', 'agi', 'int', 'atk',
'pdef', 'mdef', 'eva']
case self.class.to_s
when "Game_Actor" then attrs += $game_battlelog.actor_attributes
when "Game_Enemy" then attrs += $game_battlelog.enemy_attributes
end
return attrs
end
#-----------------------------------------------------------------------------
# * Restore Attributes
#-----------------------------------------------------------------------------
def restore_attributes(attributes = [])
attributes = get_logged_attributes if attributes.empty?
attributes.each do |attr|
eval "self.#{attr} = battlelog.#{attr}"
end
end
#-----------------------------------------------------------------------------
# * Log Attributes
#-----------------------------------------------------------------------------
def memorize_attributes(attributes = [])
attributes = get_logged_attributes if attributes.empty?
attributes.each do |attr|
eval "battlelog.#{attr} = self.#{attr}"
end
end
#-----------------------------------------------------------------------------
# * Log Used Skill
#-----------------------------------------------------------------------------
def log_skill(skill)
battlelog.logged_skills[skill.id] += 1
end
#-----------------------------------------------------------------------------
# * Hit Count
#-----------------------------------------------------------------------------
def hit_count
return battlelog.hit_count
end
#-----------------------------------------------------------------------------
# * Miss Count
#-----------------------------------------------------------------------------
def miss_count
return battlelog.miss_count
end
#-----------------------------------------------------------------------------
# * Healed Count
#-----------------------------------------------------------------------------
def healed_count
return battlelog.healed_count
end
#-----------------------------------------------------------------------------
# * Raised Count
#-----------------------------------------------------------------------------
def raised_count
return battlelog.raised_count
end
#-----------------------------------------------------------------------------
# * Killed Count
#-----------------------------------------------------------------------------
def killed_count
return battlelog.killed_count
end
#-----------------------------------------------------------------------------
# * Healed Count By ? (battler)
#-----------------------------------------------------------------------------
def healed_count_by?(battler)
return healed_count_by_actor?(battler.id) if battler.is_a?(Game_Actor)
return healed_count_by_enemy?(battler.id) if battler.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Raised Count By ? (battler)
#-----------------------------------------------------------------------------
def raised_count_by?(battler)
return raised_count_by_actor?(battler.id) if battler.is_a?(Game_Actor)
return raised_count_by_enemy?(battler.id) if battler.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Killed Count By ? (battler)
#-----------------------------------------------------------------------------
def killed_count_by?(battler)
return killed_count_by_actor?(battler.id) if battler.is_a?(Game_Actor)
return killed_count_by_enemy?(battler.id) if battler.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Healed Count : By Actor ? (id)
#-----------------------------------------------------------------------------
def healed_count_by_actor?(i)
return $game_battlelog.actor[i].actor_healed_log(id) if self.is_a?(Game_Actor)
return $game_battlelog.actor[i].enemy_healed_log(id) if self.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Raised Count : By Actor ? (id)
#-----------------------------------------------------------------------------
def raised_count_by_actor?(i)
return $game_battlelog.actor[i].actor_raised_log(id) if self.is_a?(Game_Actor)
return $game_battlelog.actor[i].enemy_raised_log(id) if self.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Killed Count : By Actor ? (id)
#-----------------------------------------------------------------------------
def killed_count_by_actor?(i)
return $game_battlelog.actor[i].actor_killed_log(id) if self.is_a?(Game_Actor)
return $game_battlelog.actor[i].enemy_killed_log(id) if self.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Healed Count : By Enemy ? (id)
#-----------------------------------------------------------------------------
def healed_count_by_enemy?(i)
return $game_battlelog.enemy[i].actor_healed_log(id) if self.is_a?(Game_Actor)
return $game_battlelog.enemy[i].enemy_healed_log(id) if self.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Raised Count : By Enemy ? (id)
#-----------------------------------------------------------------------------
def raised_count_by_enemy?(i)
return $game_battlelog.enemy[i].actor_raised_log(id) if self.is_a?(Game_Actor)
return $game_battlelog.enemy[i].enemy_raised_log(id) if self.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Killed Count : By Enemy ? (id)
#-----------------------------------------------------------------------------
def killed_count_by_enemy?(i)
return $game_battlelog.enemy[i].actor_killed_log(id) if self.is_a?(Game_Actor)
return $game_battlelog.enemy[i].enemy_killed_log(id) if self.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Actor Healed Log
#-----------------------------------------------------------------------------
def actor_healed_log
return battlelog.actor_healed_log
end
#-----------------------------------------------------------------------------
# * Actor Raised Log
#-----------------------------------------------------------------------------
def actor_raised_log
return battlelog.actor_raised_log
end
#-----------------------------------------------------------------------------
# * Actor Killed Log
#-----------------------------------------------------------------------------
def actor_killed_log
return battlelog.actor_killed_log
end
#-----------------------------------------------------------------------------
# * Enemy Healed Log
#-----------------------------------------------------------------------------
def enemy_healed_log
return battlelog.enemy_healed_log
end
#-----------------------------------------------------------------------------
# * Enemy Raised Log
#-----------------------------------------------------------------------------
def enemy_raised_log
return battlelog.enemy_raised_log
end
#-----------------------------------------------------------------------------
# * Enemy Killed Log
#-----------------------------------------------------------------------------
def enemy_killed_log
return battlelog.enemy_killed_log
end
#-----------------------------------------------------------------------------
# * Log Healed
#-----------------------------------------------------------------------------
def log_healed_by(battler)
battlelog.healed_count += 1
battler.log_healed_actor(battler.id) if self.is_a?(Game_Actor)
battler.log_healed_enemy(battler.id) if self.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Log Raised
#-----------------------------------------------------------------------------
def log_raised_by(battler)
battlelog.raised_count += 1
battler.log_raised_actor(battler.id) if self.is_a?(Game_Actor)
battler.log_raised_enemy(battler.id) if self.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Log Killed
#-----------------------------------------------------------------------------
def log_killed_by(battler)
battlelog.killed_count += 1
battler.log_killed_actor(battler.id) if self.is_a?(Game_Actor)
battler.log_killed_enemy(battler.id) if self.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Log Healed Actor
#-----------------------------------------------------------------------------
def log_healed_actor(i)
battlelog.actor_healed_log[i] += 1
end
#-----------------------------------------------------------------------------
# * Log Raised Actor
#-----------------------------------------------------------------------------
def log_raised_actor(i)
battlelog.actor_raised_log[i] += 1
end
#-----------------------------------------------------------------------------
# * Log Killed Actor
#-----------------------------------------------------------------------------
def log_killed_actor(i)
battlelog.actor_killed_log[i] += 1
end
#-----------------------------------------------------------------------------
# * Log Healed Enemy
#-----------------------------------------------------------------------------
def log_healed_enemy(i)
battlelog.enemy_healed_log[i] += 1
end
#-----------------------------------------------------------------------------
# * Log Raised Enemy
#-----------------------------------------------------------------------------
def log_raised_enemy(i)
battlelog.enemy_raised_log[i] += 1
end
#-----------------------------------------------------------------------------
# * Log Killed Enemy
#-----------------------------------------------------------------------------
def log_killed_enemy(i)
battlelog.enemy_killed_log[i] += 1
end
#-----------------------------------------------------------------------------
# * Print BattleLog Statistics
#-----------------------------------------------------------------------------
def print_battlelog_stats(actor = 0, enemy = 0)
a = Array.new
a << "Healed Count : #{healed_count}"
a << "Raised Count : #{raised_count}"
a << "Killed Count : #{killed_count}"
a << "Actor Healed Log"
a << actor_healed_log
a << "Actor Raised Log"
a << actor_raised_log
a << "Actor Killed Log"
a << actor_killed_log
a << "Enemy Healed Log"
a << enemy_healed_log
a << "Enemy Raised Log"
a << enemy_raised_log
a << "Enemy Killed Log"
a << enemy_killed_log
if actor > 0
a << "Times Healed By #{$game_actors[actor].name} ?"
a << healed_count_by_actor?(actor)
a << "Times Raised By #{$game_actors[actor].name} ?"
a << raised_count_by_actor?(actor)
a << "Times Killed By #{$game_actors[actor].name} ?"
a << killed_count_by_actor?(actor)
end
if enemy > 0
a << "Times Healed By #{$data_enemies[enemy].name} ?"
a << healed_count_by_enemy?(enemy)
a << "Times Raised By #{$data_enemies[enemy].name} ?"
a << raised_count_by_enemy?(enemy)
a << "Times Killed By #{$data_enemies[enemy].name} ?"
a << killed_count_by_enemy?(enemy)
end
p *a
end
end
#===============================================================================
# ** Game_Enemy
#===============================================================================
class Game_Enemy < Game_Battler
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battlelog_gmenemy_escape, :escape
#-----------------------------------------------------------------------------
# * Escape
#-----------------------------------------------------------------------------
def escape
battlelog.escape_count += 1
battlelog_gmenemy_escape
end
end
#===============================================================================
# ** Scene_Battle
#===============================================================================
class Scene_Battle < SDK::Scene_Base
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battlelog_scnbattle_maintroopdata, :main_troopdata
alias_method :battlelog_scnbattle_battleend, :battle_end
#-----------------------------------------------------------------------------
# * Main Troop Data
#-----------------------------------------------------------------------------
def main_troopdata
battlelog_scnbattle_maintroopdata
unit = ($game_troop.enemies + $game_party.actors)
unit.each do |member|
member.memorize_attributes
member.battlelog.encounter_count += 1
member.battlelog.logged_mapids[$game_map.map_id] += 1
member.battlelog.battleback = $game_temp.battleback_name
end
end
#-----------------------------------------------------------------------------
# * Battle End (0:win 1:lose 2:escape)
#-----------------------------------------------------------------------------
def battle_end(result)
case result
when 0; $game_party.actors.each {|actor| actor.battlelog.victor_count += 1}
when 1; $game_party.actors.each {|actor| actor.battlelog.escape_count += 1}
when 2; $game_party.actors.each {|actor| actor.battlelog.defeat_count += 1}
end
battlelog_scnbattle_battleend(result)
end
end
#===============================================================================
# ** Scene_Title
#===============================================================================
class Scene_Title < SDK::Scene_Base
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battlelog_scnttl_commandnewgamedata,:commandnewgame_gamedata
#-----------------------------------------------------------------------------
# * Command New Game : Data
#-----------------------------------------------------------------------------
def commandnewgame_gamedata
battlelog_scnttl_commandnewgamedata
$game_battlelog = Game_BattleLogs.new
end
end
#===============================================================================
# ** Scene_Save
#===============================================================================
class Scene_Save < Scene_File
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battlelog_scnsave_writedata, :write_save_data
#-----------------------------------------------------------------------------
# * Write Data
#-----------------------------------------------------------------------------
def write_save_data(file)
battlelog_scnsave_writedata(file)
Marshal.dump($game_battlelog, file)
end
end
#===============================================================================
# ** Scene_Load
#===============================================================================
class Scene_Load < Scene_File
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battlelog_scnload_readdata, :read_save_data
#-----------------------------------------------------------------------------
# * Write Data
#-----------------------------------------------------------------------------
def read_save_data(file)
battlelog_scnload_readdata(file)
$game_battlelog = Marshal.load(file)
end
end
#-------------------------------------------------------------------------------
# * SDK Enabled Test : End
#-------------------------------------------------------------------------------
end
Instructions
Place below 'SDK' and above 'main'. Anything that utilizes the Battle Log system should, in theory, work above or below the script but if you encounter any problems paste this script above systems that use it.
FAQ
Coming Soon...
Compatibility
Game_Battler.attack_effect
Game_Battler.attack_effect_second_hit_result (SDK)
Game_Battler.attack_effect_damage (SDK)
Game_Battler.attack_effect_miss (SDK)
Game_Battler.skill_effect
Game_Battler.skill_effect_damage (SDK)
Game_Battler.skill_effect_miss (SDK)
Game_Battler.add_state
Scene_Battle.main_troopdata (SDK)
Scene_Title.command_new_game
Scene_Save.write_save_data
Scene_Load.read_save_data
Game_Battler.attack_effect_second_hit_result (SDK)
Game_Battler.attack_effect_damage (SDK)
Game_Battler.attack_effect_miss (SDK)
Game_Battler.skill_effect
Game_Battler.skill_effect_damage (SDK)
Game_Battler.skill_effect_miss (SDK)
Game_Battler.add_state
Scene_Battle.main_troopdata (SDK)
Scene_Title.command_new_game
Scene_Save.write_save_data
Scene_Load.read_save_data
Author's Notes
Feel free to post ideas for what you could use this for, I might post a couple myself so people can get a better feel of what you'd use this system for. I might make a demo with instructions later, but until then its easy to look through the script and figure out what it does, and the syntax used to refer to certain logs.
If there is anything that you think I might've forgotten to log (I already know I forgot to log item usage, I'll put that in there in a little bit), then please tell me. If you have any major issues related to another script, or you're looking for a non-SDK or VX conversion, please handle that in a seperate topic in Script Support. You can feel free to post a link to the topic here, or via PM and I'll definately try to help you out the best I can!
Lastly, anything neat you happen to do with this, I'd love to check it out!
Terms and Conditions
Free to use in 'commercial' and 'non-commercial' games, so long as you credit me for creation of the basic battle logger.