Skip to content

Instantly share code, notes, and snippets.

@GMMan
Created February 21, 2018 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GMMan/e1f334c5b7910debfc813efecfd73227 to your computer and use it in GitHub Desktop.
Save GMMan/e1f334c5b7910debfc813efecfd73227 to your computer and use it in GitHub Desktop.
//=============================================================================
// 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