Created
February 21, 2018 19:04
-
-
Save GMMan/e1f334c5b7910debfc813efecfd73227 to your computer and use it in GitHub Desktop.
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
//============================================================================= | |
// cy_SaveCount.js | |
//============================================================================= | |
/*: | |
* @plugindesc Tracks save count in a variable. | |
* @author cyanic | |
* | |
* @param variableId | |
* @text Variable ID | |
* @type variable | |
* @desc The ID of the variable to store save count in. | |
*/ | |
var Imported = Imported || {}; | |
(function(){ | |
var pluginName = "cy_SaveCount"; | |
Imported[pluginName] = 1; | |
// Load parameters | |
var sysParams = PluginManager.parameters(pluginName); | |
var pluginParams = { | |
"variableId": Number(sysParams["variableId"]) | |
}; | |
var _DataManager_makeSaveContents = DataManager.makeSaveContents; | |
DataManager.makeSaveContents = function() { | |
if (!isNaN(pluginParams.variableId)) { | |
var count = $gameVariables.value(pluginParams.variableId); | |
++count; | |
$gameVariables.setValue(pluginParams.variableId, count); | |
} | |
return _DataManager_makeSaveContents(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment