Save $data

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,647
Reaction score
2,974
First Language
Tagalog
Primarily Uses
Save $data v1.00
by Adiktuzmiko
 
 
 
++ Intoduction ++
 
 
Normally, when you edit in-gamethe values of the $data items (like $data_actors,
$data_classes etc), those edits are lost after closing the game.
This is because the game doesn't save the $data objects into the file.
 
So, I created this script so that the game will include them in the save file. 
So now you can make in your game things like permanent upgrades to weapons 
without the need to create new weapons.
 
Also, take note that as per normal behavior of the game, edits to the
$data objects are kept if you don't close the game. Meaning if an edit
is done, and the player just chose to go back to title screen and starts
a new game, his new game will contain the edited data. So I also added
into this script the ability to reset the $data once the player goes to
the title screen. Of course, loading a file will load the saved $data objects
in that file
 
The scripts saves the following:
 
$data_actors
$data_classes
$data_items
$data_skills
$data_weapons
$data_armors
$data_enemies
$data_states
$data_troops
 
Script

]

#==============================================================================# #  Save $data - v1.00# -- Last Updated: 12/09/2013# -- Level: Easy# -- Requires: n/a# #==============================================================================#   ++ Intoduction ++#==============================================================================## Normally, when you edit in-gamethe values of the $data items (like $data_actors, # $data_classes etc), those edits are lost after closing the game.# This is because the game doesn't save the $data objects into the file.# # So, I created this script so that the game will include them in the save file. # So now you can make in your game things like permanent upgrades to weapons # without the need to create new weapons.## Also, take note that as per normal behavior of the game, edits to the# $data objects are kept if you don't close the game. Meaning if an edit# is done, and the player just chose to go back to title screen and starts# a new game, his new game will contain the edited data. So I also added# into this script the ability to reset the $data once the player goes to# the title screen. Of course, loading a file will load the saved $data objects# in that file## The scripts saves the following:## $data_actors# $data_classes# $data_items# $data_skills# $data_weapons# $data_armors# $data_enemies# $data_states# $data_troops##==============================================================================#   ++ How to use ++#==============================================================================# Just paste it into an empty script in your script editor (preferebly below all# other scripts or at least below any script that modifies Scene_Title)## Take note that you should start a new game or else it will probably throw# an error##==============================================================================#   ++ Terms and Conditions ++#==============================================================================## Read this: [URL="http://lescripts.wordpress.com/terms-and-conditions/%5B/url%5D#%23==============================================================================module"]http://lescripts.wordpress.com/terms-and-conditions/##==============================================================================module[/URL] DataManager    #--------------------------------------------------------------------------  # * Create Save Contents  #--------------------------------------------------------------------------  class <<self; alias make_save_contents_adik make_save_contents; end  def self.make_save_contents    contents = make_save_contents_adik    contents[:data_actors] = $data_actors    contents[:data_classes] = $data_classes    contents[:data_items] = $data_items    contents[:data_skills] = $data_skills    contents[:data_weapons] = $data_weapons    contents[:data_armors] = $data_armors    contents[:data_states] = $data_states    contents[:data_enemies] = $data_enemies    contents[:data_troops] = $data_troops    contents  end  #--------------------------------------------------------------------------  # * Extract Save Contents  #--------------------------------------------------------------------------  class <<self; alias extract_save_contents_adik extract_save_contents; end  def self.extract_save_contents(contents)    extract_save_contents_adik(contents)    $data_actors = contents[:data_actors]    $data_classes = contents[:data_classes]    $data_items = contents[:data_items]    $data_skills = contents[:data_skills]    $data_weapons = contents[:data_weapons]    $data_armors = contents[:data_armors]    $data_states = contents[:data_states]    $data_enemies = contents[:data_enemies]    $data_troops = contents[:data_troops]  endend class Scene_Title < Scene_Base  alias start_adik start  def start    DataManager.load_database    start_adik  endend
Author's notes:
 
Yeah I know it's really super simple... haha... anyway, only use this if you need to save those data (like if you want to implement some kind of upgrade system which changes the values of the database items), else it will just increase the size of your save files and has some kind of drawback stated below
Also, take note that this means that future edits on the database items included in this script won't affect save files made before the edit
 
Last edited by a moderator:

David Bergström

