YEP.136 – Item Requirements – 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 Mirror

Support Team Yanfly on Patreon

In RPG Maker MV, items only have a few restrictions on them by default, whether or not they can be used in or out of battle or never. There aren’t any other conditions that you can set that would otherwise determine if an item can or cannot be used. This plugin gives more ways to restrict item usage based on switches, variables, the actors using them, classes, state requirements, and more.


Introduction


Please wait while you are redirected...or Click Here if you do not want to wait.

This plugin requires YEP_ItemCore. Make sure this plugin is located under YEP_ItemCore in the plugin list.

In RPG Maker MV, items only have a few restrictions on them by default, whether or not they can be used in or out of battle or never. There aren’t any other conditions that you can set that would otherwise determine if an item can or cannot be used. This plugin gives more ways to restrict item usage based on switches, variables, the actors using them, classes, state requirements, and more.


Notetags


Use the following notetags to enforce requirements for items before they can be used.

Item Notetags:

<Enable Requirements>
condition
condition
</Enable Requirements>
– Replace ‘condition’ with the desired condition setup. You can insert any number of conditions inside the notetags. All of the conditions must be met before the item can be used. Look below for a list of the possible conditions that can be used.

Conditions:

Eval: code
– Replace ‘code’ with JavaScript code that you’d like to run a check against to enable the item. If the check returns false, the item will be disabled regardless of other conditions.

Examples:
Eval: $gameActors.actor(1).name() === ‘Harold’
Eval: $gameActors.leader().name() !== ‘Ralph’

Actor: x
Actor: x, x, x
– Requires actor(s) ID ‘x’ to use the item. If the actor isn’t the one using the said item, then the item is disabled and cannot be used regardless of other conditions.

Not Actor: x
Not Actor: x, x, x
– Requires the actor using the item to NOT be actor ID ‘x’. If the actor’s ID matches one of the listed ‘x’, then the item is disabled and cannot be used regardless of other conditions.

Examples:
Actor: 1
Actor: 2, 3, 4, 5, 6
Not Actor: 7
Not Actor: 8, 9, 10

Armor: x
Armor: x, x, x
– Requires the actor to specifically have armor ID ‘x’ equipped to use the item. If multiple ‘x’ are used, the actor can have any of them equipped. If the actor does not have armor ‘x’ equipped, then the item is disabled and cannot be used regardless of other conditions.

Not Armor: x
Not Armor: x, x, x
– Requires the actor to not have armor ID ‘x’ equipped to use the item. If multiple ‘x’ are used, the actor cannot have any of them equipped. If the actor does have armor ‘x’ equipped, then the item is disabled and cannot be used regardless of other conditions.

Examples:
Armor: 1
Armor: 2, 3, 4, 5, 6
Not Armor: 7
Not Armor: 8, 9, 10

Class: x
Class: x, x, x
– Requires class(es) ID ‘x’ to use the item. If the actor’s class doesn’t match the item requirement, then the item is disabled and cannot be used regardless of other conditions.

Not Class: x
Not Class: x, x, x
– Requires the actor using the item to NOT be class ID ‘x’. If the actor’s class ID matches one of the listed ‘x’, then the item is disabled and cannot be used regardless of other conditions.

Examples:
Class: 1
Class: 2, 3, 4, 5, 6
Not Class: 7
Not Class: 8, 9, 10

Subclass: x
Subclass: x, x, x
– Requires YEP_X_Subclass.js
– Requires subclass(es) ID ‘x’ to use the item. If the actor’s class doesn’t match the item requirement, then the item is disabled and cannot be used regardless of other conditions.

Not Subclass: x
Not Subclass: x, x, x
– Requires YEP_X_Subclass.js
– Requires the actor using the item to NOT be subclass ID ‘x’. If the actor’s subclass ID matches one of the listed ‘x’, then the item is disabled and cannot be used regardless of other conditions.

Examples:
Subclass: 1
Subclass: 2, 3, 4, 5, 6
Not Subclass: 7
Not Subclass: 8, 9, 10

Either Class: x
Either Class: x, x, x
– Requires YEP_X_Subclass.js
– The actor’s primary class or subclass ID has to match ‘x’. If at least one of them match, then the condition passes. Otherwise, the condition fails and the item is disabled and cannot be used regardless of other conditions.

