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
Spoiler]
#==============================================================================# # 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
本贴来自国际rpgmaker官方论坛作者:Engr. Adiktuzmiko处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/save-data.18013/