Item level requirements

How do you add a level requirement on an item? Not a weapon/armor/accessory/shield, an ITEM. Like a skill book or a potion. How?
Sounds to me like you'll want to make the item trigger a Common Event, which starts by checking for the user's level. (Conditional Branch, Script Call - but I can't for the life of me recall what the exact script call to check level would be right now.)

Hope that suggestion at least puts you on the right track.
Yes, without a script, you'd do it with a common event attached to the item.


Control Variables will let you put an actor's level into a variable, which you can then use as a conditional branch. If the item is consumable, and the user isn't the appropriate level, you will need to add the item back to the player's inventory as it will already have been removed.


Using a common event to determine whether the item can be used also means you need to put all the item effects, damage, etc into the common event as well, and leave it off the item setup itself, as the common event is called AFTER damage has been dealt.
Does anyone know of a script that can add a level requirement to an item? There is some created for weapons/armors, but I can't find one for items.

I would rather not do the common event route, as that's ALOT of common events. I want to make a skill book system where you learn a skill from the book. I have a script that limits what classes can use the item, I just need one to now limit the actors level to use the item.
I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.


I'm not aware of any existing (because I rarely search for scripts - I just roll my own). Take a look at the Master Script List (pinned at the top of the RGSS3 Script Requests forum) and see if you can find something suitable.


If not, I might be able to write one for you (or someone else might be). You'd need to provide a bit more information though and answer a few questions.
I didn't know it was going to be a script request. I thought maybe it could be done normally.

Ya, if you or someone could that would be awesome.

What questions need to be answered and what more info needs to be known?

More info:

Add a way to check on item use if the person using the item is the right class. So class restrictions.

Add a way to check on item use if the person using the item is the right level. So level requirements.

This is pretty much it. I want to be able to buy a skill book with the effect of learn skill X on the item. I don't want the item to be used if the wrong class tries to use the item OR if the user is too low level to learn the skill.
In the menu, there is no person "using" the item - only (potentially) a person that the item is being used on.


I imagine if you buy a spell book you want to use it from the menu, not in battle. But you probably don't want to choose the spell book and then have to pick a target.


How will the script decide what actor it's meant to look at, to determine if they are the wrong class or the wrong level, if you have 4 people in your party?
Yes. The item can only be used from the menu. I think it's fine to use the item, then pick the target. That's how it works be default. When I go to use the skill book, I pick the target to use it on, if the target can't use it, it does nothing. If it can be used, it consumes the item. Right now all I have is the class restriction script that does this.
Can I please get someone to create this OR edit this script to allow item restrictions as well.
bump
Can I please get someone to create this OR edit this script to allow item restrictions as well.
I could have a look at changing that script tonight once I get home from work, if you like.  I will install it and see what it currently does.

Am I right that you want it to continue checking the class restriction, and just have an additional check for level restriction as well?
Yes. Exactly right. Thank you very much!
I've made my changes to the script. Had to make a few changes to the way that the classes were handled, although it should all still work the same.  I did find that the class restrictions did not appear to be working in battles, so I had to rewrite a chunk of the script to get it to work.  Seems okay in my test project, so if you want to give it a go and see if the class and level restrictions work both in and out of battles:


XS-Class Items with Level restrict.rb


To use the level restrictions, just add a notetag to the item like this:


<level: x>


where x is the minimum level that the actor must be to have the item used on them.


Let me know how it all goes, or if there is any problem accessing the script file.


Edited: as I realised after playing around that Magic also called the same methods in the battle so I needed to catch these and ignore the checks for class and level.
You sir are a rock star. TYVM! Everything works exactly like it should. As for using the item's in combat, they are for skill books, which I require to only be used through the menu. 
In the menu, there is no person "using" the item - only (potentially) a person that the item is being used on.
The person that uses an item in the menu is the actor with the highest PHA stat, which may affect your recovery items.

Original thread: https://forums.rpgmakerweb.com/threads/item-level-requirements.37184/