Created
January 1, 2015 17:51
-
-
Save HimeWorks/58c735738f17aca1cb46 to your computer and use it in GitHub Desktop.
Battle Data CarryOver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple proof-of-concept of how to save and load battle data across battles. | |
# Simply make script calls during battle. | |
class Game_Temp | |
attr_accessor :boss_data | |
end | |
class Data_BattleData | |
attr_accessor :hp | |
attr_accessor :mp | |
attr_accessor :states | |
def initialize | |
@hp = 0 | |
@mp = 0 | |
@states = [] | |
end | |
end | |
class Game_Battler | |
def save_battle_data | |
data = Data_BattleData.new | |
data.hp = self.hp | |
data.mp = self.mp | |
data.states = self.states | |
$game_temp.boss_data = data | |
end | |
def load_battle_data | |
data = $game_temp.boss_data | |
@hp = data.hp | |
@mp = data.mp | |
@states = data.states | |
end | |
end | |
# USAGE | |
# | |
# $game_troop.members[INDEX].save_battle_data | |
# $game_troop.members[INDEX].load_battle_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment