Tile Animation Rate
by caethyril
by caethyril
Update! :kaojoy:
I now have one big thread for all my plugins, including an enhanced version of this one:
https://forums.rpgmakerweb.com/index.php?threads/caethyrils-plugins.106255/
Features :kaohi:
This is a small plugin that will allow you to adjust how frequently animated map tiles update. It also provides the ability to add an on/off option to the in-game Options window, for slower systems (e.g. mobile) on which animated tiles may cause lag.
How to Use :kaopride:
Download the attached .js file and place it in your project's folder, under js/plugins. Then open RMMV, go to Tools > Plugin Manager, double-click an empty line to add a new plugin, and select this plugin from the drop-down list. To edit the values of any of the parameters displayed to the right of the drop-down, double-click them in the list.
Troubleshooting :kaoback:
If you experience problems with this plugin that you want to report, please post here and include the following:
- Instructions stating how to reproduce the problem in a new project.
(If I can't reproduce the problem, I probably can't help you.) - A screenshot of the console when the unexpected behaviour occurs.
(You can open the console by pressing F8 during test-play.)
Terms of Use :kaothx:
Free to use, repost, and/or modify, for commercial or non-commercial projects.
Credit to Caethyril is appreciated but not required.
Full Code (Cae_TileAnimRate.js) :kaoswt2:
Spoiler
Code:
//=============================================================================
// Cae_TileAnimRate.js
//=============================================================================
/*:
* @plugindesc v1.1 - Lets you specify the rate at which animated map tiles cycle their animation. Can also add an on/off switch to the in-game options.
* @author Caethyril
*
* @help Plugin Commands:
* None.
*
* Compatibility:
* Aliases update method of the Tilemap class,
* and addGeneralOptions method of Window_Options.
* Defines new Boolean property tileAnimRate on the ConfigManager.
*
* Terms of use:
* Free to use and modify.
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Update log:
* 1.1: Added on/off switch to the in-game options.
* 1.0: Initial release.
*
* @param Tile Animation Rate
* @text Tile Animation Rate
* @type number
* @min 0
* @max 60
* @desc Tile animation rate in frames per second.
* Default: 2
* @default 2
*
* @param Options Label
* @text Options Label
* @type text
* @desc Text shown for this setting in the in-game options.
* Leave blank to not add the option.
* @default
*/
var Imported = Imported || {}; // Import namespace, var can redefine
Imported.Cae_TileAnimRate = 1.1; // Import declaration
var CAE = CAE || {}; // Author namespace, var can redefine
CAE.TileAnimRate = CAE.TileAnimRate || {}; // Plugin namespace
(function (_) {
'use strict';
_.params = PluginManager.parameters('Cae_TileAnimRate'); // Process user parameters
_.rate = Number(_.params['Tile Animation Rate']) || 2;
_.label = String(_.params['Options Label']) || '';
_.active = true; // Default option value
// Adjust animationCount prior to the standard +1 per call
_.Tilemap_update = Tilemap.prototype.update; // Alias
Tilemap.prototype.update = function() {
if (_.active) this.animationCount += _.rate / 2; // animationCount cuts off at 30 so divide by 2 here
this.animationCount -= 1; // Cancel out +1 from default code
_.Tilemap_update.call(this); // Callback
};
// Add option to ConfigManager
Object.defineProperty(ConfigManager, 'tileAnimRate', {
get: function() { return _.active; },
set: function(value) { _.active = value; },
configurable: true });
// Adds option to Window_Options
_.Window_Options_addGeneralOptions = Window_Options.prototype.addGeneralOptions;
Window_Options.prototype.addGeneralOptions = function() {
_.Window_Options_addGeneralOptions.call(this);
if (_.label !== '') this.addCommand(_.label, 'tileAnimRate');
};
})(CAE.TileAnimRate);More by the same Author :kaoslp:
I have a variety of other (mostly small utility) plugins on my Google Drive here:
https://drive.google.com/drive/folders/0B47clJwJZOS0U2xrbGF0YUpoeEE