Custom Use Conditions

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

(note: by default, items that cannot be used are hidden. This is a modified project that simply grays them out)

This script allows you to define custom use conditions for your items and skills. The default use conditions are only available for skills, and is limited to specifying up to two weapon types.

This script allows you to define requirements based on things like

  • actor’s class
  • equipped weapons
  • equipped armors
  • equipped weapon types
  • equipped armor types
  • learned skills
  • active states
  • formulas, for anything else

You can create conditions to require multiple conditions to be met, or require at least one condition to be met.


Script: download here


In the script editor, place this script below Materials and above Main


Specifying Use Conditions

Note-tag your skills or items with the following

<use conditions>
</use conditions>

Refer to the reference section for a list of available use conditions.

There is a special “formula” type that allows you to evaluate any arbitrary formula. The following formula variables are available

a - current actor
p - game party
t - game troop
s - game switches
v - game variables

Use Condition Groups

All use conditions are organized into separate “use condition groups”. The notetag that you see above describes a single condition group. You can have multiple condition groups by simply defining multiple notetags.

A skill is said to be “usable” if at least one condition group is satisfied. A condition group is satisfied only if all conditions within the group are satisfied. That is, they evaluate to true. Therefore, if you have multiple condition groups, you are only required to satisfy one group in order to use the skill. See the example to understand how condition groups are used.


Suppose you have a Fire Slash skill that can be used under two different conditions as follows

  1. Have the “fire enchant” state (state 7), and equip a sword type weapon (wtype 2), OR
  2. Equip the “Fire Dragon Sword” (weapon 21)

To accomplish this, you will define two use condition groups by notetagging
your skill with

<use conditions>
  state: 7
  wtype: 2
</use conditions>

<use conditions>
  weapon: 21
</use conditions>


The following condition types are available

type: weapon
value: ID
desc: requires the weapon to be equipped

type: armor
value: ID
desc: requires the armor to be equipped

type: wtype
value: ID
desc: requires the weapon type to be equipped

type: atype
value: ID
desc: requires the armor type to be equipped

type: actor
value: ID
desc: requires the user to be a specific actor

type: class
value: ID
desc: requires the actor to have the given class

type: state
value: ID
desc: requires the state to be currently applied to the actor

type: learned
value: ID
desc: requires the actor to have learned the specified skill

type: formula
value: ruby formula
desc: requires the formula to evaluate to true

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

