Created
May 27, 2022 13:57
-
-
Save nijikokun/d01637caecce6ccb16afcce071f22732 to your computer and use it in GitHub Desktop.
How to extend the RPG Maker MZ DataManager to store custom stuff for your plugin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=========================================================================== | |
// Extend DataManager to persist specific changes | |
//=========================================================================== | |
const RMMZ_DataManager_makeSaveContents = DataManager.makeSaveContents; | |
const RMMZ_DataManager_extractSaveContents = DataManager.extractSaveContents; | |
const RMMZ_DataManager_onLoad = DataManager.onLoad; | |
DataManager.makeSaveContents = function() { | |
const contents = RMMZ_DataManager_makeSaveContents.call(this); | |
contents._plugin_store = {}; | |
} | |
DataManager.extractSaveContents = function(contents) { | |
RMMZ_DataManager_extractSaveContents.call(this, contents); | |
pluginRoot.data = contents._plugin_store; | |
} | |
DataManager.onLoad = function () { | |
RMMZ_DataManager_onLoad.apply(this, arguments); | |
console.log(arguments); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment