Posts: 132
Threads: 11
Joined: Jun 2009
I'm currently beginning work on a significant collection of scripts, which adds significant functionality to an RM game- but also handles a large amount of new data that doesn't exist within the default scriptset of RPG Maker. Is there a best practice for adding new data- while retaining compatibility?
Basically, what I'm seeking to do is define a new set of data within the save file that handles another set of variables, and I don't want to conflict with existing scripts or access variables accessible in the RM GUI.
Posts: 11,236
Threads: 650
Joined: May 2009
Aliasing would be best, and I do have a method of sorts you may wish to look at:
Game Data Sneak. That may not work COMPLETELY with VXAce, due to its use of a new manager class for the data... but it is a start.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
Above are clickable links
Posts: 400
Threads: 13
Joined: Mar 2010
It depends on what you're asking? What you're talking about my instinct was handling "header" data for save files. In VXAce, instead of accessing the main body of saved data in actors, system, etc, it creates a set of data that's used for showing in the save menu.
This is in the DataManager module for my own game, albeit slimmed down:
PHP Code:
<?php
def self.make_save_header
header = {}
header[:characters] = $game_party.characters_for_savefile
header[:partysize] = $game_party.members.size
header[:playtime] = $game_system.playtime
header[:location] = $game_map.display_name
header[:day] = $game_variables[4]
header[:image] = $game_variables[5]
header
end
Through this, I can access particular information (like specific variables) in the save file display.
However, if you're asking specifically about just
saving that data, then I'm not sure what to suggest. I've honestly always just aliased related inits of certain Game_ classes, like System for general things. I've avoided creating whole new modules or classes because of how older RMs treated them in the past. As I recall, if you didn't save and load data in the same order in RMXP, it would cause problems. (Never mind data being
absent.)
Of course, checking the Game Data Sneak script/tutorial link, that could be a method around it. It performs the aliasing of Game_ classes without bogging them down. As for the save/load for RMVXA, I suspect it avoids the issues RMXP has: make_save_contents and extract_save_contents in DataManager look a lot more efficient than RMXP's method.
PHP Code:
<?php
def self.make_save_contents
contents = {}
contents[:system] = $game_system
[...]
def self.extract_save_contents(contents)
$game_system = contents[:system]
[...]