96 Responses

  1. Anonymous says:

    Any chance this is still being converted to RPG maker MV?

  2. MHRob says:

    Hello, Hime. I was wondering, when using this script, how would I go about using switches and variables as conditions? Is this possible at all?

  3. Amie says:

    Is there any way to modify the script so that it hides the skill instead of just graying it out? It’s a very useful script for making actor-exclusive skills, but I don’t want other actors to see it. 🙂

  4. kevin eontrainaer says:

    It doesn’t work.. It ignores every restrictions I gave…
    I want an item to be able to be used by a specific character so I give this notetag

    actor: 12
    class: 13
    </use conditions>

    The item is usable only from menu…
    But then when I use the item, it can still be usable to all party members despite of their actor ID and Class ID.. Pls help…

  5. Zero says:

    So, has this been converted to MV yet?

  6. Allen says:

    Is there a way to use this for consumable items like a rare candy or learn skill tome to check the actors level to use it? My example is I use elemental orbs in my game to hand out experience and stat bonuses, but once my characters hit max level the orbs are still usable to keep increasing their stats and I’ve been looking for the last day for a script to check their level before use.

    • Hime says:

      You can use the formula condition.
      For example to check if the target’s level is less than 20, you can write

      a.level < 20

      • Allen says:

        Is that going in the scripts at line 300 or does that go in the note tag? I get an error for line 281 (seen the same problem in a previous comment that they never came back to further explain).

        • Allen says:

          I have it working now so it stops when a character hits a certain level but it seems once that player (front/first) hits the level cap it turns it off for the whole party.

          • Hime says:

            Custom Use Conditions is not designed for use in the default menu. It works fine in battle, since you can control who the actor is. You would need a script that

            The way item use in the menu works is the user with the highest PHA parameter will be the user.
            By default all actors have the same PHA parameter so the first person in the party uses it.

            If you would like an item to be in effective, you can use a Formula Effect to perform the level change, and then use Conditional Effects to control whether the effect can be used on the target or not.

            changes the way item use occurs in the menu.

        • Allen says:

          If the front character isn’t at max level it allow the item to be used on a max level character that is farther down the formation.

  7. zharth says:

    Any word on when this script will be updated for MV? I’d like to use it on my project I’m porting over from VX Ace. By the way, your Placeholder Message Faces plugin has been a godsend – no more thousands of conditional branches!!! Thanks for all the work you do to support the RPG Maker community. 🙂

    • Hime says:

      Oh, I think I forgot to make a post for it!
      Though, now that I look at it, I didn’t release it yet because it only supported formulas. If that would be enough I could release that as-is.

      • zharth says:

        I could probably work with formulas. It would be better than nothing! But if you’re planning to give it more functionality, I can wait.

        • Hime says:

          Have you had issues with the input format in the Ace version?
          Because currently, there isn’t really a nice way to say something like “wtype 2 or 3 or 4 or 5”

          You would have to create 4 note-tags, each with a single wtype.
          I’m trying to come up with a way to support those kinds of input, but haven’t come up with anything that would be easier than just using a formula.

          • zharth says:

            I don’t recall having any problems, but my needs (so far) have been pretty simple – disabling certain skills and items depending on the value of a switch.

            Anyway, I’m not allergic to formulas!

          • Hime says:

            The difference would be between Switch: 1 and $gameSwitches.value(1)

            I can provide a number of examples to replicate some "basic" conditional checks (eg: switches, variables, actor holding a certain weapon type, armor type, armor ID, etc)

            That might be better, since you could then combine multiple conditions together and doesn't restrict flexibility if you know what you're doing.
            Learning the formulas would also help in any other plugin that relies on formulas, which would make you an overall better RPG Maker gamedev

          • zharth says:

            Absolutely – I think that sounds reasonable.

            Besides, you could always release it that way and then leave the possibility for an update in the future, if users have a lot of problems with the formulas.

  8. Pocky says:

    Hello! I found your site (and this script) via the RPG Maker MV forums, and it looks like this would solve my problem (making a shield required to use a skill) very easily.

    I don’t suppose you’re considering make this into a plugin for MV at any point, are you? ^_^; It would be truly appreciated.

  9. Martin Morales says:

    There is a way to use this script using skill types of an actor?. An example would be all the users of the skill type “Magic” can use the item. If an actor is unable to learn skills of “Magic” type then he o she cannot use the item. I want this for items used to learn skills. Beforehand, thanks.

    • Hime says:

      You can use the “formula” type with the following formula:


      Which will check if the actor has skill type 3. You can check the Terms tab in the database for the ID of the skill type.

  10. axisdude says:

    Trying to make Magic spells exclusive to mages, special skills exclusive to everyone else only.
    Example – I want the item “Heal” to be usable by the mages in the party and only them, to teach that individual that spell.
    In this case the mage is class number 2, so I insert this in the Notes section of the item:

    class: 2
    </use conditions>

    No one can use the item, including the mage. Am I doing something wrong or is this a compatibility issue? These are the scripts I have in my project that have been added in:

    Oh, and actors name’s don’t get greyed out either when selecting them.

    • Hime says:

      Test the script in a new project with no other scripts to verify that there are no compatibility issues.

      • Anonymous says:

        Just tried it in a new project, same issue is happening. Glad it isn’t a script compatibility problem

        • axisdude says:

          I just came across some really strange results. I continued to test this out in the new project and here’s what I found. If the mage is not currently the leader in the party, (with the use conditions active of course) then no one can use the restricted potion. However, if the mage IS the party leader, any party member can use the restricted potion. It’s really weird!

          • Hime says:

            Item usage outside of battle in the menu is based on the actor with the highest PHA stat. By default, every actor has 100% PHA, which means that the first person in the party will be the one that is treated as the user.

      • axisdude says:

        So exactly how do I make this not the case? The last thing I want is to have the party leader be treated as the user. It completely defeats the purpose of using this script.

        • Hime says:

          This script is not focused on how items are used, but only specifies conditions that must be met in order to use the item. As a result, when you're using the default battle/menu system, during battle, this makes sense, but outside of battle, it does not. This is because item usage outside of battle is implemented in a way that is not what you want.

          You have various solutions that you can potentially work towards

          1. Look for a script that will force players to first choose an actor to use an item (in menu). There is no way around this: the default menu system assumes the person with the highest PHA is the user, whereas you may want some ability to select who the user is.
          2. Instead of preventing people from using an item, make it so that using the item on incompatible targets will not do anything. You could have the item call a common event and then have your common event handle the rest of the logic.
          • axisdude says:

            How would I have a comment event do that? I am not familiar with ruby whatsoever and I don’t know how to make the item incompatible with actors via comment event,

          • Hime says:

            A common way using only events is to have the item add a state on the target. The item would then call a common event that will check every actor to see if they have that state. If the state exists, then your event would do something, and then remove the state.

            If you want to change the way item usage works in the menu consider requesting a script on one of the forums.

  11. Arkaik says:

    Is there any formula for it is necessary to have a minimum value of HP, MP or TP?

    • Hime says:

      You can try the following

      a.hp >= 200 - HP is at least 200 > 100 - mp is greater than 100 < 50 - tp is less than 50
      • Arkaik says:

        An error occur everytime i tried it.

        Here’s the thing:

        “Script ‘Custom Use Conditions’ line 281: NoMethodError occurred.
        undefined method ‘value’ for nil:NilClass”

  12. Tom says:

    I’ve tried

    class: 4
    class: 9
    </use conditions>

    Actor: 2
    Actor: 4
    </use conditions>

    I’ve tried it on just the skill, just the item, on both, but no matter what I do, it just grays the item out so nobody can use it. What am I doing wrong?

    • Tom says:

      I of course, used the open tag, too. I guess your site HTML isn’t letting it show up here.

    • Hime says:

      All conditions inside a single note-tag must be met in order for it to be satisfied. What you have written is saying the actor needs to be both class 4 and class 9, which isn’t possible.

      If you mean to say class 4 or class 9 or actor 2 or actor 4 you would need to separate them into their own note-tags.

  13. Jon says:

    Hi, I’m trying to use this script to make conditions based on stats / a formula

    for example I’ve tried putting a.luk > 5

    I have gotten the script to work when I use one of your examples like wtype: 2

    any help would be appreciated, great script collection by the way.

  14. Arsist says:

    You said that you were using a modified project that greys out unusable items. Is that feature on the web somewhere?

  15. The script is now working, it’s just that the actors I assigned for the conditions can’t use it. How can I fix this?

  16. Alright, it might work, but I got another problem. If the conditions weren’t there, the item is usable, yes? However, if I put on the conditions, the conditions are working, but no one can use it, even on the actors I have set them on.

  17. So you need to start over in order for it to work? The script won’t work on an in-progress project?

  18. This is the first script I have used, and for some reason it’s not working. I followed the example of how you are suppose to note-tag the items, but when I enter the game, pretty much everyone can use them even though I put in the conditions. Am I missing something?

  19. Eddweird says:

    Trying to get a book to act as a spell tome. Set it to actor 2, put in the strings, and it won’t work ._. What am I doing wrong?

  20. Llendar Twain says:


    I don't get my coustom conditons at work.
    my magic skills need all a min value mat or agi and nothing seems to work…
    for exmaple: Spell fireball needs 50 mat to use or
    fast attack needs 150 agi

  21. The Predator says:

    Hi Hime! I love your scripts and I have a question for this one: can I set a default condition? I want to show items only for actor 1 if there are no other conditions… is it possible?
    Thanks a lot and greetings from Italy ^.^

  22. Darth_Tacit says:

    It's not a major deal, but when I set the condition and battle use for the actors, the item will disappear from the list instead of showing it greyed out like it is in your screen shot. Is there something I did wrong?

    • Hime says:

      The default behavior for unusable items is to remove them from the list. My project had a modified item list that simply greys it out, to demonstrate that the conditions actually work, and to make it obvious instead of just saying “look, it doesn’t appear!”

      So you will need another script to change the default behavior.

  23. Dawn of Dark says:

    Hello Hime,
    I used your Item and Skill Restrictions before, which I guess it's the predecessor to this one (?), and I really like the function "Require specific word in the (class, weapon, armor) names".
    I guess you did include the function in the form of "type: formula", but since I'm not familiar with scripting, can you help me set up so that a skill requires specific word in the names of a weapon/armor to use?

    • Hime says:

      For example suppose you require the actor to hold a weapon with the word "Dragon". Because an actor can wield more than one weapon, you have to check all of them.

      Your formula would look like

      a.weapons.any? {|obj| =~ /dragon/i}

      If you want to check armors, just replace "weapons" with "armors". If you don't care what type of equip it is you can check "equips" which includes both weapons and armors.

  24. Marcos Luna says:

    For some reason,i cant use attack and guard command… They are dissabled,excuse me for my bad English and greetings from Argentina.

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see