I desperately need help fixing this common event

Hi there!
So this might be a really stupid thing but I'm pretty new to rpg maker and I'm stuck on this problem.
I created a skill which equips a weapon to the actor & adds 6 "Bullet Tokens" to the inventory. "Bullet Tokens" are consumed upon attacking. All of this works (with help from the Yanfly engine), however I'm trying to figure out a way to get rid of the items + weapon when the skill is used again, so that the Bullet Tokens are reset to 6 (for balancing reasons). So ideally, if the character has i.e. 3 Bullet Tokens and uses the Skill a second time, they should now have 6 Bullet Tokens in their inventory again (hope that makes sense).
Currently, the skill runs this common event, however when using the skill the game seems to be stuck in a constant loop.
Again, this might be a really stupid problem but any and all help is greatly appreciated <3
XO50 - RPG Maker MV 13.12.2023 19_50_44.png
self switches dont work in common events running in battles iirc, so youre immediately going into your else block which doesnt have a break and youre staying there. try using a regular game switch

EDIT: although, with what youre trying to do, since youre already using yanfly plugins, you could do without the common event entirely and use script calls within skill notetags to do all that stuff
Currently, the skill runs this common event, however when using the skill the game seems to be stuck in a constant loop.
Because you put it in a loop. For one thing, I see no logical reason for a loop at all. For another, you have it checking for Self Switch A to be on. Common events don't have any self switches, so that can never be true.

It also seems weird that you're equipping the Revolver inside of this - when is it supposed to be unequipped or go away? It seems like that should happen at the end of the skill, not the next time they use it.

So that's a weird thing that I'm not going to duplicate. But as far as setting the bullets to 6, that's really easy.

1702495861529.png


That's all you need.

If you want the skill to give the revolver and its skill (and, again, as a player it seems kind of weird to use a skill that gives me a weapon during combat), then you put that in here, then have a different common event run by the Revolver Shot skill that checks whether bullets = 0, then removes the revolver and the skill.
Because you put it in a loop. For one thing, I see no logical reason for a loop at all. For another, you have it checking for Self Switch A to be on. Common events don't have any self switches, so that can never be true.

It also seems weird that you're equipping the Revolver inside of this - when is it supposed to be unequipped or go away? It seems like that should happen at the end of the skill, not the next time they use it.

So that's a weird thing that I'm not going to duplicate. But as far as setting the bullets to 6, that's really easy.

View attachment 287772

That's all you need.

If you want the skill to give the revolver and its skill (and, again, as a player it seems kind of weird to use a skill that gives me a weapon during combat), then you put that in here, then have a different common event run by the Revolver Shot skill that checks whether bullets = 0, then removes the revolver and the skill.
You're a lifesaver, thank you so much!!! T-T Also yeh I can see that the whole weapon equip thing feels a little off but I thought that it would be a fun game mechanic to have the character summon different weapons during combat so I'll keep it for now :>
Okay. Then see my bottom section above on how to deal with it.
Okay. Then see my bottom section above on how to deal with it.
I did it and it worked! Huge thanks! :>

Original thread: https://forums.rpgmakerweb.com/threads/i-desperately-need-help-fixing-this-common-event.163824/