How should I handle buying EXP from a shop?

I tried to just go into it with the shop handler and found that it wasn't able to do what I expected.

The end result I wanted was to buy XP in the shop up to the amount you wanted.

How I tried to handle it:

1. Create item which opens shop common event.

2. Shop is buy only and sells XP

3. "XP" was an unused item slot

4. When the shop closed the amount of "XP" was used to increase experience

5. The "XP" items were removed from inventory

Problems I encountered:

1. You can only buy 99 of an item at a time.

2. I wasn't sure how to set an item to zero so tried just decreasing it by "9999" for my testing.

I know I could make items which grant xp in increasing quantities which could be used on actors and sell those. That just wasn't what I was trying to accomplish with this shop.

Is there some resource I might find helpful to review to create a shop to buy XP?
There are plugins that allow you to increase the max item limit. The function is included in Yanfly's Core Engine as a note tag that you can insert: <Max Item: x>

You can make a common event that runs all the time (preferably on shop maps only as to avoid unnecessary lag) and checks conditional branches to see if you have any of the XP item in your inventory. If you do, it takes them away and applies a set amount of experience to a certain actor. You'd just have to make a unique XP item for each actor that will be available as a party member in your game, and make sure your common event reads them correctly.

That being said, I'm sure there is a way to make this a scripted method that is more versatile. But, I'm not sure how to implement one.

Edit: I forgot to add that, regarding the "increasing XP quantity" you mentioned... that could be set up as a variable that is controlled independently from the common event. You can set up whatever formula you need in a different event, or change it at certain intervals in your game, however you see fit. Just a thought on that. 🙂
I'd recommend changing your title to "How should I handle buying EXP from a shop?" I was wondering why you were asking about RPG Maker XP in the MV support forum. 😛
Nutty171 has a point, but last I checked members can't edit thread titles, so I did it for you so that it is more clear. Using EXP should help people know you are not referring to RPGMaker XP.
preferably on shop maps only as to avoid unnecessary lag

This is something I was wondering about. So far everything I have really worked on changing I have done by writing my own plugins.

How much of a lag problem is there caused by using common events that run all the time? I am wanting the EXP shop to be accessible on all maps using an item so if it could cause I big problem down the line I assume I could just handle the item removal and EXP gain in a plugin altering the on purchase functionality.

Original thread: https://forums.rpgmakerweb.com/threads/how-should-i-handle-buying-exp-from-a-shop.80694/