Kain Nobel
Member
Pfft I knew I did something stupid, it was logging just fine... except it was logging actors when I was supposed to have it log enemies, etc... so it appeared like it wasn't logging anything (I got Kill logs methodology mixed up with Raise/Heal log methodology).
Okay, I'm done wasting topics, this one is closed thank you for playing
Okay, I'm done wasting topics, this one is closed thank you for playing
Good day everybody!
I'm really in a hold up here, and I want to get this done before my next day off because I've got ALOT of scripts on my wish list that all require a BattleLogger, such as an Overdrive system (inspired by FFX's), my Ultimate Bestiary (WIP), and alot of my game's basic 'quest' events were going to use this BattleLogger system as well, so... yeah, I hope somebody can help me with this.
Okay, I edited something earlier today, stepped away from my script to take a break, came back and ever since I've been fucking with it all night, it WON'T LOG ENEMIES
Here's how the script works, there's 2 new Game_ objects that come into play here, Game_BattleLog (these are created for every actor/enemy in the entire database), and Game_BattleLogger a/k/a "$game_battlelog" (a wrapper class, persay, which holds ALL actor/enemy battlelogs (since enemies are always disposed and re-initialized)). Throughout Game_Battler attack and skill_effect methods, it pitches the information between logging the attacker's killed battler hashes, then the target (self) logs times killed += 1
Perhaps I've gone senile over this, maybe you'll get different results, but it'll log the actor times killed shit just fine, enemies it doesn't log at all even though they share the same common methodology. Here, I've cut the script down from 1500+ lines dealing with EVERYTHING, to just 250-some lines dealing with anything involving killing somebody, please have a looksy and tell me where I went wrong I'm getting crosseyed x_X
I'm really in a hold up here, and I want to get this done before my next day off because I've got ALOT of scripts on my wish list that all require a BattleLogger, such as an Overdrive system (inspired by FFX's), my Ultimate Bestiary (WIP), and alot of my game's basic 'quest' events were going to use this BattleLogger system as well, so... yeah, I hope somebody can help me with this.
Okay, I edited something earlier today, stepped away from my script to take a break, came back and ever since I've been fucking with it all night, it WON'T LOG ENEMIES
Here's how the script works, there's 2 new Game_ objects that come into play here, Game_BattleLog (these are created for every actor/enemy in the entire database), and Game_BattleLogger a/k/a "$game_battlelog" (a wrapper class, persay, which holds ALL actor/enemy battlelogs (since enemies are always disposed and re-initialized)). Throughout Game_Battler attack and skill_effect methods, it pitches the information between logging the attacker's killed battler hashes, then the target (self) logs times killed += 1
Perhaps I've gone senile over this, maybe you'll get different results, but it'll log the actor times killed shit just fine, enemies it doesn't log at all even though they share the same common methodology. Here, I've cut the script down from 1500+ lines dealing with EVERYTHING, to just 250-some lines dealing with anything involving killing somebody, please have a looksy and tell me where I went wrong I'm getting crosseyed x_X
Code:
#===============================================================================
# ** Game_BattleLog
#-------------------------------------------------------------------------------
# This class is simply a data class that stores information for individual
# actors and enemies. Information on every battlelog is referenced within the
# Game_BattleLogger ($game_battlelog) class.
#===============================================================================
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 :times_escape
attr_accessor :times_defeat
attr_accessor :times_healed
attr_accessor :times_raised
attr_accessor :times_killed
attr_accessor :battle_bgm
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
@maxsp = 0
@hp = 0
@sp = 0
@atk = 0
@pdef = 0
@mdef = 0
@eva = 0
@str = 0
@dex = 0
@agi = 0
@int = 0
@hit_count = 0
@miss_count = 0
@critical_count = 0
@encounter_count = 0
@times_escape = 0
@times_defeat = 0
@times_healed = 0
@times_raised = 0
@times_killed = 0
@battle_bgm = RPG::AudioFile.new
@battleback = String.new
@logged_mapids = Hash.new
@logged_skills = Hash.new
@logged_states = Hash.new
@actor_healed_log = Hash.new
@actor_raised_log = Hash.new
@actor_killed_log = Hash.new
@enemy_healed_log = Hash.new
@enemy_raised_log = Hash.new
@enemy_killed_log = Hash.new
@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
end
#===============================================================================
# ** Game_BattleLogger
#-------------------------------------------------------------------------------
# This class holds all battle log information for all actors and enemies, its
# easily accessed via $game_battlelog.
#===============================================================================
class Game_BattleLogger
#-----------------------------------------------------------------------------
# * Customizable Constants
#-----------------------------------------------------------------------------
Actor_Attributes = []
Enemy_Attributes = []
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :actor_data
attr_accessor :enemy_data
#-----------------------------------------------------------------------------
# * 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[id]
#-----------------------------------------------------------------------------
def actor
return @actor_data
end
#-----------------------------------------------------------------------------
# * Enemy[id]
#-----------------------------------------------------------------------------
def enemy
return @enemy_data
end
end
#===============================================================================
# ** Game_Battler
#-------------------------------------------------------------------------------
# This class has been enhanced with a battle logger and a target logger.
#===============================================================================
class Game_Battler
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battlelog_gmbtlr_atkeff, :attack_effect
alias_method :battlelog_gmbtlr_skleff, :skill_effect
alias_method :battlelog_gmbtlr_atteffdamage,:attack_effect_damage
alias_method :battlelog_gmbtlr_skleffdamage,:skill_effect_damage
#-----------------------------------------------------------------------------
# * Attack Effect
#-----------------------------------------------------------------------------
def attack_effect(attacker)
@target_battler = attacker
battlelog_gmbtlr_atkeff(attacker)
end
#-----------------------------------------------------------------------------
# * Skill Effect
#-----------------------------------------------------------------------------
def skill_effect(user, skill)
@target_battler = user
battlelog_gmbtlr_skleff(user, skill)
end
#-----------------------------------------------------------------------------
# * Attack Effect : Damage
#-----------------------------------------------------------------------------
def attack_effect_damage
battlelog_gmbtlr_atteffdamage
if self.hp0?
self.log_killed_by(@target_battler)
end
end
#-----------------------------------------------------------------------------
# * Skill Effect : Damage
#-----------------------------------------------------------------------------
def skill_effect_damage
battlelog_gmbtlr_skleffdamage
if self.hp0?
self.log_killed_by(@target_battler)
end
end
#-----------------------------------------------------------------------------
# * Log Killed Actor
#-----------------------------------------------------------------------------
def log_killed_actor(actor)
$game_battlelog.actor[id].actor_killed_log[actor.id] += 1
end
#-----------------------------------------------------------------------------
# * Log Killed Enemy
#-----------------------------------------------------------------------------
def log_killed_enemy(enemy)
$game_battlelog.enemy[id].enemy_killed_log[enemy.id] += 1
end
#-----------------------------------------------------------------------------
# * Killed Count By ? (battler)
#-----------------------------------------------------------------------------
def times_killed_by?(battler)
return times_killed_by_actor?(battler.id) if battler.is_a?(Game_Actor)
return times_killed_by_enemy?(battler.id) if battler.is_a?(Game_Enemy)
end
#-----------------------------------------------------------------------------
# * Killed Count : By Actor (id)
#-----------------------------------------------------------------------------
def times_killed_by_actor?(actor)
return $game_battlelog.actor[actor.id].actor_killed_log[id]
end
#-----------------------------------------------------------------------------
# * Killed Count : By Enemy (id)
#-----------------------------------------------------------------------------
def times_killed_by_enemy?(enemy)
return $game_battlelog.enemy[enemy.id].enemy_killed_log[id]
end
end
#===============================================================================
# ** Game_Actor
#-------------------------------------------------------------------------------
# ...
#===============================================================================
class Game_Actor < Game_Battler
#-----------------------------------------------------------------------------
# * Killed Count
#-----------------------------------------------------------------------------
def times_killed
return $game_battlelog.actor[id].times_killed
end
#-----------------------------------------------------------------------------
# * Log Killed
#-----------------------------------------------------------------------------
def log_killed_by(battler)
battler.log_killed_actor(id)
$game_battlelog.actor[id].times_killed += 1
end
end
#===============================================================================
# ** Game_Enemy
#-------------------------------------------------------------------------------
# ...
#===============================================================================
class Game_Enemy < Game_Battler
#-----------------------------------------------------------------------------
# * Killed Count
#-----------------------------------------------------------------------------
def times_killed
return $game_battlelog.enemy[id].times_killed
end
#-----------------------------------------------------------------------------
# * Log Killed
#-----------------------------------------------------------------------------
def log_killed_by(battler)
battler.log_killed_enemy(id)
$game_battlelog.enemy[id].times_killed += 1
end
end
#===============================================================================
# ** Scene_Title
#-------------------------------------------------------------------------------
# This class has been modified to create a new $game_battlelog global.
#===============================================================================
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_BattleLogger.new
end
end
#===============================================================================
# ** Scene_Save
#-------------------------------------------------------------------------------
# This class has been modified to save the $game_battlelog global
#===============================================================================
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
#-------------------------------------------------------------------------------
# This class has been modified to load the $game_battlelog global
#===============================================================================
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