Dealing damage based on a selected G amount

So what i want to do is have a skill open a choice box where i select a gold amount (i'm content with the six choice slots, but if someone knows how to select any number, please let me know)
From there i want the choice to take the selected amount of G away from the party, set a variable to that amount, and then enter that variable into the skill's damage equation.

My only problem is that the skills effects resolve *after* the damage formula, so i cant open the dialogue box before the ability goes off. Is there a way I can call the effects before damage is resolved? Or another way I should be going about this?
Yanfly action sequences have the ability to use common events. You can implement the gold window there easily.

Original thread: https://forums.rpgmakerweb.com/threads/dealing-damage-based-on-a-selected-g-amount.81721/