(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> TYPE1: VALUE1 TYPE2: VALUE2 </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
- Have the “fire enchant” state (state 7), and equip a sword type weapon (wtype 2), OR
- 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
desc: requires the weapon to be equipped
desc: requires the armor to be equipped
desc: requires the weapon type to be equipped
desc: requires the armor type to be equipped
desc: requires the user to be a specific actor
desc: requires the actor to have the given class
desc: requires the state to be currently applied to the actor
desc: requires the actor to have learned the specified skill
value: ruby formula
desc: requires the formula to evaluate to true
Any chance this is still being converted to RPG maker MV?
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?
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. 🙂
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
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…
How are you testing the project? Have you saved before testing it?
no openig notetag, only closing notetag?
So, has this been converted to MV yet?
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.
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
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).
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.
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.
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.
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. 🙂
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.
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.
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.
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!
The difference would be between
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
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.
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.
Yes, I am planning to convert this to MV
Awesome, thank you very much! ^_^
As soon as I have some spare cash, I will be joining your Patreon. You do great work!
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.
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.
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:
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.
Test the script in a new project with no other scripts to verify that there are no compatibility issues.
Just tried it in a new project, same issue is happening. Glad it isn’t a script compatibility problem
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!
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.
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.
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
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,
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.
Is there any formula for it is necessary to have a minimum value of HP, MP or TP?
You can try the following
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”
Does this occur in a new project?
How have you set up your note-tags?
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?
I of course, used the open tag, too. I guess your site HTML isn’t letting it show up here.
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.
It stops graying out the item, but it the characters that meet the criterion still can’t use the item. Obviously, I’ve changed something but it’s still not working so I’m feeling stupid here. I’ve tried specifying class 4, which is the spellblade on my system default. I’ve tried leading zero’s. I’ve even tried spelling the whole thing out:
And I’ve tried the same things with the actor tags. Yet they still won’t use the item. What am I missing?
Does this script have a problem with Yanfly?
I’ve tried opening a new project with no custom scripts and I still can’t get it to work.
Do you have to use the Ruby formula too?
Send me the new project with the note-tag you tried to use.
This goes to a Dropbox folder I just made.
Oh, sorry, the note-tag is found in the last item, Learn Heal.
Sorry. I forgot. I’m used to just compressing it. I’ve downloaded what should be everything except for RTP.
You need to upload more than just the rvdata and some images.
If you are talking about using it from the menu, the default menu assumes the person with the highest PHA stat will be “using” the item. This script only provides functionality for checking whether an item is usable or not. It does not change who will be doing the checks.
You will need another script if you want to change the way the item menu works.
Thank you so much for your help.
Do you have any suggestions?
I would consider looking for a script that allows you to choose which actor to access the inventory. Or just have separate inventories for each actor.
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.
Did you specify it as
You said that you were using a modified project that greys out unusable items. Is that feature on the web somewhere?
I don’t know, I’ve never checked.
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?
You need to show me what your conditions are otherwise I don’t know if you’re doing something wrong or unexpected.
This comment system eats up the note-tag syntax. In the examples I show how you can create two separate conditions where you have state 7 and wtype 2, or you have weapon 7. Does your note-tag look like that?
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.
What are your conditions?
So you need to start over in order for it to work? The script won’t work on an in-progress project?
No, it’s possible that you simply didn’t set it up properly. If it works in a new project, and the same setup doesn’t work in an existing project, then there are likely compatibility issues between scripts.
I see. I’ve got it working, but it seems I can’t put more than one class, actor, etc. per condition. I forgot to tell you that I am making items that multiple actors are able to use instead of just one person for one specific item. Is it possible?
Create separate note-tags, one for each group of conditions.
I’m not good at note-tagging, but how will look?
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?
What is your condition?
I am making actor and class specific items, and I put in the following as note tags:
When I go to the game, however, every character is able to use it.
Are you using the proper tags?
Does this occur in a new project?
I just tried the same conditions and it works for me.
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?
What are you trying to accomplish?
It’s just a spell tome used in the menu that teaches a spell. I wanna make it so only the Mage can use it.
Ok. What is your note-tag?
Oh. The signs didn’t post. It’s following the guideline exactly. I must have something messed up though.
Does this problem occur in a new project? It may be a compatibility issue.
Ah. Yes, it worked on a new project. I’ll fiddle and see what I can come up with. Worse things worse the player used a Spell Tome on someone who wasn’t a warrior. Should’a been more careful.
Anyways, thanks for you help and time.
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
What have you tried?
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 ^.^
What do you mean by "show items omly for actor 1"?
I want the condition <i>actor: 1</i> by default if I don't set another condition
It seems better to just add the tag to every item/skill.
Ok, I'll do it 😉
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?
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.
Thank you for the quick reply. I'll look around for a script like that.
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?
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
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.
Thanks, I love your scripts 🙂
For some reason,i cant use attack and guard command… They are dissabled,excuse me for my bad English and greetings from Argentina.
I have updated the script to fix this problem. Download the newest version and it should work.