Point Card Item (Legend of Legaia)

Hi guys, since I'm still learning scripting (although like a slowpoke), I need some help with a little snippet here. Anyone remembers the Point Card item from Legend of Legaia?

The effect in question is "Earn points worth 5% of the price when you shop."

Basically I need a script that does the same thing, everytime the player buys or sells something in a shop, the script will store a determinate percentage value of the money spent (or earned) in a variable and then convert this value into an integer number (damage points) to be added each time to the card. (accumulating the points till you use the item in battle)

When you use the Point Card in battle, you will damage the enemy with the earned points, and then the points will reset to 0.

I hope I explained myself, a million of thanks to those who will do to me this little favor.

You will also be fully credited and thanked in the credits of my game.
If that item is a unique item (only once in the game), then I would reserve a $game_variable for those points, add into the scripts for shop payment a formula to add the value to that variable.

And on the item, make it use a common event to check the value and distribute those points on the specified enemies.

If you want several of those cards, you'll need to add script handling for variable storage - perhaps from PK8's self variable suite.

If you want to distribute the damage in a way that is not possible by common event, that will require a third script to give you other options.

But it should be easier to handle if you split the functions up into several small scripts and combine them by events instead of trying to get everything controlled in one script.
Thanks for the reply! Yes, it's an unique item, so I'll try your first suggestion and will let you know if it works.

EDIT: Finally it works! Thanks again for everything!
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/point-card-item-legend-of-legaia.18085/