Neither Class: x
Neither Class: x, x, x
– Requires YEP_X_Subclass.js
– Requires YEP_X_Subclass.js
– The actor’s primary class or subclass ID has to NOT match ‘x’. If at least one of them match, then the condition fails and the item is disabled and cannot be used regardless of other conditions.

Examples:
Either Class: 1
Either Class: 2, 3, 4, 5, 6
Neither Class: 7
Neither Class: 8, 9, 10

State: x
State: x, x, x
– Requires the actor using the item to be affected by state ‘x’. If multiple ‘x’ are used, the actor can be affected by any of them. If the actor is not affected by state ‘x’, then the condition fails and the item is disabled and cannot be used regardless of other conditions.

Not State: x
Not State: x, x, x
– Requires the actor using the item to be not affected by state ‘x’. If multiple ‘x’ are used, the actor cannot be affected by any of them. If the actor is not affected by state ‘x’, then the condition fails and the item is disabled and cannot be used regardless of other conditions.

Examples:
State: 10
State: 11, 12, 13, 14, 15
Not State: 16
Not Stage: 17, 18, 19, 20

Switch Off: x
Switch Off: x, x, x
– Requires switch(es) x to be OFF before the item can be used. If the switch is ON, then the item is disabled and cannot be used regardless of other conditions.

Examples:
Switch Off: 1
Switch Off: 2, 3, 4, 5, 6

Switch On: x
Switch On: x, x, x
– Requires switch(es) x to be ON before the item can be used. If the switch is OFF, then the item is disabled and cannot be used regardless of other conditions.

Examples:
Switch On: 1
Switch On: 2, 3, 4, 5, 6

Variable x eval
– Makes a check against variable x. Replace ‘x’ with an integer value and ‘eval’ with the code check you wish to run it against.

Examples:
Variable 1 >= 5
Variable 2 < 6
Variable 3 === 7
Variable 4 !== 8

Weapon: x
Weapon: x, x, x
– Requires the actor to specifically have weapon ID ‘x’ equipped to use the item. If multiple ‘x’ are used, the actor can have any of them equipped. If the actor does not have weapon ‘x’ equipped, then the item is disabled and cannot be used regardless of other conditions.

Not Weapon: x
Not Weapon: x, x, x
– Requires the actor to not have weapon ID ‘x’ equipped to use the item. If multiple ‘x’ are used, the actor cannot have any of them equipped. If the actor does have weapon ‘x’ equipped, then the item is disabled and cannot be used regardless of other conditions.

Examples:
Weapon: 1
Weapon: 2, 3, 4, 5, 6
Not Weapon: 7
Not Weapon: 8, 9, 10

Weapon Type: x
Weapon Type: x, x, x
– Requires the actor to have weapon type ‘x’ equipped. If multiple ‘x’ are used, the actor can have any of the ‘x’ weapon types equipped. If the actor does not have the matching weapon types, then the item is disabled and cannot be used regardless of other conditions.

Not Weapon Type: x
Not Weapon Type: x, x, x
– Requires the actor to not have weapon type ‘x’ equipped. If multiple ‘x’ are used, the actor cannot have any of the ‘x’ weapon types equipped. If the actor does have the matching weapon types, then the item is disabled and cannot be used regardless of other conditions.

Examples:
Weapon Type: 1
Weapon Type: 2, 3, 4, 5, 6
Not Weapon Type: 7
Not Weapon Type: 8, 9, 10


Lunatic Mode – Custom Enable Requirements


For those with JavaScript experience, you can create your own custom requirements for whether or not items can be used using the following notetag setup:

Item Notetags:

<Custom Enable Requirement>
condition = battler.level >= item.price;
</Custom Enable Requirement>
– The ‘condition’ variable will determine whether or not the item will be enabled/disabled. If the ‘condition’ variable returns true, then the item is enabled provided all other conditions (if any) are also met. Otherwise, the item is disabled and cannot be used. The ‘battler’ variable will refer to the battler using the item. The ‘item’ variable will refer to the item being checked.


Happy RPG Making!