My apologies for the recent volume of posts, but I keep running into a roadblock every step of the way every script or so.
The following script is supposed to store damage in a variable, however, I cannot get it to store itself within the variable.
I've been trying to call Variable 1, specifically with @hp_damage_last, with even changing the line to
It still returns 0 when called, however. I've called it at end of turn and directly after taking damage (using "Show Text \V[1]" in a troop set) and nothing's changed. So, I feel like I'm missing something within this script.
If it means anything, the current actor I'm testing this on is the 2nd actor in the index, since that 2nd actor requires this script for their gimmick.
The following script is supposed to store damage in a variable, however, I cannot get it to store itself within the variable.
ActorDamageIDStart = 1class Game_Battler < Game_BattlerBase # Make these available to be read by anyone (and set too just in case) attr_accessor :hp_damage_last, :hp_damage_turn, :hp_damage_battle alias :initialize_remember_damage :initialize unless $@ def initialize(*args) initialize_remember_damage(*args) # Set our last damage taken arguments to zero @hp_damage_last = @hp_damage_turn = @hp_damage_battle = 0 end # When the battler takes damage remember that HP damage alias :execute_damage_remember_damage :execute_damage unless $@ def execute_damage(user) # Call the original method execute_damage_remember_damage(user) # We want to record damage only, not healing return if @result.hp_damage <= 0 # Remember this actor's last damage taken, override last value @hp_damage_last = @result.hp_damage # Add to the cumulative turn damage here @hp_damage_turn += @result.hp_damage # And add to the battle cumulative damage here @hp_damage_battle += @result.hp_damage endend class Game_Actor < Game_Battler alias :execute_damage_remember_damage_actor :execute_damage unless $@ def execute_damage(user) # Call the original method so hp damage is applied correctly execute_damage_remember_damage_actor(user) # We want to record damage only, not healing return if @result.hp_damage <= 0 # We want to remember the damage taken in variables too, do so here index = (@actor_id - 1) * 3 + ActorDamageIDStart # Remember this actor's last damage taken, override last value $game_variables[index + 0] = @hp_damage_last # Add to the cumulative turn damage here $game_variables[index + 1] = @hp_damage_turn # And add to the battle cumulative damage here $game_variables[index + 2] = @hp_damage_battle end endclass Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Battle Start #-------------------------------------------------------------------------- alias :battle_start_remember_damage :battle_start unless $@ def battle_start # Call the original method battle_start_remember_damage # And wipe everybody's battle-scope damage $game_party.members.each { |member| member.hp_damage_battle = 0 } $game_troop.members.each { |member| member.hp_damage_battle = 0 } end #-------------------------------------------------------------------------- # * Start Turn #-------------------------------------------------------------------------- alias :turn_start_remember_damage :turn_start unless $@ def turn_start # Call the original method turn_start_remember_damage # And wipe everybody's turn-scope damage $game_party.members.each { |member| member.hp_damage_turn = 0 } $game_troop.members.each { |member| member.hp_damage_turn = 0 } end endI've been trying to call Variable 1, specifically with @hp_damage_last, with even changing the line to
$game_variables[1] = @hp_damage_lastIt still returns 0 when called, however. I've called it at end of turn and directly after taking damage (using "Show Text \V[1]" in a troop set) and nothing's changed. So, I feel like I'm missing something within this script.
If it means anything, the current actor I'm testing this on is the 2nd actor in the index, since that 2nd actor requires this script for their gimmick.