Death Arcana follower.
Veteran
Joined
Sep 7, 2013
Messages
148
Reaction score
6
First Language
English
Primarily Uses
SIlly question, but would this script give the ability to have (for example) an inventory that was persistent across all save files. As in, if I started a save, and found an item, could this script allow me to start yet another new game, and still have this item in the inventory?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,647
Reaction score
2,974
First Language
Tagalog
Primarily Uses
NOPE... the purpose of this script is to allow devs to make some things in their game that changes the values of the entries in the database while keeping them on that save file like upgrades and such (because the engine by default doesn't save those changes, which is actually a good thing unless you really need to change values in-game)... It's not for persistent data... 
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,072
First Language
English
What happens if I changed my database and then wanted to testplay the new changes from a save file?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,647
Reaction score
2,974
First Language
Tagalog
Primarily Uses
It won't affect the saved data, already placed that in the notes on the original post... This is more of a script that should be used once the game is almost final and only if you implement some kind of events or something that can change the database like upgrades... because as you said on some other thread, saving the database into the save file is not really a good idea...
 
Last edited by a moderator:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,648
Reaction score
5,294
First Language
Indonesian
Primarily Uses
RMVXA
Someone wants to get this fixed, so I fixed it
Code:
#==============================================================================
#
#  Save $data - v1.00
# -- Last Updated: 12/09/2013
# -- Level: Easy
# -- Requires: n/a
#
#==============================================================================
#   ++ Intoduction ++
#==============================================================================
#
# Normally, when you edit in-game values of the $data items (like $data_actors,
# $data_classes etc), those edits are lost after closing the game.
# This is because the game doesn't save the $data objects into the file.
#
# So, I created this script so that the game will include them in the save file.
# So now you can make in your game things like permanent upgrades to weapons
# without the need to create new weapons.
#
# Also, take note that as per normal behavior of the game, edits to the
# $data objects are kept if you don't close the game. Meaning if an edit
# is done, and the player just chose to go back to title screen and starts
# a new game, his new game will contain the edited data. So I also added
# into this script the ability to reset the $data once the player goes to
# the title screen. Of course, loading a file will load the saved $data objects
# in that file
#
# The scripts saves the following:
#
# $data_actors
# $data_classes
# $data_items
# $data_skills
# $data_weapons
# $data_armors
# $data_enemies
# $data_states
# $data_troops#
#==============================================================================
#   ++ How to use ++
#==============================================================================
# Just paste it into an empty script in your script editor (preferebly below all
# other scripts or at least below any script that modifies Scene_Title)
#
# Take note that you should start a new game or else it will probably throw
# an error
#
#==============================================================================
#   ++ Terms and Conditions ++
#==============================================================================
#
# Read this: http://lescripts.wordpress.com/terms-and-conditions
#==============================================================================
module DataManager   
  #-------------------------------------------------------------------------- 
  # * Create Save Contents 
  #-------------------------------------------------------------------------- 
  class <<self; alias make_save_contents_adik make_save_contents; end 
  def self.make_save_contents   
    contents = make_save_contents_adik   
    contents[:data_actors] = $data_actors   
    contents[:data_classes] = $data_classes   
    contents[:data_items] = $data_items   
    contents[:data_skills] = $data_skills   
    contents[:data_weapons] = $data_weapons   
    contents[:data_armors] = $data_armors   
    contents[:data_states] = $data_states   
    contents[:data_enemies] = $data_enemies   
    contents[:data_troops] = $data_troops   
    contents 
  end 
  #-------------------------------------------------------------------------- 
  # * Extract Save Contents 
  #-------------------------------------------------------------------------- 
  class <<self; alias extract_save_contents_adik extract_save_contents; end 
  def self.extract_save_contents(contents)   
    extract_save_contents_adik(contents)   
    $data_actors = contents[:data_actors]   
    $data_classes = contents[:data_classes]   
    $data_items = contents[:data_items]   
    $data_skills = contents[:data_skills]   
    $data_weapons = contents[:data_weapons]   
    $data_armors = contents[:data_armors]   
    $data_states = contents[:data_states]   
    $data_enemies = contents[:data_enemies]   
    $data_troops = contents[:data_troops] 
  end
end
class Scene_Title < Scene_Base 
  alias start_adik start 
  def start   
    DataManager.load_database   
    start_adik 
  end
end
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Made Custom ENEMY Information Screen
I'm having such a hard time thinking of an interesting battle system. and not being a coder, certain things I wanna do seem a lot harder lol.
Created a character outline with some code. I have no use for this. I'm....bored.....
Having lots of fun using different PS brushes to add a lil' texture to the floors and walls in my maps.

Forum statistics

Threads
93,721
Messages
914,912
Members
123,324
Latest member
ahmbor
Top