YEP.160 – Event Timer Control – RPG Maker MV

Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here.

You can grab the plugin here:
English Dropbox
English Mirror

Support Team Yanfly on Patreon

The event timer is often used for countdown purposes. However, sometimes you would like to have a bit more control over it, such as being able to pause and resume the timer, increase or decrease the seconds, minutes, or even hours on the timer. Don’t want a countdown timer? Why not have it count upwards instead? Experienced Lunatic Mode coders will be able to add in their own plugin commands, too!


Introduction


The event timer is often used for countdown purposes. However, sometimes you would like to have a bit more control over it, such as being able to pause and resume the timer, increase or decrease the seconds, minutes, or even hours on the timer. Don’t want a countdown timer? Why not have it count upwards instead? Experienced Lunatic Mode coders will be able to add in their own plugin commands, too!

Notable Changes Made:
– Ability to separate timer sprite from the spriteset
– Timer is now capable of displaying hours
– Pause/resume functions for timer
– Increasing/decreasing seconds from timer
– Counting up instead of just count down


Plugin Commands


Use the following plugin commands to make use of the new features added by

this plugin to control the event timer.

Plugin Commands:

— PAUSE/RESUME —

EventTimer Pause
– Pauses the event timer.

EventTimer Resume
– Resumes the event timer if it has been paused.

— COUNT DOWN/UP —

EventTimer Countdown
– Changes the direction of the event timer to decrease and count down towards 0 seconds.

EventTimer Count Up
– Changes the direction of the event timer to increase and count upwards endlessly until manually stopped

EventTimer Count Toggle
– Switches the current direction of the event timer to either increase or decrease each second it is active.

— INCREASE/DECREASE —

EventTimer Increase x Frames
EventTimer Decrease x Frames
– Replace ‘x’ with a number value to determine how many frames to increase or decrease the event timer by.

EventTimer Increase x Seconds
EventTimer Decrease x Seconds
– Replace ‘x’ with a number value to determine how many seconds to increase or decrease the event timer by.

EventTimer Increase x Minutes
EventTimer Decrease x Minutes
– Replace ‘x’ with a number value to determine how many minutes to increase or decrease the event timer by.

EventTimer Increase x Hours
EventTimer Decrease x Hours
– Replace ‘x’ with a number value to determine how many hours to increase or decrease the event timer by.

You can also combine them together as such:

EventTimer Increase x Hours, y Seconds
EventTimer Increase x Hours, y Minutes
EventTimer Increase x Minutes, y Seconds
EventTimer Increase x Hours, y Minutes, z Seconds


Lunatic Mode – Effect Code


For experienced users that know JavaScript and have RPG Maker MV 1.5.0+, you

can add new plugin commands for this plugin or alter the code of currently
existing plugin commands from the plugin parameters entry: Effect Code.
It should look something like this:

// ------------
// Pause/Resume
// ------------
if (data.match(/PAUSE/i)) {
  $gameTimer.pause();

} else if (data.match(/RESUME/i)) {
  $gameTimer.resume();

...

// --------------------------------
// Add new commands above this data
// --------------------------------
} else {
  // Do nothing
}

The ‘data’ variable refers to the rest of the Plugin Command after the ‘EventTimer’ keyword. For example:

EventTimer Increase 2 Hours, 30 Minutes, 15 Seconds

The ‘data’ would be ‘Increase 2 Hours, 30 Minutes, 15 Seconds’ and thus, the string ‘data’ is used when checking lines in the ‘Effect Code’ parameter.

If you need to revert the Effect Code back to its original state, delete the plugin from your plugin manager list and then add it again. The code will be back to default.


Happy RPG Making!