RMMZ Help Understanding how to save custom data in rmmz

ougitou1

Invisible Black
Veteran
Joined
Dec 9, 2015
Messages
128
Reaction score
12
First Language
en-
Primarily Uses
N/A
Hello all, I've been faced with a dilemma as of late, and have tried many methods in an attempt to get this to work.
1. I've tried creating a custom json file to handle the data its seems to work but there are many things I don't understand so this method seems to bring me to an impasse.
2. I've also attempted modifying existing saved variables to store the data needed in simplified forms. I've been met with the same problem as the first attempt.

lastly after a little while of searching I found this made by @Poryg and modified albeit slightly then tried implementing it.


var old_CGO = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
old_CGO.call(this);

$myObject_SaveInfo = new My_Object();

};

var old_MSC = DataManager.makeSaveContents;
DataManager.makeSaveContents = function() {
var contents = old_MSC.call(this);

contents.myObject_SaveInfo = $myObject_SaveInfo;
return contents;

};

var old_ESC = DataManager.extractSaveContents;
DataManager.extractSaveContents = function(contents){
old_ESC.call(this, contents);

if (contents.myObject_SaveInfo) {$myObject_SaveInfo = contents.myObject_SaveInfo;}

};

needless to say it still isn't working I've found out that the code needs an additional part maybe even two, as I understand it the function/methods needed are already available if only I knew where to look I could copy and modify them.

conclusion. I lack the knowledge necessary to make the modifications and as there are no documentation assistance is necessary.

any info on how to save data int, Boolean, string, arrays multidimensional arrays, objects even if only an int I can work with that. Many thanks in advance.
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
972
Reaction score
566
First Language
Poland
Primarily Uses
RMMV
I had similar problem, but in MV, hopefully this will help you

 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,822
Reaction score
1,247
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi, there friend!

The easy way is that you just save your data in a game object that is already on the save file.
Ex:

Code:
Game_System.prototype.yourData = function(){
         this._myData = // whathever you want.
}
Then you can call it with $gameSystem._myData
The other way around, is that you create your data just like MZ does:

Code:
// Create your content:
function Eli_SavedContents() {
    this.initialize.apply(this, arguments);
};
Eli_SavedContents.prototype.initialize = function(){
    this.contents = {};
};

// Put it into the save file
const _DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
    _DataManager_createGameObjects.call(this);
    $eliData = new Eli_SavedContents();
};
const _DataManager_makeSaveContents = DataManager.makeSaveContents;
DataManager.makeSaveContents = function() {
    const alias = _DataManager_makeSaveContents.call(this);
    alias.eli = $eliData;
    return alias;
};
const _DataManager_extractSaveContents = DataManager.extractSaveContents;
DataManager.extractSaveContents = function(contents) {
    _DataManager_extractSaveContents.call(this, contents);
    $eliData = contents.eli;
};
 

ougitou1

Invisible Black
Veteran
Joined
Dec 9, 2015
Messages
128
Reaction score
12
First Language
en-
Primarily Uses
N/A
I had similar problem, but in MV, hopefully this will help you

thank you ill review the document.
Hi, there friend!

The easy way is that you just save your data in a game object that is already on the save file.
Ex:

Code:
Game_System.prototype.yourData = function(){
         this._myData = // whathever you want.
}
Then you can call it with $gameSystem._myData
The other way around, is that you create your data just like MZ does:

Code:
// Create your content:
function Eli_SavedContents() {
    this.initialize.apply(this, arguments);
};
Eli_SavedContents.prototype.initialize = function(){
    this.contents = {};
};

// Put it into the save file
const _DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
    _DataManager_createGameObjects.call(this);
    $eliData = new Eli_SavedContents();
};
const _DataManager_makeSaveContents = DataManager.makeSaveContents;
DataManager.makeSaveContents = function() {
    const alias = _DataManager_makeSaveContents.call(this);
    alias.eli = $eliData;
    return alias;
};
const _DataManager_extractSaveContents = DataManager.extractSaveContents;
DataManager.extractSaveContents = function(contents) {
    _DataManager_extractSaveContents.call(this, contents);
    $eliData = contents.eli;
};
This seems efficient i think ill take advantage of this info. thank you for your assistance. ill contact you with results.
 

Latest Threads

Latest Profile Posts

The light has gone out of my life.

About time they finally press the kill switch button for older makers.
Sorry everyone, I am here sporadically. After 6 years of delays after delays in my life, I try to do all mat once and that means that I spread thin everywhere because it just is impossible to crunch 6 years in one or even two, but I try! I wish many of that I would already given you and put behind but... well...
I'm looking for an experienced gamer who has played a few games created with RPG Maker, who knows what an alpha build is, who may remember the old days when cliché was the favorite word on Creation Asylum, who, if a reviewer, would ask for my permission before making a review to post on YouTube, or whatever, since I will be messaging you a 10 minute, or so, DEMO based on an alpha build of Effervesce Fallacy™.
No matter how many times I listen to him, I know this is Joker speaking, but my brain can only hear Dagda.

Forum statistics

Threads
108,821
Messages
1,039,807
Members
141,279
Latest member
SawYuuki
Top