Bomb Item Salvage Idea

Okay, so in one of my games I am using a bomb skill, akin to the alchemist class in Pathfinder, but I have a very specific idea for how I hope I can make it work, but I am not sure how to make it work, or if it is even possible.

The bombs come in the form of spheres,so the character is limited in the number of bombs he or she can use based upon the number of spheres they possess. Skill Cost items script should cover this, however, there is a bit of variation that I would like to include, which is where I down know how to accomplish this. Basically, after the battle, if you win it, I want a percentage chance to be rolled (equal to the characters level) to determine if the bomb remains can be salvaged, resulting in a broken bomb being awarded, and once you can find an alchemy lab, you can repair and broken bombs you possess to use again.

I do have the Extra Enemy drops plugin, which allows for conditional drops, but not sure how to code what I want to happen with it. The problem being that I have a huge variety of bombs, so I need to track not by element, but by individual items used, and track the number used, and then make the percentage chance equal to the users level.
Everytime you use that skill, turn on a switch, let's say 20, and increase variable, let's say also 20, by one. I think yanfly's action sequences should be able to do the job.
Then have a parallel process common event. Trigger: Switch 20
if variable 20 is greater than zero, roll a random integer and ten simply if it succeeds, return bombs and say an appropriate message. Simple.
Everytime you use that skill, turn on a switch, let's say 20, and increase variable, let's say also 20, by one. I think yanfly's action sequences should be able to do the job.
Then have a parallel process common event. Trigger: Switch 20
if variable 20 is greater than zero, roll a random integer and ten simply if it succeeds, return bombs and say an appropriate message. Simple.
I was just about going to bed for the night when I saw you replied and I had some thoughts too add Before I Forget by morning LOL what you suggest sounds promising it will just require a lot of variables to track all of the different bombs. In my case I have 256 of them to keep track of them, but may consolidate the common events and variables by elements, and just having the recovered bombs default to the lowest level but having the capacity to being upgraded prior to being restored.

By the way, if 256 seems like a huge number, then it is, but I have 8 types of elemental bombs, light, dark, wind, fire, earth, water, ice, and lightning, and each bomb has four power tiers and single target as well as all enemy varieties. 8×8×4. I might also level lock each of the bomb tears so that it doesn't get so insane in the inventory. I just don't want people getting late game bombs too early. If I can figure out how to the tact when the bomb user levels up to a certain points and then detect the number of each type of bomb they possess and replace them with the higher-tier bombs that would probably be better. However I plan to have a separate inventory section for bombs which will help a lot with not cluttering up the other sections. Ignoring the four tiers would cut down the number 264 which is probably a far more reasonable number for players to deal with. It sounds like it'll be a pain in the butt to code it all in but but I think it will be worth it in the long run. So I will need 16 common events and 16 variables and one switch. That is far easier than making 256 of them.

Edit- I was tired and dead bat math bad that before I went to bed. It is only 64 total. There are eight elements X for tears of strength x 2 variations of each level. One Target and all Target. I multiply the four in a second time yesterday
Well, changing tiers for reaching certain levels is pretty easy too, since the ability to store items held in variables and then reference these is a basic feature of the engine.

But actually, you don't need more than 1 variable. Because javascript allows us to create arrays. So whether you decide to create a global variable on your own or use a game variable, doesn't matter.
Use two arrays. One will store the item ID, another will store the amount of times the bomb was used.
Then after a battle run a for cycle in one of those.
Well, changing tiers for reaching certain levels is pretty easy too, since the ability to store items held in variables and then reference these is a basic feature of the engine.

But actually, you don't need more than 1 variable. Because javascript allows us to create arrays. So whether you decide to create a global variable on your own or use a game variable, doesn't matter.
Use two arrays. One will store the item ID, another will store the amount of times the bomb was used.
Then after a battle run a for cycle in one of those.
I have not heard about arrays before. So one varoable can track all bomb types used? How do arrays work?
Arrays are a javascript thing. I'd recommend to learn some at sololearn.com. You'll understand better. I won't be teaching you basic javascript here.
Arrays are a javascript thing. I'd recommend to learn some at sololearn.com. You'll understand better. I won't be teaching you basic javascript here.
I'm on the website now. I might as well learn as much as I can so start from the beginning, not that it seems to give me any choice lol.

Original thread: https://forums.rpgmakerweb.com/threads/bomb-item-salvage-idea.82791/