RPG Maker Forums

Hi people!
I'm trying to understand how can I store custom data inside this file.
The reason is that I want a global object to be saved for different save files.
Well, somehow, I managed to do that!
I change the global object in-game and call ConfigManager.save(), then my global object is saved across different save files.

BUT!
The problem is, I can't understand how I do it and why it's working. I've tried to replicate the same pattern that Rpg Maker Mv code does to save the bgmVolume. And somehow managed to work. But I can't really understand why =/

Here is what I have:
JavaScript:
ConfigManager.casa = {
    Stage0: null,
    Stage1: [],
    Stage2: [],
    Stage3: [],
    Stage4: [],
    Stage5: [],
    Stage6: []
}

Object.defineProperty(ConfigManager, 'casa', {
    get: function() {
        return casa;
    },
    set: function(value) {
        casa = value;
    },
    configurable: true
});

var _ConfigManager_makeData = ConfigManager.makeData;
ConfigManager.makeData = function() {
    let config = _ConfigManager_makeData.call(this);
    config.casa = this.casa;
    return config;
};

var _ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function(config) {
    _ConfigManager_applyData.call(this,config);
    this.casa = this.readCustom(config, 'casa');
};

ConfigManager.readCustom = function(config, name) {
    var value = config[name];
    if (value !== undefined) {
        return config[name];
    } else {
        return {   
            Stage0: null,
            Stage1: [],
            Stage2: [],
            Stage3: [],
            Stage4: [],
            Stage5: [],
            Stage6: []
        };
    }
};
So please, can you try to explain my code to me? :kaoswt2:

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,017
Messages
1,018,356
Members
137,802
Latest member
rencarbali
Top