Variable Rates – MV Plugin

      1 Comment on Variable Rates – MV Plugin

Adds the ability to increase/decrease a Game Variable(s) by a specified amount every specified amount of frames.

Each increase/decrease is separated into “Rates”. Each Rate has its own Variables that is affects, its own speed, and its own conditions, each of which are completely customizable.


Look at the code or download the Plugin:


Here is the Help file:

==========================================================================
What does this Plugin do?
==========================================================================
This Plugin allows you to make certain Variables get increased or decreased
by a certain amount every certain of frames in the background of your
game. This is similar to a Parallel Process that adds or subtracts a number
from a Variable.

However! Using this Plugin, you can set certain conditions, enable and
disable rates, and set a Variable to be increased every certain amount
of frames instead of being increased every frame.

==========================================================================
How does this Plugin work?
==========================================================================
Everything is separated into things known as “Rates”.

A Rate contains 3 things:
– the Variables it affects
– the Speed in which the Variables are increased by
– the JavaScript condition to determine when the Rate is active

When a Rate is activated, it will begin to increase (or decrease) the
specified Variables stored within it at the determined Speed in the
background of the game, similar to a Parallel Process.

==========================================================================
When are Rates active?
==========================================================================
There are three conditions a Rate must meet in order to run:
– the Rate must be enabled (activated)
– the Rate’s JavaScript condition must be true
– this Plugin’s Global condition must be true

We’ll get into conditions and enabling (activating) later.

Besides all of this, Rates will only be active when the Player is on the
Map, or in a Battle.

If the Player is on the Title Screen, in their Menu, selecting a move
in the Battle, or on the Game Over Screen, Rates will not be running.

==========================================================================
Rate ## Variables
==========================================================================
These Parameters allow you to set the Variables that will be affected
by the Rate.

You may simply put one Variable ID, or you may put in multiple.
If you put in multiple, separate them with commas.

Here are some examples:

3

1, 2, 6

3, 8, 5, 9, 10, 34

==========================================================================
Rate ## Speed
==========================================================================
These Parameters allow you to set the Speed in which the Variables
are increased.

You must input both the amount that the Variables are increased/decreased
by, and how often this occurs using this formula:

x per y frames

x = amount that is added to the Variables
y = the frequency of frames in which this occurs

For example, “1 per 60 frames” would increase the Variables by 1
every 60 frames (1 second).

Here are some more examples:

2 per 120 frames

-5 per 10 frames

10 per 500 frames

1 per 3600 frames

You may also use JavaScript to substitute for the numbers:

Math.pow(3, 2) per 60 frames

Math.randomInt(10) per 120 frames

100 per $gameVariables.value(2) frames

==========================================================================
Rate ## Condition
==========================================================================
Even when a Rate is activated, it will still need to have its Condition
be true.

These Conditions use JavaScript, but a couple variables have been created
in order to make your life easier:

v – Game Variables
s – Game Switches
actor – Game Actors
member – Party Members

Those variables are all arrays, so you use [square brackets] to reference
a certain value from them.

For example:

v[1] == 10
If this was the Condition of Rate 1, then Rate 1 will only be active when
Variable ID 1 is equal to 10.

s[1] == true
If this was the Condition of Rate 1, then Rate 1 will only be active when
Switch ID 1 is ON.

actor[1].level > 50
If this was the Condition of Rate 1, then Rate 1 will only be active when
Actor ID 1’s level is greater than 50.

member[0].hp < 100
If this was the Condition of Rate 1, then Rate 1 will only be active when
the Actor in the first slot of the Party has HP that is less than 100.

member[1].hasWeapon($dataWeapons[5])
If this was the Condition of Rate 1, then Rate 1 will only be active when
the Actor in the second slot of the Party has Weapon ID 5 equipped.

member[member.length – 1].isStateAdded(3)
If this was the Condition of Rate 1, then Rate 1 will only be active when
the Actor in the last slot of the Party has State 3 inflicted.
(If there is only 1 member, this will refer to that member.
If there are 2 members, this will refer to the second one, etc…)

Besides all of that, other JavaScript conditions can be used.
Here are some random examples:

$gamePlayer.isDashing()
Will only be active when the Player is dashing/running.

$gamePlayer.canMove()
Will only be active when the Player can move.

$gameMap.isEventRunning() == false
Will only be active when there are no autorun events occuring.

$gameMessage.isBusy() == false
Will only be active when there are no “Show Message” type events running.

$gamePlayer.isInVehicle()
Will only be active when the Player is in a Vehicle

==========================================================================
Rate ## Enabled?
==========================================================================
Setting this to “true” will just activate the Rate straight from the
beginning of the game.

You may want to do this if you wish the Rate to be active at the start
of the game, or if you wish to purely use conditions in order to control
the Rate.

If you set this to “false”, then you’ll need to use Plugin Commands to
manually activate (enable) the Rate.

Plugin Commands:

– VariableRate # Enable
Enables Rate #
Example: VariableRate 1 Enable
(Enables Rate 1)

– VariableRate # Disable
Disables Rate #
Example: VariableRate 5 Disable
(Disables Rate 5)

– VariableRate # Toggle
Changes the current state of Rate # to the opposite of its current state.
Example: VariableRate 2 Toggle
(If Rate 2 is disabled, it will be enabled;
If Rate 2 is enabled, it will be disabled.)

1 thought on “Variable Rates – MV Plugin

Leave a Reply

Your email address will not be published. Required fields are marked *