You will need at least 2 variables:
levelup_total: how many levels to give the player.
levelup_items: how many levels the current item will give the player (you can reuse this for itemA, itemB, and itemC)
The event would look like this:
- Set
levelup_total to 0.
- Set
levelup_items to the number of itemA you have.
- Divide
levelup_items by 4. This gives you how many levels the player gets from itemA.
- Increase
levelup_total by levelup_items.
- Depending on whether itemA is a real item or just a variable:
- If a real item:
- Multiply
levelup_items by 4. This gives you how many itemA have been consumed.
Change Items...: decrease itemA by levelup_items.
- You said that each item is tied to a variable, so it might make sense to set the variable for itemA to the new number of itemA you have.
- If just a variable:
- Change the itemA variable by mod 4. This gives you how many of itemA remain.
- Repeat points 2 to 5 for itemB and itemC. Make sure you divide/multiply/mod by 2 for itemB, and by 1 for itemC (you can skip the divide/multiply operations for itemC, and instead of mod 1 you can set itemC directly to 0).
Change Level... increase by levelup_total.
If "repeating points 2 to 5" for each item is too much work, you could use a common event. In this case:
Use 3 variables:
levelup_total
levelup_items
items_per_levelup: how many items to consume for 1 level up (e.g. 4 for itemA, 2 for itemB, 1 for itemC)
The event would look like this:
- Set
levelup_total to 0.
- Set
levelup_items to the number of itemA you have.
- Set
items_per_levelup to 4.
- Call
Common Event...
- Depending on whether itemA is a real item or just a variable:
- If a real item:
Change Items...: decrease itemA by levelup_items.
- Consider setting the itemA variable to the new number of itemA you have.
- If just a variable:
- Set the itemA variable to the value of
levelup_items
- Repeat points 2 to 5 for itemB and itemC. Make sure to set
items_per_levelup to 2 for itemB and 1 for itemC.
Change Level... increase by levelup_total.
The common event would look like this:
- Divide
levelup_items by items_per_levelup.
- Increase
levelup_total by levelup_items.
- Depending on whether your items are real items or just variables:
- If real items: multiply
levelup_items by items_per_levelup.
- If just variables: change
levelup_items by mod items_per_levelup.
While it doesn't seem like you're saving much work from using a common event, you're less likely to make a mistake with this approach. With both approaches you'd have to copy-paste points 2 to 5, but with the common event, you'd only have to modify points 2 and 3 instead of modifying points 2, 3 and 5.1. The less things you have to modify, the less likely it is that you'll make a mistake.
Which approach you choose is up to you, of course.